List of usage examples for javax.xml.registry.infomodel Classification getConcept
Concept getConcept() throws JAXRException;
From source file:it.cnr.icar.eric.client.xml.registry.BusinessQueryManagerImpl.java
@SuppressWarnings("unused") static private String classificationToConceptId(Object obj) throws JAXRException { if (!(obj instanceof Classification)) { throw new UnexpectedObjectException(JAXRResourceBundle.getInstance() .getString("message.error.expected.collection.objectType.Classification")); }/*from w w w .java 2s . c om*/ Classification cl = (Classification) obj; if (cl.isExternal()) { throw new JAXRException(JAXRResourceBundle.getInstance() .getString("message.error.no.support.external.classification.qaulifier")); } Concept concept = cl.getConcept(); if (concept == null) { throw new JAXRException(JAXRResourceBundle.getInstance() .getString("message.error.internal.classification.concept.null")); } return concept.getKey().getId(); }
From source file:it.cnr.icar.eric.client.xml.registry.infomodel.RegistryObjectImpl.java
/** * Gets all Concepts classifying this object that have specified path as prefix. * Used in RegistryObjectsTableModel.getValueAt via reflections API if so configured. *//*from w ww . j av a2s. co m*/ public Collection<Concept> getClassificationConceptsByPath(String pathPrefix) throws JAXRException { Collection<Concept> matchingClassificationConcepts = new ArrayList<Concept>(); ArrayList<RegistryObject> _classifications = getClassifications(); Iterator<RegistryObject> iter = _classifications.iterator(); while (iter.hasNext()) { Classification cl = (Classification) iter.next(); Concept concept = cl.getConcept(); String conceptPath = concept.getPath(); if (conceptPath.startsWith(pathPrefix)) { matchingClassificationConcepts.add(concept); } } return matchingClassificationConcepts; }
From source file:it.cnr.icar.eric.client.ui.swing.graph.JBGraph.java
/** * DOCUMENT ME!/*from w ww .ja v a 2 s . c o m*/ * * @param cell DOCUMENT ME! * @param classification DOCUMENT ME! * * @return DOCUMENT ME! */ private ArrayList<DefaultGraphCell> showRelatedObjects(JBGraphCell cell, Classification classification) { ArrayList<DefaultGraphCell> relatedCells = new ArrayList<DefaultGraphCell>(); if (classification == null) { return relatedCells; } try { //scheme ClassificationScheme scheme = classification.getClassificationScheme(); JBGraphCell newCell = addRelatedObject(cell, scheme, new Rectangle(0, 0, 50, 50), "classification scheme", false); relatedCells.add(newCell); //Concept Concept concept = classification.getConcept(); if (concept != null) { newCell = addRelatedObject(cell, concept, new Rectangle(0, 0, 50, 50), "value", false); relatedCells.add(newCell); } } catch (JAXRException e) { RegistryBrowser.displayError(e); } return relatedCells; }
From source file:org.apache.ws.scout.util.ScoutJaxrUddiHelper.java
/** * According to JAXR Javadoc, there are two types of classification, internal and external and they use the Classification, Concept, * and ClassificationScheme objects. It seems the only difference between internal and external (as related to UDDI) is that the * name/value pair of the categorization is held in the Concept for internal classifications and the Classification for external (bypassing * the Concept entirely).//from ww w. ja va 2s .co m * * The translation to UDDI is simple. Relevant objects have a category bag which contains a bunch of KeyedReferences (name/value pairs). * These KeyedReferences optionally refer to a tModel that identifies the type of category (translates to the ClassificationScheme key). If * this is set and the tModel doesn't exist in the UDDI registry, then an invalid key error will occur when trying to save the object. * * @param classifications classifications to turn into categories * @throws JAXRException */ public static CategoryBag getCategoryBagFromClassifications(Collection classifications) throws JAXRException { try { if (classifications == null || classifications.size() == 0) return null; // Classifications CategoryBag cbag = objectFactory.createCategoryBag(); Iterator classiter = classifications.iterator(); while (classiter.hasNext()) { Classification classification = (Classification) classiter.next(); if (classification != null) { KeyedReference keyr = objectFactory.createKeyedReference(); cbag.getKeyedReference().add(keyr); InternationalStringImpl iname = null; String value = null; ClassificationScheme scheme = classification.getClassificationScheme(); if (scheme == null || (classification.isExternal() && classification.getConcept() == null)) { /* * JAXR 1.0 Specification: Section D6.4.4 * Specification related tModels mapped from Concept may be automatically * categorized by the well-known uddi-org:types taxonomy in UDDI (with * tModelKey uuid:C1ACF26D-9672-4404-9D70-39B756E62AB4) as follows: * The keyed reference is assigned a taxonomy value of specification. */ keyr.setTModelKey(UDDI_ORG_TYPES); keyr.setKeyValue("specification"); } else { if (classification.isExternal()) { iname = (InternationalStringImpl) ((RegistryObject) classification).getName(); value = classification.getValue(); } else { Concept concept = classification.getConcept(); if (concept != null) { iname = (InternationalStringImpl) ((RegistryObject) concept).getName(); value = concept.getValue(); scheme = concept.getClassificationScheme(); } } String name = iname.getValue(); if (name != null) keyr.setKeyName(name); if (value != null) keyr.setKeyValue(value); if (scheme != null) { Key key = scheme.getKey(); if (key != null && key.getId() != null) keyr.setTModelKey(key.getId()); } } } } return cbag; } catch (Exception ud) { throw new JAXRException("Apache JAXR Impl:", ud); } }
From source file:org.apache.ws.scout.util.ScoutJaxrUddiV3Helper.java
/** * According to JAXR Javadoc, there are two types of classification, internal and external and they use the Classification, Concept, * and ClassificationScheme objects. It seems the only difference between internal and external (as related to UDDI) is that the * name/value pair of the categorization is held in the Concept for internal classifications and the Classification for external (bypassing * the Concept entirely).// w w w . jav a2 s . c om * * The translation to UDDI is simple. Relevant objects have a category bag which contains a bunch of KeyedReferences (name/value pairs). * These KeyedReferences optionally refer to a tModel that identifies the type of category (translates to the ClassificationScheme key). If * this is set and the tModel doesn't exist in the UDDI registry, then an invalid key error will occur when trying to save the object. * * @param classifications classifications to turn into categories * @throws JAXRException */ public static CategoryBag getCategoryBagFromClassifications(Collection classifications) throws JAXRException { try { if (classifications == null || classifications.size() == 0) return null; // Classifications CategoryBag cbag = objectFactory.createCategoryBag(); Iterator classiter = classifications.iterator(); while (classiter.hasNext()) { Classification classification = (Classification) classiter.next(); if (classification != null) { KeyedReference keyr = objectFactory.createKeyedReference(); cbag.getKeyedReference().add(keyr); InternationalStringImpl iname = null; String value = null; ClassificationScheme scheme = classification.getClassificationScheme(); if (scheme == null || (classification.isExternal() && classification.getConcept() == null)) { /* * JAXR 1.0 Specification: Section D6.4.4 * Specification related tModels mapped from Concept may be automatically * categorized by the well-known uddi-org:types taxonomy in UDDI (with * tModelKey uuid:C1ACF26D-9672-4404-9D70-39B756E62AB4) as follows: * The keyed reference is assigned a taxonomy value of specification. */ keyr.setTModelKey(UDDI_ORG_TYPES); keyr.setKeyValue("specification"); } else { if (classification.isExternal()) { iname = (InternationalStringImpl) ((RegistryObject) classification).getName(); value = classification.getValue(); } else { Concept concept = classification.getConcept(); if (concept != null) { iname = (InternationalStringImpl) ((RegistryObject) concept).getName(); value = concept.getValue(); scheme = concept.getClassificationScheme(); } } String name = iname.getValue(); if (name != null) keyr.setKeyName(name); if (value != null) keyr.setKeyValue(value); if (scheme != null) { Key key = scheme.getKey(); if (key != null && key.getId() != null) keyr.setTModelKey(key.getId()); } } } } if (cbag.getKeyedReference().isEmpty()) return null; else return cbag; } catch (Exception ud) { throw new JAXRException("Apache JAXR Impl:", ud); } }