Example usage for javax.xml.registry.infomodel ClassificationScheme getKey

List of usage examples for javax.xml.registry.infomodel ClassificationScheme getKey

Introduction

In this page you can find the example usage for javax.xml.registry.infomodel ClassificationScheme getKey.

Prototype

Key getKey() throws JAXRException;

Source Link

Document

Gets the key representing the universally unique ID (UUID) for this object.

Usage

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

/**
 * Determines whether to hide this scheme based upon user configuration.
 *//*from  w  w w .jav  a2  s  .  com*/
private boolean hideScheme(ClassificationScheme scheme) {
    boolean hide = false;

    try {
        String id = scheme.getKey().getId();

        if (getHiddenSchemes().contains(id)) {
            hide = true;
        }
    } catch (JAXRException e) {
        RegistryBrowser.displayError(e);
    }

    return hide;
}

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

public void setClassificationScheme(ClassificationScheme c) throws JAXRException {
    if ((parentRef == null) || (!(parentRef.getId().equals(c.getKey().getId())))) {
        parentRef = new RegistryObjectRef(lcm, c);
        schemeRef = parentRef;//from  w  w  w  . j  a  v  a  2s .  co  m

        c.addChildConcept(this);

        setModified(true);
    }
}

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

private Collection<ClassificationScheme> filterHiddenSchemes(Collection<ClassificationScheme> classSchemes)
        throws JAXRException {
    Collection<ClassificationScheme> filteredSchemes = null;
    String hiddenSchemesProp = "jaxr-ebxml.registryBrowser.ConceptsTreeModel.hiddenSchemesList";
    String hiddenSchemesStr = ProviderProperties.getInstance().getProperty(hiddenSchemesProp);
    if (hiddenSchemesStr == null) {
        filteredSchemes = classSchemes;/*from  w w w  . j av a 2  s  .  co  m*/
    } else {
        String[] tokens = hiddenSchemesStr.split("\\|");
        if (tokens.length > 0) {
            filteredSchemes = new ArrayList<ClassificationScheme>(classSchemes);
            for (int i = 0; i < tokens.length; i++) {
                String csIdToFilter = tokens[i];
                Iterator<?> itr = classSchemes.iterator();
                while (itr.hasNext()) {
                    ClassificationScheme cs = (ClassificationScheme) itr.next();
                    String csId = cs.getKey().getId();
                    if (csIdToFilter.equalsIgnoreCase(csId)) {
                        filteredSchemes.remove(cs);
                    }
                }
            }
        }
    }
    return filteredSchemes;
}

From source file:org.apache.ws.scout.util.ScoutJaxrUddiHelper.java

public static TModel getTModelFromJAXRClassificationScheme(ClassificationScheme classificationScheme)
        throws JAXRException {
    TModel tm = objectFactory.createTModel();
    try {/*from  w w w  .  j  a  v  a  2  s .co  m*/
        /*
         * a fresh scheme might not have a key
         */

        Key k = classificationScheme.getKey();

        if (k != null && k.getId() != null) {
            tm.setTModelKey(k.getId());
        } else {
            tm.setTModelKey("");
        }

        /*
         * There's no reason to believe these are here either
         */

        Slot s = classificationScheme.getSlot("authorizedName");

        if (s != null && s.getName() != null) {
            tm.setAuthorizedName(s.getName());
        }

        s = classificationScheme.getSlot("operator");

        if (s != null && s.getName() != null) {
            tm.setOperator(s.getName());
        }

        InternationalString iname = classificationScheme.getName();

        tm.setName(getFirstName(iname));

        InternationalString idesc = classificationScheme.getDescription();

        addDescriptions(tm.getDescription(), idesc);

        IdentifierBag idBag = getIdentifierBagFromExternalIdentifiers(
                classificationScheme.getExternalIdentifiers());
        if (idBag != null) {
            tm.setIdentifierBag(idBag);
        }
        CategoryBag catBag = getCategoryBagFromClassifications(classificationScheme.getClassifications());
        if (catBag != null) {
            tm.setCategoryBag(catBag);
        }

        // ToDO: overviewDoc
    } catch (Exception ud) {
        throw new JAXRException("Apache JAXR Impl:", ud);
    }
    return tm;
}

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 ww  .j  ava2  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());
                    }
                }
            }
        }
        return cbag;
    } catch (Exception ud) {
        throw new JAXRException("Apache JAXR Impl:", ud);
    }
}

From source file:org.apache.ws.scout.util.ScoutJaxrUddiHelper.java

/**
  * Adds the objects identifiers from JAXR's external identifier collection
  * //from  w  w  w  .j  a v  a 2s.  c o  m
  * @param identifiers external identifiers to turn into identifiers
  * @throws JAXRException
  */
public static IdentifierBag getIdentifierBagFromExternalIdentifiers(Collection identifiers)
        throws JAXRException {
    try {
        if (identifiers == null || identifiers.size() == 0)
            return null;

        // Identifiers
        IdentifierBag ibag = objectFactory.createIdentifierBag();
        Iterator iditer = identifiers.iterator();
        while (iditer.hasNext()) {
            ExternalIdentifier extid = (ExternalIdentifier) iditer.next();
            if (extid != null) {
                KeyedReference keyr = objectFactory.createKeyedReference();
                ibag.getKeyedReference().add(keyr);

                InternationalStringImpl iname = (InternationalStringImpl) ((RegistryObject) extid).getName();
                String value = extid.getValue();
                ClassificationScheme scheme = extid.getIdentificationScheme();

                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 ibag;
    } catch (Exception ud) {
        throw new JAXRException("Apache JAXR Impl:", ud);
    }
}

From source file:org.apache.ws.scout.util.ScoutJaxrUddiV3Helper.java

public static TModel getTModelFromJAXRClassificationScheme(ClassificationScheme classificationScheme)
        throws JAXRException {
    TModel tm = objectFactory.createTModel();
    try {/*from  w w w. j  a v a  2  s.  co  m*/
        /*
         * a fresh scheme might not have a key
         */

        Key k = classificationScheme.getKey();

        if (k != null && k.getId() != null) {
            tm.setTModelKey(k.getId());
        } else {
            tm.setTModelKey("");
        }

        /*
         * There's no reason to believe these are here either
         */

        Slot s = classificationScheme.getSlot("authorizedName");
        /*
                 if (s != null && s.getName() != null) {
        tm.setAuthorizedName(s.getName());
                    }
        */
        s = classificationScheme.getSlot("operator");
        /*
                 if (s != null && s.getName() != null) {
        tm.setOperator(s.getName());
                    }
        */
        InternationalString iname = classificationScheme.getName();

        tm.setName(getFirstName(iname));

        InternationalString idesc = classificationScheme.getDescription();

        addDescriptions(tm.getDescription(), idesc);

        IdentifierBag idBag = getIdentifierBagFromExternalIdentifiers(
                classificationScheme.getExternalIdentifiers());
        if (idBag != null) {
            tm.setIdentifierBag(idBag);
        }
        CategoryBag catBag = getCategoryBagFromClassifications(classificationScheme.getClassifications());
        if (catBag != null) {
            tm.setCategoryBag(catBag);
        }

        // ToDO: overviewDoc
    } catch (Exception ud) {
        throw new JAXRException("Apache JAXR Impl:", ud);
    }
    return tm;
}

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 .j  a 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);
    }
}