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

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

Introduction

In this page you can find the example usage for javax.xml.registry.infomodel Concept 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:org.apache.ws.scout.registry.BusinessQueryManagerV3Impl.java

public RegistryObject getRegistryObject(String id, String objectType) throws JAXRException {
    IRegistryV3 registry = (IRegistryV3) registryService.getRegistry();
    BusinessLifeCycleManager lcm = registryService.getBusinessLifeCycleManager();

    if (LifeCycleManager.CLASSIFICATION_SCHEME.equalsIgnoreCase(objectType)) {

        try {//from   w w w .  j  a  v  a 2 s  .com

            TModelDetail tmodeldetail = registry.getTModelDetail(id);
            Concept c = ScoutUddiV3JaxrHelper.getConcept(tmodeldetail, lcm);

            /*
             * now turn into a concrete ClassificationScheme
             */

            ClassificationScheme scheme = new ClassificationSchemeImpl(lcm);

            scheme.setName(c.getName());
            scheme.setDescription(c.getDescription());
            scheme.setKey(c.getKey());

            return scheme;
        } catch (RegistryV3Exception e) {
            throw new JAXRException(e.getLocalizedMessage());
        }
    } else if (LifeCycleManager.ORGANIZATION.equalsIgnoreCase(objectType)) {
        try {
            BusinessDetail orgdetail = registry.getBusinessDetail(id);
            return ScoutUddiV3JaxrHelper.getOrganization(orgdetail, lcm);
        } catch (RegistryV3Exception e) {
            throw new JAXRException(e.getLocalizedMessage());
        }

    } else if (LifeCycleManager.CONCEPT.equalsIgnoreCase(objectType)) {

        try {
            TModelDetail tmodeldetail = registry.getTModelDetail(id);
            return ScoutUddiV3JaxrHelper.getConcept(tmodeldetail, lcm);
        } catch (RegistryV3Exception e) {
            throw new JAXRException(e.getLocalizedMessage());
        }
    } else if (LifeCycleManager.SERVICE.equalsIgnoreCase(objectType)) {

        try {
            ServiceDetail sd = registry.getServiceDetail(id);
            if (sd != null && sd.getBusinessService() != null) {
                for (BusinessService businessService : sd.getBusinessService()) {
                    Service service = getServiceFromBusinessService(businessService, lcm);
                    return service;
                }
            }
        } catch (RegistryV3Exception e) {
            throw new RuntimeException(e);
        }
    }

    return null;
}

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  ww  .ja v  a 2 s .c om
        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

public static TModel getTModelFromJAXRConcept(Concept concept) throws JAXRException {
    TModel tm = objectFactory.createTModel();
    if (concept == null)
        return null;
    try {/*  w  w w.  j a v  a  2 s . com*/
        Key key = concept.getKey();
        if (key != null && key.getId() != null)
            tm.setTModelKey(key.getId());
        Slot sl1 = concept.getSlot("authorizedName");
        if (sl1 != null && sl1.getName() != null)
            tm.setAuthorizedName(sl1.getName());

        Slot sl2 = concept.getSlot("operator");
        if (sl2 != null && sl2.getName() != null)
            tm.setOperator(sl2.getName());

        InternationalString iname = concept.getName();

        tm.setName(getFirstName(iname));

        InternationalString idesc = concept.getDescription();

        addDescriptions(tm.getDescription(), idesc);

        //          External Links
        Collection<ExternalLink> externalLinks = concept.getExternalLinks();
        if (externalLinks != null && externalLinks.size() > 0) {
            tm.setOverviewDoc(getOverviewDocFromExternalLink((ExternalLink) externalLinks.iterator().next()));
        }

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

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

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

public static TModelBag getTModelBagFromSpecifications(Collection specifications) throws JAXRException {
    try {// w  w  w .  ja va  2 s .c  o  m
        if (specifications == null || specifications.size() == 0)
            return null;

        // Classifications
        TModelBag tbag = objectFactory.createTModelBag();
        Iterator speciter = specifications.iterator();
        while (speciter.hasNext()) {
            RegistryObject registryobject = (RegistryObject) speciter.next();
            if (registryobject instanceof Concept) {
                Concept concept = (Concept) registryobject;
                if (concept.getKey() != null) {
                    tbag.getTModelKey().add(concept.getKey().toString());
                }
                //            if (registryobject instanceof SpecificationLink) {
                //               SpecificationLink specificationlink = (SpecificationLink) registryobject;
                //               if (specificationlink.getSpecificationObject() != null) {
                //                  RegistryObject ro = specificationlink.getSpecificationObject();
                //                  if (ro.getKey() != null) {
                //                     Key key = ro.getKey();
                //                     tbag.getTModelKey().add(key.toString());
                //                  }
                //               }
            } else {
                log.info("ebXML case - the RegistryObject is an ExtrinsicObject, Not implemented");
            }
        }
        return tbag;
    } catch (Exception ud) {
        throw new JAXRException("Apache JAXR Impl:", ud);
    }
}

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

public static TModel getTModelFromJAXRConcept(Concept concept) throws JAXRException {
    TModel tm = objectFactory.createTModel();
    if (concept == null)
        return null;
    try {//from  ww w  .  ja v  a 2s .  c om
        Key key = concept.getKey();
        if (key != null && key.getId() != null)
            tm.setTModelKey(key.getId());
        Slot sl1 = concept.getSlot("authorizedName");
        /*
        if (sl1 != null && sl1.getName() != null)
        tm.setAuthorizedName(sl1.getName());
                
        Slot sl2 = concept.getSlot("operator");
        if (sl2 != null && sl2.getName() != null)
        tm.setOperator(sl2.getName());
        */
        InternationalString iname = concept.getName();

        tm.setName(getFirstName(iname));

        InternationalString idesc = concept.getDescription();

        addDescriptions(tm.getDescription(), idesc);

        //          External Links
        Collection<ExternalLink> externalLinks = concept.getExternalLinks();
        if (externalLinks != null && externalLinks.size() > 0) {
            tm.getOverviewDoc()
                    .add(getOverviewDocFromExternalLink((ExternalLink) externalLinks.iterator().next()));
        }

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

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

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

public static TModelBag getTModelBagFromSpecifications(Collection specifications) throws JAXRException {
    try {//from www .j  a  v  a2s .  co m
        if (specifications == null || specifications.size() == 0)
            return null;

        // Classifications
        TModelBag tbag = objectFactory.createTModelBag();
        Iterator speciter = specifications.iterator();
        while (speciter.hasNext()) {
            RegistryObject registryobject = (RegistryObject) speciter.next();
            if (registryobject instanceof Concept) {
                Concept concept = (Concept) registryobject;
                if (concept.getKey() != null) {
                    tbag.getTModelKey().add(concept.getKey().toString());
                }
                //               SpecificationLink specificationlink = (SpecificationLink) registryobject;
                //               if (specificationlink.getSpecificationObject() != null) {
                //                  RegistryObject ro = specificationlink.getSpecificationObject();
                //                  if (ro.getKey() != null) {
                //                     Key key = ro.getKey();
                //                     tbag.getTModelKey().add(key.toString());
                //                  }
                //               }
            } else {
                log.info("ebXML case - the RegistryObject is an ExtrinsicObject, Not implemented");
            }
        }
        if (tbag.getTModelKey().isEmpty())
            return null;
        else
            return tbag;
    } catch (Exception ud) {
        throw new JAXRException("Apache JAXR Impl:", ud);
    }
}