Search in sources :

Example 11 with SiteConfig

use of com.enonic.xp.site.SiteConfig in project xp by enonic.

the class ControllerMappingsResolverTest method newSite.

private Site newSite() {
    final SiteConfig siteConfig = SiteConfig.create().application(getAppKey()).config(new PropertyTree()).build();
    final SiteConfig siteConfig2 = SiteConfig.create().application(getAppKey2()).config(new PropertyTree()).build();
    final Site.Builder site = Site.create();
    site.id(ContentId.from("100123"));
    site.siteConfigs(SiteConfigs.from(siteConfig, siteConfig2));
    site.name("mysite");
    site.parentPath(ContentPath.ROOT);
    return site.build();
}
Also used : Site(com.enonic.xp.site.Site) PropertyTree(com.enonic.xp.data.PropertyTree) SiteConfig(com.enonic.xp.site.SiteConfig)

Example 12 with SiteConfig

use of com.enonic.xp.site.SiteConfig in project xp by enonic.

the class TestDataFixtures method newSite.

public static Site.Builder newSite() {
    final PropertyTree siteConfigConfig = new PropertyTree();
    siteConfigConfig.setLong("Field", 42L);
    final SiteConfig siteConfig = SiteConfig.create().application(ApplicationKey.from("myapplication")).config(siteConfigConfig).build();
    final Site.Builder site = Site.create();
    site.id(ContentId.from("100123"));
    site.siteConfigs(SiteConfigs.from(siteConfig));
    site.name("my-content");
    site.parentPath(ContentPath.ROOT);
    site.permissions(AccessControlList.of(AccessControlEntry.create().principal(RoleKeys.EVERYONE).allow(Permission.READ).build()));
    return site;
}
Also used : Site(com.enonic.xp.site.Site) PropertyTree(com.enonic.xp.data.PropertyTree) SiteConfig(com.enonic.xp.site.SiteConfig)

Example 13 with SiteConfig

use of com.enonic.xp.site.SiteConfig in project xp by enonic.

the class MacroInstruction method resolveMacroDescriptorCaseInsensitive.

private MacroDescriptor resolveMacroDescriptorCaseInsensitive(final SiteConfigs siteConfigs, final String macroName) {
    for (SiteConfig siteConfig : siteConfigs) {
        final MacroDescriptors macroDescriptors = macroDescriptorService.getByApplication(siteConfig.getApplicationKey());
        final MacroDescriptor macroDescriptor = macroDescriptors.stream().filter((md) -> md.getName().equalsIgnoreCase(macroName)).findFirst().orElse(null);
        if (macroDescriptor != null) {
            return macroDescriptor;
        }
    }
    return null;
}
Also used : MacroDescriptor(com.enonic.xp.macro.MacroDescriptor) SiteConfig(com.enonic.xp.site.SiteConfig) MacroDescriptors(com.enonic.xp.macro.MacroDescriptors)

Example 14 with SiteConfig

use of com.enonic.xp.site.SiteConfig in project xp by enonic.

the class ProcessorChainResolver method resolve.

public ResponseProcessorDescriptors resolve(PortalRequest request) {
    SiteDescriptor siteDescriptor;
    List<ResponseProcessorDescriptor> filterChain = new ArrayList<>();
    for (SiteConfig siteConfig : request.getSite().getSiteConfigs()) {
        siteDescriptor = siteService.getDescriptor(siteConfig.getApplicationKey());
        if (siteDescriptor != null) {
            for (ResponseProcessorDescriptor filterDescriptor : siteDescriptor.getResponseProcessors()) {
                filterChain.add(this.findIndexToInsert(filterDescriptor, filterChain), filterDescriptor);
            }
        }
    }
    return ResponseProcessorDescriptors.from(filterChain);
}
Also used : SiteDescriptor(com.enonic.xp.site.SiteDescriptor) ResponseProcessorDescriptor(com.enonic.xp.site.processor.ResponseProcessorDescriptor) ArrayList(java.util.ArrayList) SiteConfig(com.enonic.xp.site.SiteConfig)

Example 15 with SiteConfig

use of com.enonic.xp.site.SiteConfig in project xp by enonic.

the class MacroInstructionTest method createSite.

private Site createSite(final String id, final String name, final String contentTypeName) {
    PropertyTree rootDataSet = new PropertyTree();
    SiteConfig siteConfig = SiteConfig.create().application(ApplicationKey.from("myapp")).config(new PropertyTree()).build();
    new SiteConfigsDataSerializer().toProperties(SiteConfigs.from(siteConfig), rootDataSet.getRoot());
    return Site.create().id(ContentId.from(id)).path(ContentPath.from(name)).owner(PrincipalKey.from("user:myStore:me")).displayName("My Content").modifier(PrincipalKey.from("user:system:admin")).type(ContentTypeName.from(contentTypeName)).data(rootDataSet).build();
}
Also used : SiteConfigsDataSerializer(com.enonic.xp.site.SiteConfigsDataSerializer) PropertyTree(com.enonic.xp.data.PropertyTree) SiteConfig(com.enonic.xp.site.SiteConfig)

Aggregations

SiteConfig (com.enonic.xp.site.SiteConfig)16 PropertyTree (com.enonic.xp.data.PropertyTree)11 Site (com.enonic.xp.site.Site)6 ApplicationKey (com.enonic.xp.app.ApplicationKey)5 SiteConfigsDataSerializer (com.enonic.xp.site.SiteConfigsDataSerializer)4 SiteDescriptor (com.enonic.xp.site.SiteDescriptor)4 Test (org.junit.jupiter.api.Test)3 ValidationErrors (com.enonic.xp.content.ValidationErrors)2 Page (com.enonic.xp.page.Page)2 ContentType (com.enonic.xp.schema.content.ContentType)2 GetContentTypeParams (com.enonic.xp.schema.content.GetContentTypeParams)2 ResponseProcessorDescriptor (com.enonic.xp.site.processor.ResponseProcessorDescriptor)2 MacroDescriptor (com.enonic.xp.macro.MacroDescriptor)1 MacroDescriptors (com.enonic.xp.macro.MacroDescriptors)1 PortalResponse (com.enonic.xp.portal.PortalResponse)1 PortalError (com.enonic.xp.portal.impl.error.PortalError)1 SiteConfigs (com.enonic.xp.site.SiteConfigs)1 ResponseProcessorDescriptors (com.enonic.xp.site.processor.ResponseProcessorDescriptors)1 ArrayList (java.util.ArrayList)1