use of com.enonic.xp.xml.DomElement in project xp by enonic.
the class XmlWidgetDescriptorParser method doParse.
@Override
protected void doParse(final DomElement root) throws Exception {
assertTagName(root, "widget");
this.builder.displayName(root.getChildValueTrimmed("display-name"));
this.builder.description(root.getChildValue("description"));
final DomElement interfaces = root.getChild("interfaces");
if (interfaces != null) {
final List<DomElement> interfaceList = interfaces.getChildren("interface");
for (DomElement anInterface : interfaceList) {
this.builder.addInterface(anInterface.getValue().trim());
}
}
final DomElement allowedPrincipals = root.getChild("allow");
if (allowedPrincipals != null) {
final List<PrincipalKey> allowedPrincipalList = allowedPrincipals.getChildren("principal").stream().map(allowedPrincipal -> PrincipalKey.from(allowedPrincipal.getValue().trim())).collect(Collectors.toList());
this.builder.setAllowedPrincipals(allowedPrincipalList);
}
final DomElement config = root.getChild("config");
if (config != null) {
final List<DomElement> properties = config.getChildren("property");
for (DomElement property : properties) {
this.builder.addProperty(property.getAttribute("name"), property.getAttribute("value"));
}
}
}
Aggregations