List of usage examples for javax.xml.registry.infomodel RegistryObject getClassifications
Collection getClassifications() throws JAXRException;
From source file:it.cnr.icar.eric.client.ui.swing.graph.JBGraph.java
/** * DOCUMENT ME!/*from w w w . ja va 2s . com*/ * * @param cell DOCUMENT ME! * @param ro DOCUMENT ME! * * @return ArrayList of GraphCell for the related objects. */ private ArrayList<Object> showRelatedObjects(JBGraphCell cell, RegistryObject ro) { ArrayList<Object> relatedCells = new ArrayList<Object>(); if (ro == null) { return relatedCells; } try { CellView cellView = getView().getMapping(cell, false); Rectangle bounds = cellView.getBounds(); //Classifications Collection<?> classifications = ro.getClassifications(); DefaultGraphCell groupCell = createGroupFromObjectCollection(classifications); if (groupCell != null) { connectCells(cell, groupCell, "classifications", false); relatedCells.add(groupCell); } //ExternalIdentifiers Collection<?> extIds = ro.getExternalIdentifiers(); groupCell = createGroupFromObjectCollection(extIds); if (groupCell != null) { connectCells(cell, groupCell, "externalIdentifiers", false); relatedCells.add(groupCell); } //ExternalLinks Collection<?> extLinks = ro.getExternalLinks(); groupCell = createGroupFromObjectCollection(extLinks); if (groupCell != null) { connectCells(cell, groupCell, "externalLinks", false); relatedCells.add(groupCell); } /* //RegistryPackages try { Collection pkgs = ro.getRegistryPackages(); Iterator iter = pkgs.iterator(); while (iter.hasNext()) { RegistryPackage pkg = (RegistryPackage)iter.next(); if (pkg != null) { JBGraphCell newCell = addRelatedObject(cell, pkg, new Rectangle(0, 0, 50, 50), "HasMember", true); relatedCells.add(newCell); } } } catch (UnsupportedCapabilityException e) { } **/ try { //Associations Collection<?> assocs = ((RegistryObjectImpl) ro).getAllAssociations(); Iterator<?> iter = assocs.iterator(); while (iter.hasNext()) { Association assoc = (Association) iter.next(); RegistryObject srcObj = assoc.getSourceObject(); RegistryObject targetObj = assoc.getTargetObject(); Concept concept = assoc.getAssociationType(); String label = "associatedWith"; if (concept != null) { label = concept.getValue(); } if ((srcObj != null) && (targetObj != null)) { JBGraphCell newCell = null; if (srcObj.getKey().getId().equalsIgnoreCase(ro.getKey().getId())) { //ro is the source, newCell is the target newCell = addRelatedObject(cell, targetObj, new Rectangle(bounds.x + 100, bounds.y, 50, 50), label, false); } else { //ro is the target, newCell is the source newCell = addRelatedObject(cell, srcObj, new Rectangle(bounds.x + 100, bounds.y, 50, 50), label, true); } relatedCells.add(newCell); } else { System.err.println( "Invalid association. Source or target is null: " + assoc.getKey().getId()); } } } catch (UnsupportedCapabilityException e) { } } catch (JAXRException e) { RegistryBrowser.displayError(e); } return relatedCells; }