List of usage examples for javax.xml.registry.infomodel Concept getClassificationScheme
ClassificationScheme getClassificationScheme() throws JAXRException;
From source file:it.cnr.icar.eric.client.xml.registry.infomodel.RegistryObjectImpl.java
/** * Internal method to set the objectType */// ww w . java 2 s . c o m @SuppressWarnings("static-access") void setObjectTypeInternal(Concept objectType) throws JAXRException { if (objectType == null) { throw new InvalidRequestException( JAXRResourceBundle.getInstance().getString("message.objectTypeConceptMustNotBeNull")); } if (!objectType.getClassificationScheme().getKey().getId() .equals(bu.CANONICAL_CLASSIFICATION_SCHEME_ID_ObjectType)) { throw new InvalidRequestException( JAXRResourceBundle.getInstance().getString("message.mustBeObjectTypeConcept")); } objectTypeRef = new RegistryObjectRef(lcm, objectType); setModified(true); }
From source file:it.cnr.icar.eric.client.ui.swing.graph.JBGraph.java
/** * DOCUMENT ME!/*from w w w.j av a 2 s . co m*/ * * @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; }
From source file:it.cnr.icar.eric.client.ui.thin.RegistryObjectCollectionBean.java
/** * This method creates a RegistryObject type * dynamically. To add new Related ROB's. * //from ww w . j a va 2 s.co m * @param none * @return String */ public String doAddCurrentComposedROB() { String status = "failure"; try { LifeCycleManagerImpl lcm = RegistryBrowser.getBLCM(); Class<? extends LifeCycleManagerImpl> clazz = lcm.getClass(); String type = getCurrentComposedRegistryObjectType(); String methodName = "createObject"; Method m = null; // Create new composed RO using the LCM; create and store the ROB Class<?> argClass[] = new Class[1]; argClass[0] = type.getClass(); m = clazz.getMethod(methodName, argClass); Object args[] = new Object[1]; args[0] = type; Object ro = m.invoke(lcm, args); if (ro instanceof RegistryObject) { VersionInfoType vit = BindingUtility.getInstance().rimFac.createVersionInfoType(); ((RegistryObjectImpl) ro).setVersionInfo(vit); } RegistryObjectBean rob = null; List<SearchResultValueBean> searchResultValueBeans = new ArrayList<SearchResultValueBean>(4); searchResultValueBeans.add(new SearchResultValueBean("", "")); searchResultValueBeans.add(new SearchResultValueBean("", "")); searchResultValueBeans.add(new SearchResultValueBean("", "")); searchResultValueBeans.add(new SearchResultValueBean("", "")); if (ro instanceof TelephoneNumber) { rob = new RegistryObjectBean(searchResultValueBeans, currentRegistryObject.getRegistryObject(), "TelephoneNumber", (TelephoneNumber) ro, false); } else if (ro instanceof PostalAddress) { rob = new RegistryObjectBean(searchResultValueBeans, currentRegistryObject.getRegistryObject(), "PostalAddress", (PostalAddress) ro, false); } else if (ro instanceof EmailAddress) { rob = new RegistryObjectBean(searchResultValueBeans, currentRegistryObject.getRegistryObject(), "EmailAddress", (EmailAddress) ro, false); } else if (ro instanceof Slot) { List<String> valueList = new ArrayList<String>(); valueList.add(""); ((Slot) ro).setValues(valueList); rob = new RegistryObjectBean(searchResultValueBeans, currentRegistryObject.getRegistryObject(), "Slot", (Slot) ro, false); } else if (ro instanceof Concept) { if (currentRegistryObject.getRegistryObject().getObjectType().getValue() .equalsIgnoreCase("ClassificationScheme")) { ClassificationScheme cs = (ClassificationScheme) currentRegistryObject.getRegistryObject(); ((ConceptImpl) ro).setClassificationScheme(cs); } else { Concept cn = (Concept) currentRegistryObject.getRegistryObject(); ClassificationScheme cs = cn.getClassificationScheme(); if (null != cs) { ((ConceptImpl) ro).setClassificationScheme(cn.getClassificationScheme()); } ((ConceptImpl) ro).setParentConcept(cn); } rob = new RegistryObjectBean(searchResultValueBeans, (RegistryObject) ro); } else if (ro instanceof RegistryObject) { rob = new RegistryObjectBean(searchResultValueBeans, (RegistryObject) ro); } rob.setNew(true); currentComposedRegistryObject = rob; registryObjectLookup.put(rob.getId(), rob); // Return status so JSF runtime can do page navigation status = "showDetailsPage"; } catch (Throwable t) { log.warn(WebUIResourceBundle.getInstance().getString("message.UnableToCreateComposedObject"), t); append(WebUIResourceBundle.getInstance().getString("createCOError") + " " + t.getLocalizedMessage()); } return status; }
From source file:it.cnr.icar.eric.client.ui.thin.RegistryObjectCollectionBean.java
/** * This method return the Status after setting the value in Registry Object * /*from w ww . j ava 2 s.co m*/ * @param none * @return String */ @SuppressWarnings("unused") public String doSetClassSchemeOrNode() { String status = "failure"; String node = null; String classScheme = null; String temp = null; String value = null; ClassificationScheme classificationScheme = null; Concept concept = null; String message = null; try { Collection<?> nodes = SearchPanelBean.getInstance().getClassSchemeSelector().getSelectedNodes(); if (nodes.size() < 1) { append(WebUIResourceBundle.getInstance().getString("selectClassSchemeOrNode")); } else { // Get first selected node // TODO: add attribute to ClassSchemeGraph bean to enforce single // node selection. In this case, user should only be able to // select a single ClassificationNode RegistryObjectNode ron = (RegistryObjectNode) nodes.iterator().next(); RegistryObject registryObject = ron.getRegistryObject(); if (registryObject instanceof ClassificationScheme) { classificationScheme = (ClassificationScheme) registryObject; concept = classificationScheme.getObjectType(); } else { concept = (Concept) registryObject; classificationScheme = concept.getClassificationScheme(); } value = concept.getValue(); RegistryObject ro = getCurrentRegistryObjectBean().getRegistryObject(); if (ro instanceof Classification) { boolean external = classificationScheme.isExternal(); //If the node value is null and the Class scheme in not External //type it will return the control to the error page along //with the message. if (value == null && !external) { append(WebUIResourceBundle.getInstance().getString("selectExternalCSorCN")); status = "showErrorMessage"; return status; } ((Classification) ro).setClassificationScheme(classificationScheme); if (external) { concept = null; ((Classification) ro).setConcept(concept); ((Classification) ro).setValue(null); } else { ((Classification) ro).setConcept(concept); ((Classification) ro).setValue(value); } } if (ro instanceof ExternalIdentifier) { ((ExternalIdentifier) ro).setIdentificationScheme(classificationScheme); if (value != null) { ((ExternalIdentifier) ro).setValue(value); } else { ((ExternalIdentifier) ro).setValue(""); } } if (registryObject instanceof ClassificationScheme) { append(WebUIResourceBundle.getInstance().getString("selectNewCSSuccessful")); } else { append(WebUIResourceBundle.getInstance().getString("selectNewCNSuccessful")); } SearchPanelBean.getInstance().clearClassSchemeSelector(); status = "showMessagePage"; } } catch (Exception ex) { log.error(WebUIResourceBundle.getInstance() .getString("message.ExceptionOccuredWhileSetingClassSchemeOrNode"), ex); append(WebUIResourceBundle.getInstance().getString("errorSettingCSorCN") + " " + ex.getLocalizedMessage()); } return status; }
From source file:org.apache.ws.scout.util.ScoutJaxrUddiHelper.java
public static PublisherAssertion getPubAssertionFromJAXRAssociation(Association association) throws JAXRException { PublisherAssertion pa = objectFactory.createPublisherAssertion(); try {/* w w w.java 2s . com*/ if (association.getSourceObject().getKey() != null && association.getSourceObject().getKey().getId() != null) { pa.setFromKey(association.getSourceObject().getKey().getId()); } if (association.getTargetObject().getKey() != null && association.getTargetObject().getKey().getId() != null) { pa.setToKey(association.getTargetObject().getKey().getId()); } Concept c = association.getAssociationType(); String v = c.getValue(); KeyedReference kr = objectFactory.createKeyedReference(); Key key = c.getKey(); if (key == null) { // TODO:Need to check this. If the concept is a predefined // enumeration, the key can be the parent classification scheme key = c.getClassificationScheme().getKey(); } if (key != null && key.getId() != null) { kr.setTModelKey(key.getId()); } kr.setKeyName("Concept"); if (v != null) { kr.setKeyValue(v); } pa.setKeyedReference(kr); } catch (Exception ud) { throw new JAXRException("Apache JAXR Impl:", ud); } return pa; }
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 . j a va2s . c o 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).//from w w w.j a va2 s . c o 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()); } } } } if (cbag.getKeyedReference().isEmpty()) return null; else return cbag; } catch (Exception ud) { throw new JAXRException("Apache JAXR Impl:", ud); } }