Search in sources :

Example 1 with DomElement

use of com.enonic.xp.xml.DomElement in project xp by enonic.

the class XmlRelationshipTypeParser method parseTypes.

private List<ContentTypeName> parseTypes(final DomElement root, final String name) {
    final DomElement types = root.getChild(name);
    if (types == null) {
        return Collections.emptyList();
    }
    final ApplicationRelativeResolver resolver = new ApplicationRelativeResolver(this.currentApplication);
    return types.getChildren("content-type").stream().map(child -> resolver.toContentTypeName(child.getValue().trim())).collect(Collectors.toList());
}
Also used : PublicApi(com.enonic.xp.annotation.PublicApi) List(java.util.List) RelationshipType(com.enonic.xp.schema.relationship.RelationshipType) ApplicationRelativeResolver(com.enonic.xp.app.ApplicationRelativeResolver) ContentTypeName(com.enonic.xp.schema.content.ContentTypeName) DomElement(com.enonic.xp.xml.DomElement) Collections(java.util.Collections) Collectors(java.util.stream.Collectors) DomElement(com.enonic.xp.xml.DomElement) ApplicationRelativeResolver(com.enonic.xp.app.ApplicationRelativeResolver)

Example 2 with DomElement

use of com.enonic.xp.xml.DomElement in project xp by enonic.

the class XmlServiceDescriptorParser method doParse.

@Override
protected void doParse(final DomElement root) throws Exception {
    assertTagName(root, "service");
    final DomElement allowedPrincipals = root.getChild("allow");
    if (allowedPrincipals != null) {
        final List<PrincipalKey> allowedPrincipalKeys = new ArrayList<>();
        final List<DomElement> allowedPrincipalList = allowedPrincipals.getChildren("principal");
        for (DomElement allowedPrincipal : allowedPrincipalList) {
            allowedPrincipalKeys.add(PrincipalKey.from(allowedPrincipal.getValue().trim()));
        }
        this.builder.setAllowedPrincipals(allowedPrincipalKeys);
    }
}
Also used : DomElement(com.enonic.xp.xml.DomElement) ArrayList(java.util.ArrayList) PrincipalKey(com.enonic.xp.security.PrincipalKey)

Example 3 with DomElement

use of com.enonic.xp.xml.DomElement in project xp by enonic.

the class XmlNodeParser method parseIndexConfig.

private IndexConfig parseIndexConfig(final DomElement root) {
    final IndexConfig.Builder builder = IndexConfig.create().decideByType(root.getChildValueAs("decideByType", Boolean.class, false)).enabled(root.getChildValueAs("enabled", Boolean.class, false)).fulltext(root.getChildValueAs("fulltext", Boolean.class, false)).nGram(root.getChildValueAs("nGram", Boolean.class, false)).includeInAllText(root.getChildValueAs("includeInAllText", Boolean.class, false));
    final DomElement indexValueProcessors = root.getChild("indexValueProcessors");
    if (indexValueProcessors != null) {
        for (DomElement indexValueProcessor : indexValueProcessors.getChildren()) {
            builder.addIndexValueProcessor(IndexValueProcessors.get(indexValueProcessor.getValue()));
        }
    }
    final DomElement languages = root.getChild("languages");
    if (languages != null) {
        for (DomElement language : languages.getChildren()) {
            builder.addLanguage(language.getValue());
        }
    }
    return builder.build();
}
Also used : IndexConfig(com.enonic.xp.index.IndexConfig) PathIndexConfig(com.enonic.xp.index.PathIndexConfig) DomElement(com.enonic.xp.xml.DomElement)

Example 4 with DomElement

use of com.enonic.xp.xml.DomElement in project xp by enonic.

the class XmlApplicationParser method doParse.

@Override
protected void doParse(final DomElement root) throws Exception {
    assertTagName(root, ROOT_TAG_NAME);
    this.appDescriptorBuilder.key(currentApplication);
    final DomElement descriptionElement = root.getChild(DESCRIPTION);
    if (descriptionElement != null) {
        this.appDescriptorBuilder.description(descriptionElement.getValue());
    }
}
Also used : DomElement(com.enonic.xp.xml.DomElement)

Example 5 with DomElement

use of com.enonic.xp.xml.DomElement in project xp by enonic.

the class XmlContentTypeParser method buildMetaData.

private XDataNames buildMetaData(final DomElement root) {
    final List<XDataName> names = new ArrayList<>();
    for (final DomElement child : root.getChildren("x-data")) {
        String name = child.getAttribute("name");
        names.add(this.resolver.toXDataName(name));
    }
    return XDataNames.from(names);
}
Also used : DomElement(com.enonic.xp.xml.DomElement) ArrayList(java.util.ArrayList) XDataName(com.enonic.xp.schema.xdata.XDataName)

Aggregations

DomElement (com.enonic.xp.xml.DomElement)11 PrincipalKey (com.enonic.xp.security.PrincipalKey)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 WidgetDescriptor (com.enonic.xp.admin.widget.WidgetDescriptor)1 PublicApi (com.enonic.xp.annotation.PublicApi)1 ApplicationRelativeResolver (com.enonic.xp.app.ApplicationRelativeResolver)1 IndexConfig (com.enonic.xp.index.IndexConfig)1 PathIndexConfig (com.enonic.xp.index.PathIndexConfig)1 ContentTypeName (com.enonic.xp.schema.content.ContentTypeName)1 RelationshipType (com.enonic.xp.schema.relationship.RelationshipType)1 XDataName (com.enonic.xp.schema.xdata.XDataName)1 AccessControlList (com.enonic.xp.security.acl.AccessControlList)1 ControllerMappingDescriptor (com.enonic.xp.site.mapping.ControllerMappingDescriptor)1 GenericStyle (com.enonic.xp.style.GenericStyle)1 ImageStyle (com.enonic.xp.style.ImageStyle)1 XmlModelParser (com.enonic.xp.xml.parser.XmlModelParser)1 Collections (java.util.Collections)1