Example usage for javax.xml.registry.infomodel Organization getParentOrganization

List of usage examples for javax.xml.registry.infomodel Organization getParentOrganization

Introduction

In this page you can find the example usage for javax.xml.registry.infomodel Organization getParentOrganization.

Prototype

Organization getParentOrganization() throws JAXRException;

Source Link

Document

Gets the parent (container) organization.

Usage

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

/**
 * DOCUMENT ME!//from  ww  w  . j av a 2s.  c o m
 *
 * @param cell DOCUMENT ME!
 * @param org DOCUMENT ME!
 *
 * @return DOCUMENT ME!
 */
private ArrayList<DefaultGraphCell> showRelatedObjects(JBGraphCell cell, Organization org) {
    ArrayList<DefaultGraphCell> relatedCells = new ArrayList<DefaultGraphCell>();

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

    try {
        //services
        Collection<?> services = org.getServices();
        DefaultGraphCell groupCell = createGroupFromObjectCollection(services);

        if (groupCell != null) {
            connectCells(cell, groupCell, "services", false);
            relatedCells.add(groupCell);
        }

        //parent Organization
        try {
            Organization parentOrg = org.getParentOrganization();

            if (parentOrg != null) {
                JBGraphCell newCell = addRelatedObject(cell, parentOrg, new Rectangle(0, 0, 50, 50),
                        "parent Organization", false);
                relatedCells.add(newCell);
            }
        } catch (UnsupportedCapabilityException e) {
        }

        //children Organizations
        try {
            Collection<?> children = org.getChildOrganizations();
            groupCell = createGroupFromObjectCollection(children);

            if (groupCell != null) {
                connectCells(cell, groupCell, "parent Organization", true);
                relatedCells.add(groupCell);
            }
        } catch (UnsupportedCapabilityException e) {
        }

        //users
        Collection<?> users = org.getUsers();
        groupCell = createGroupFromObjectCollection(users);

        if (groupCell != null) {
            connectCells(cell, groupCell, "users", false);
            relatedCells.add(groupCell);
        }

        //Primary contact

        /*
           User primContact = org.getPrimaryContact();
           JBGraphCell primContactCell = (JBGraphCell)registryObjectToCellMap.get(primContact);
           if (primContactCell != null) {
               connectCells(cell, primContactCell, "primary contact", false);
               relatedCells.add(primContactCell);
           }
         */
    } catch (JAXRException e) {
        RegistryBrowser.displayError(e);
    }

    return relatedCells;
}