Example usage for javax.xml.registry.infomodel Concept getChildConceptCount

List of usage examples for javax.xml.registry.infomodel Concept getChildConceptCount

Introduction

In this page you can find the example usage for javax.xml.registry.infomodel Concept getChildConceptCount.

Prototype

int getChildConceptCount() throws JAXRException;

Source Link

Document

Gets number of children.

Usage

From source file:it.cnr.icar.eric.client.ui.thin.components.model.RegistryObjectNode.java

public String getLabel() {
    String label = null;/*from  ww w.j  a  v a  2s  .c o  m*/
    try {
        label = ((InternationalStringImpl) ro.getName())
                .getClosestValue(FacesContext.getCurrentInstance().getViewRoot().getLocale());
        if (label == null && ro instanceof Concept) {
            label = ((Concept) ro).getValue();
        }
        if (label == null) {
            label = WebUIResourceBundle.getInstance().getString("message.noName", "No Name");
            StringBuffer sb = new StringBuffer("(");
            sb.append(label).append(')');
            label = sb.toString();
        }
        if (ro instanceof ClassificationScheme || ro instanceof Concept) {
            StringBuffer sb = new StringBuffer(label);
            if (ro instanceof ClassificationScheme) {
                ClassificationScheme scheme = (ClassificationScheme) ro;
                sb.append(" (").append(scheme.getChildConceptCount()).append(')');
            } else {
                Concept concept = (Concept) ro;
                sb.append(" (").append(concept.getChildConceptCount()).append(')');
            }
            label = sb.toString();
        }
    } catch (JAXRException ex) {
        log.error(ex);
    }
    return label;
}

From source file:it.cnr.icar.eric.client.xml.registry.infomodel.ClassificationSchemeImpl.java

@SuppressWarnings("unchecked")
public Collection<Concept> getDescendantConcepts() throws JAXRException {
    getChildrenConcepts();//from ww  w .  j  av a2  s.  c  o m
    ArrayList<Concept> descendants = new ArrayList<Concept>(children);
    Iterator<Concept> iter = children.iterator();

    while (iter.hasNext()) {
        Concept child = iter.next();

        if (child.getChildConceptCount() > 0) {
            descendants.addAll(child.getDescendantConcepts());
        }
    }

    return descendants;
}

From source file:it.cnr.icar.eric.client.ui.thin.jsf.ClassSchemeGraphBean.java

public void loadChildNodesFromConcepts(RegistryObjectNode parentNode, boolean isFirstLevel)
        throws JAXRException {
    RegistryObject ro = parentNode.getRegistryObject();
    if (ro == null) {
        return; // is this a valid case?
    }//from  ww w.  j  a  v  a  2 s.com
    Iterator<?> itr = null;
    if (ro instanceof ClassificationScheme) {
        itr = ((ClassificationScheme) ro).getChildrenConcepts().iterator();
    } else if (ro instanceof Concept) {
        itr = ((Concept) ro).getChildrenConcepts().iterator();
    } else {
        log.error("Expected object: ClassificationScheme or Node");
        return;
    }
    Node node = null;
    parentNode.clearChildren();
    if (this.treeType != null && this.treeType.equals("ExtrinsicObject")
            && !parentNode.getId().endsWith(CanonicalSchemes.CANONICAL_CLASSIFICATION_SCHEME_ID_ObjectType)) {
        parentNode.addChild(loadExtrinsicChildNodeFromConcept(itr));
    } else {
        while (itr.hasNext()) {
            Concept concept = (Concept) itr.next();
            node = new RegistryObjectNode(concept);
            parentNode.addChild(node);
            int numChildren = concept.getChildConceptCount();
            node.setHasChild(numChildren > 0);
        }
    }
    parentNode.sortChildren();
}

From source file:it.cnr.icar.eric.client.ui.thin.jsf.ClassSchemeGraphBean.java

public Node loadExtrinsicChildNodeFromConcept(Iterator<?> itr) throws JAXRException {
    Node node1 = null;//  www.ja  va 2 s . c om
    while (itr.hasNext()) {
        Concept concept = (Concept) itr.next();
        Node node = new RegistryObjectNode(concept);
        if (node.getId().endsWith(CanonicalSchemes.CANONICAL_OBJECT_TYPE_ID_ExtrinsicObject)) {
            node.setHasChild(concept.getChildConceptCount() > 0);
            node1 = node;
            this.treeType = "completed";
        }
    }
    return node1;
}

From source file:it.cnr.icar.eric.client.ui.thin.jsf.ExplorerGraphBean.java

private void loadRegistryObjectChildNodes(RegistryObjectNode parentNode) throws JAXRException {
    Concept concept = parentNode.getRegistryObjectType();
    Iterator<?> itr = concept.getChildrenConcepts().iterator();
    RegistryObjectNode roNode = null;/*from   w  w w. j av  a 2 s. c om*/
    if (itr.hasNext()) {
        parentNode.clearChildren();
        RegistryPackage rOCPkg = null;
        while (itr.hasNext()) {
            Concept childConcept = (Concept) itr.next();
            try {
                rOCPkg = RegistryBrowser.getBLCM().createRegistryPackage(childConcept.getValue());
            } catch (Exception ex) {
                throw new JAXRException(ex);
            }
            roNode = new RegistryObjectNode(rOCPkg, childConcept);
            parentNode.addChild(roNode);
            roNode.setHasChild(childConcept.getChildConceptCount() > 0);
        }
        if (roNode != null) {
            roNode.setLast(true);
        }
    }
}

From source file:it.cnr.icar.eric.client.ui.thin.components.components.QueryPanelComponent.java

public void loadTypes(Collection<RegistryObject> concepts, List<SelectItem> types, String indent) {
    Iterator<RegistryObject> itr = concepts.iterator();
    while (itr.hasNext()) {
        Concept concept = (Concept) itr.next();
        SelectItem item = loadConceptItem(concept, indent);
        if (item != null) {
            types.add(item);/*  w  w w . ja v a 2s .co  m*/
        }
        try {
            if (concept.getChildConceptCount() > 0) {
                Collection<RegistryObject> childConcepts = sortChildConceptsByName(
                        concept.getChildrenConcepts());
                loadTypes(childConcepts, types, indent + "...");
            }
        } catch (JAXRException ex) {
            log.error(WebUIResourceBundle.getInstance().getString("message.ErrorLoadingObjectTypeChildConcept"),
                    ex);
        }
    }
}