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

com.enonic.xp.site.SiteConfigDataSerializer 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.app.ApplicationKey;
import com.enonic.xp.data.PropertySet;

@PublicApi
public class SiteConfigDataSerializer
{
    public void toData( final SiteConfig siteConfig, PropertySet parentSet )
    {
        final PropertySet siteConfigAsSet = parentSet.addSet( "siteConfig" );
        siteConfigAsSet.addString( "applicationKey", siteConfig.getApplicationKey().toString() );
        siteConfigAsSet.addSet( "config", siteConfig.getConfig().getRoot().copy( parentSet.getTree() ) );
    }

    SiteConfig fromData( final PropertySet siteConfigAsSet )
    {
        return SiteConfig.create().
            application( ApplicationKey.from( siteConfigAsSet.getString( "applicationKey" ) ) ).
            config( siteConfigAsSet.getSet( "config" ).toTree() ).
            build();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy