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

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

Introduction

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

Prototype

String getValue() throws JAXRException;

Source Link

Document

Gets the value (usually a code in a taxonomy) associated with this Concept.

Usage

From source file:it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl.java

public String getJAXRClassNameFromObjectType(Concept objectTypeConcept) throws JAXRException {
    String jaxrClassName = null;//from   w w  w . j av a2 s . co  m

    String conceptValue = objectTypeConcept.getValue();
    if (isIntrinsicObjectType(objectTypeConcept)) {
        jaxrClassName = BindingUtility.mapEbXMLNameToJAXRName(conceptValue);
    } else {
        jaxrClassName = "ExtrinsicObject";
    }

    return jaxrClassName;
}

From source file:it.cnr.icar.eric.client.ui.thin.RegistryObjectCollectionBean.java

public List<SelectItem> getAssociationTypes() throws JAXRException {
    ArrayList<SelectItem> list = new ArrayList<SelectItem>();
    Collection<?> concepts = ((BusinessQueryManagerImpl) UIUtility.getInstance().getBusinessQueryManager())
            .findConceptsByPath(//from ww  w  . j  ava2  s  . co m
                    "/" + BindingUtility.CANONICAL_CLASSIFICATION_SCHEME_LID_AssociationType + "/%");
    Iterator<?> conceptsItr = concepts.iterator();
    while (conceptsItr.hasNext()) {
        Concept concept = (Concept) conceptsItr.next();
        list.add(new SelectItem(concept.getKey().getId(), concept.getValue()));
    }
    return list;
}

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  w w. java2 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 {//from  w  w  w.  jav  a  2 s.  c o m
        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   w  w w .  j a v  a  2s.  com*/
  * 
  * 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 .  ja  v a 2  s  . 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());
                    }
                }
            }
        }
        if (cbag.getKeyedReference().isEmpty())
            return null;
        else
            return cbag;
    } catch (Exception ud) {
        throw new JAXRException("Apache JAXR Impl:", ud);
    }
}