use of com.enonic.xp.app.ApplicationRelativeResolver in project xp by enonic.
the class XmlContentTypeParser method doParse.
@Override
protected void doParse(final DomElement root) throws Exception {
this.resolver = new ApplicationRelativeResolver(this.currentApplication);
assertTagName(root, "content-type");
this.builder.displayName(root.getChildValueTrimmed("display-name"));
this.builder.displayNameI18nKey(root.getChild("display-name") != null ? root.getChild("display-name").getAttribute("i18n") : null);
this.builder.description(root.getChildValue("description"));
this.builder.descriptionI18nKey(root.getChild("description") != null ? root.getChild("description").getAttribute("i18n") : null);
this.builder.displayNameExpression(root.getChildValueTrimmed("display-name-expression"));
this.builder.superType(this.resolver.toContentTypeName(root.getChildValueTrimmed("super-type")));
this.builder.setAbstract(root.getChildValueAs("is-abstract", Boolean.class, false));
this.builder.setFinal(root.getChildValueAs("is-final", Boolean.class, false));
this.builder.allowChildContent(root.getChildValueAs("allow-child-content", Boolean.class, true));
this.builder.xData(buildMetaData(root));
this.builder.displayNameLabel(root.getChildValueTrimmed("display-name-label"));
this.builder.displayNameLabelI18nKey(root.getChild("display-name-label") != null ? root.getChild("display-name-label").getAttribute("i18n") : null);
final XmlFormMapper mapper = new XmlFormMapper(this.currentApplication);
this.builder.form(mapper.buildForm(root.getChild("form")));
this.builder.schemaConfig(CONFIG_MAPPER.build(root.getChild("config")));
this.builder.allowChildContentType(root.getChildren("allow-child-content-type").stream().map(e -> e.getValue().trim()).collect(Collectors.toList()));
}
use of com.enonic.xp.app.ApplicationRelativeResolver 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.app.ApplicationRelativeResolver in project xp by enonic.
the class XmlSiteParser method toXDataMapping.
private XDataMapping toXDataMapping(final DomElement xDataElement) {
final XDataMapping.Builder builder = XDataMapping.create();
final ApplicationRelativeResolver resolver = new ApplicationRelativeResolver(this.currentApplication);
final String name = xDataElement.getAttribute(X_DATA_ATTRIBUTE_NAME);
builder.xDataName(resolver.toXDataName(name));
final String allowContentTypes = xDataElement.getAttribute(X_DATA_CONTENT_TYPE_ATTRIBUTE);
builder.allowContentTypes(allowContentTypes);
final String optional = xDataElement.getAttribute(X_DATA_OPTIONAL_ATTRIBUTE);
if (optional != null) {
builder.optional(Boolean.valueOf(optional));
}
return builder.build();
}
Aggregations