use of org.alfresco.web.config.DashboardsConfigElement.DashletDefinition in project acs-community-packaging by Alfresco.
the class DashboardsElementReader method parse.
/**
* @see org.springframework.extensions.config.xml.elementreader.ConfigElementReader#parse(org.dom4j.Element)
*/
@SuppressWarnings("unchecked")
public ConfigElement parse(Element element) {
DashboardsConfigElement configElement = new DashboardsConfigElement();
if (element != null) {
if (DashboardsConfigElement.CONFIG_ELEMENT_ID.equals(element.getName()) == false) {
throw new ConfigException("DashboardsElementReader can only process elements of type 'dashboards'");
}
Element layoutsElement = element.element(ELEMENT_LAYOUTS);
if (layoutsElement != null) {
Iterator<Element> layoutsItr = layoutsElement.elementIterator(ELEMENT_LAYOUT);
while (layoutsItr.hasNext()) {
LayoutDefinition layoutDef = parseLayoutDefinition(layoutsItr.next());
configElement.addLayoutDefinition(layoutDef);
}
}
Element dashletsElement = element.element(ELEMENT_DASHLETS);
if (dashletsElement != null) {
Iterator<Element> dashletsItr = dashletsElement.elementIterator(ELEMENT_DASHLET);
while (dashletsItr.hasNext()) {
DashletDefinition dashletDef = parseDashletDefinition(dashletsItr.next());
configElement.addDashletDefinition(dashletDef);
}
}
Element defaultDashletsElement = element.element(ELEMENT_DEFAULTDASHLETS);
if (defaultDashletsElement != null) {
Iterator<Element> dashletsItr = defaultDashletsElement.elementIterator(ELEMENT_DASHLET);
while (dashletsItr.hasNext()) {
String id = getMandatoryDashletAttributeValue(dashletsItr.next(), ATTR_ID);
configElement.addDefaultDashlet(id);
}
}
Element guestConfigElement = element.element(ELEMENT_GUESTCONFIG);
if (guestConfigElement != null) {
boolean allow = Boolean.parseBoolean(guestConfigElement.getTextTrim());
configElement.setAllowGuestConfig(allow);
}
}
return configElement;
}
Aggregations