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

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

Introduction

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

Prototype

Concept getParentConcept() throws JAXRException;

Source Link

Document

Gets the parent Concept or null if parent is a ClassificationScheme.

Usage

From source file:it.cnr.icar.eric.client.ui.common.UIUtility.java

public ObjectTypeConfigType getObjectTypeConfig(Concept commonObjectType) throws JAXRException {
    ObjectTypeConfigType uiObjectTypeConfigType = null;

    while (true) {
        if (commonObjectType == null) {
            //This could happen if there is some problem with access control on the server and the ObjectType node for RegistryObject is not returned.
            //Use RegistryObject as default objectType
            uiObjectTypeConfigType = objectTypeToConfigMap
                    .get(BindingUtility.CANONICAL_OBJECT_TYPE_ID_RegistryObject);
        } else {//from w  w  w.  j ava2  s.c o m
            //Now get the ObjectTypeConfig for the commonObjectType
            uiObjectTypeConfigType = objectTypeToConfigMap.get(commonObjectType.getKey().getId());
        }

        if (uiObjectTypeConfigType != null) {
            break;
        } else {
            Concept parent = commonObjectType.getParentConcept();

            if (parent == null) {
                //Use RegistryObject (id BindingUtility.CANONICAL_OBJECT_TYPE_ID_RegistryObject) as default objectType
                uiObjectTypeConfigType = objectTypeToConfigMap
                        .get(BindingUtility.CANONICAL_OBJECT_TYPE_ID_RegistryObject);

                break;
            } else {
                commonObjectType = parent;
            }
        }
    }
    return uiObjectTypeConfigType;
}

From source file:it.cnr.icar.eric.client.ui.swing.graph.JBGraph.java

/**
 * DOCUMENT ME!/*from  ww  w  .  j  av a2 s  .  com*/
 *
 * @param cell DOCUMENT ME!
 * @param concept DOCUMENT ME!
 *
 * @return DOCUMENT ME!
 */
private ArrayList<DefaultGraphCell> showRelatedObjects(JBGraphCell cell, Concept concept) {
    ArrayList<DefaultGraphCell> relatedCells = new ArrayList<DefaultGraphCell>();

    if (concept == null) {
        return relatedCells;
    }

    try {
        //parent Organization
        Concept parentConcept = concept.getParentConcept();

        if (parentConcept != null) {
            JBGraphCell newCell = addRelatedObject(cell, parentConcept, new Rectangle(0, 0, 50, 50), "parent",
                    false);
            relatedCells.add(newCell);
        } else {
            ClassificationScheme scheme = concept.getClassificationScheme();

            if (scheme != null) {
                JBGraphCell newCell = addRelatedObject(cell, scheme, new Rectangle(0, 0, 50, 50),
                        "classification scheme", false);
                relatedCells.add(newCell);
            }
        }

        //child Concepts
        Collection<?> childConcepts = concept.getChildrenConcepts();
        DefaultGraphCell groupCell = createGroupFromObjectCollection(childConcepts);

        if (groupCell != null) {
            connectCells(cell, groupCell, "child Concepts", false);
            relatedCells.add(groupCell);
        }
    } catch (JAXRException e) {
        RegistryBrowser.displayError(e);
    }

    return relatedCells;
}