Search in sources :

Example 1 with GenericConfigElement

use of org.springframework.extensions.config.element.GenericConfigElement in project acs-community-packaging by Alfresco.

the class NavigationConfigElement method getChildren.

/**
 * @see ConfigElement#getChildren()
 */
public List<ConfigElement> getChildren() {
    // lazily build the list of generic config elements representing
    // the navigation overrides as the caller may not even call this method
    List<ConfigElement> kids = null;
    if (this.viewIds.size() > 0 || this.outcomes.size() > 0) {
        if (this.kidsPopulated == false) {
            // create generic config elements for the from-view-id items
            for (String fromViewId : this.viewIds.keySet()) {
                GenericConfigElement ce = new GenericConfigElement(NavigationElementReader.ELEMENT_OVERRIDE);
                ce.addAttribute(NavigationElementReader.ATTR_FROM_VIEWID, fromViewId);
                NavigationResult navRes = this.viewIds.get(fromViewId);
                String result = navRes.getResult();
                if (navRes.isOutcome()) {
                    ce.addAttribute(NavigationElementReader.ATTR_TO_OUTCOME, result);
                } else {
                    ce.addAttribute(NavigationElementReader.ATTR_TO_VIEWID, result);
                }
                // add the element
                this.children.add(ce);
            }
            // create generic config elements for the from-outcome items
            for (String fromOutcome : this.outcomes.keySet()) {
                GenericConfigElement ce = new GenericConfigElement(NavigationElementReader.ELEMENT_OVERRIDE);
                ce.addAttribute(NavigationElementReader.ATTR_FROM_OUTCOME, fromOutcome);
                NavigationResult navRes = this.outcomes.get(fromOutcome);
                String result = navRes.getResult();
                if (navRes.isOutcome()) {
                    ce.addAttribute(NavigationElementReader.ATTR_TO_OUTCOME, result);
                } else {
                    ce.addAttribute(NavigationElementReader.ATTR_TO_VIEWID, result);
                }
                // add the element
                this.children.add(ce);
            }
            this.kidsPopulated = true;
        }
        kids = super.getChildren();
    }
    return kids;
}
Also used : ConfigElement(org.springframework.extensions.config.ConfigElement) GenericConfigElement(org.springframework.extensions.config.element.GenericConfigElement) GenericConfigElement(org.springframework.extensions.config.element.GenericConfigElement)

Aggregations

ConfigElement (org.springframework.extensions.config.ConfigElement)1 GenericConfigElement (org.springframework.extensions.config.element.GenericConfigElement)1