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());
}
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);
}
}
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();
}
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());
}
}
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);
}
Aggregations