All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.enonic.xp.site.SiteConfigsDataSerializer Maven / Gradle / Ivy

There is a newer version: 7.14.4
Show newest version
package com.enonic.xp.site;


import com.enonic.xp.annotation.PublicApi;
import com.enonic.xp.data.Property;
import com.enonic.xp.data.PropertySet;

@PublicApi
public class SiteConfigsDataSerializer
{
    private final SiteConfigDataSerializer siteConfigSerializer = new SiteConfigDataSerializer();

    public void toProperties( final SiteConfigs siteConfigs, final PropertySet parentSet )
    {
        for ( final SiteConfig siteConfig : siteConfigs )
        {
            siteConfigSerializer.toData( siteConfig, parentSet );
        }
    }

    void toProperties( final SiteConfig siteConfig, final PropertySet parentSet )
    {
        siteConfigSerializer.toData( siteConfig, parentSet );
    }

    public SiteConfigs.Builder fromProperties( final PropertySet data )
    {
        final SiteConfigs.Builder builder = SiteConfigs.create();
        for ( final Property siteConfigAsProperty : data.getProperties( "siteConfig" ) )
        {
            final SiteConfig siteConfig = siteConfigSerializer.fromData( siteConfigAsProperty.getSet() );
            builder.add( siteConfig );
        }
        return builder;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy