Example usage for javax.xml.registry.infomodel ExternalLink getDescription

List of usage examples for javax.xml.registry.infomodel ExternalLink getDescription

Introduction

In this page you can find the example usage for javax.xml.registry.infomodel ExternalLink getDescription.

Prototype

InternationalString getDescription() throws JAXRException;

Source Link

Document

Gets the textual description for this object.

Usage

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

public static BindingTemplate getBindingTemplateFromJAXRSB(ServiceBinding serviceBinding) throws JAXRException {
    BindingTemplate bt = objectFactory.createBindingTemplate();
    if (serviceBinding.getKey() != null && serviceBinding.getKey().getId() != null) {
        bt.setBindingKey(serviceBinding.getKey().getId());
    } else {//from  ww w . j a v  a  2 s . c  o  m
        bt.setBindingKey("");
    }

    try {
        // Set Access URI
        String accessuri = serviceBinding.getAccessURI();
        if (accessuri != null) {
            AccessPoint accessPoint = objectFactory.createAccessPoint();
            accessPoint.setURLType(getURLType(accessuri));
            accessPoint.setValue(accessuri);
            bt.setAccessPoint(accessPoint);
        }
        ServiceBinding sb = serviceBinding.getTargetBinding();
        if (sb != null) {
            HostingRedirector red = objectFactory.createHostingRedirector();
            Key key = sb.getKey();
            if (key != null && key.getId() != null) {
                red.setBindingKey(key.getId());
            } else {
                red.setBindingKey("");
            }
            bt.setHostingRedirector(red);
        } else {
            if (bt.getAccessPoint() == null) {
                bt.setAccessPoint(objectFactory.createAccessPoint());
            }
        }
        // TODO:Need to look further at the mapping b/w BindingTemplate and
        // Jaxr ServiceBinding

        // Get Service information
        Service svc = serviceBinding.getService();
        if (svc != null && svc.getKey() != null && svc.getKey().getId() != null) {
            bt.setServiceKey(svc.getKey().getId());
        }

        InternationalString idesc = serviceBinding.getDescription();

        addDescriptions(bt.getDescription(), idesc);

        // SpecificationLink
        Collection<SpecificationLink> slcol = serviceBinding.getSpecificationLinks();
        TModelInstanceDetails tid = objectFactory.createTModelInstanceDetails();
        if (slcol != null && !slcol.isEmpty()) {
            Iterator<SpecificationLink> iter = slcol.iterator();
            while (iter.hasNext()) {
                SpecificationLink slink = (SpecificationLink) iter.next();

                TModelInstanceInfo emptyTInfo = objectFactory.createTModelInstanceInfo();
                tid.getTModelInstanceInfo().add(emptyTInfo);

                RegistryObject specificationObject = slink.getSpecificationObject();
                if (specificationObject.getKey() != null && specificationObject.getKey().getId() != null) {
                    emptyTInfo.setTModelKey(specificationObject.getKey().getId());
                    if (specificationObject.getDescription() != null) {
                        for (Object o : specificationObject.getDescription().getLocalizedStrings()) {
                            LocalizedString locDesc = (LocalizedString) o;
                            Description description = objectFactory.createDescription();
                            emptyTInfo.getDescription().add(description);
                            description.setValue(locDesc.getValue());
                            description.setLang(locDesc.getLocale().getLanguage());
                        }
                    }
                    Collection<ExternalLink> externalLinks = slink.getExternalLinks();
                    if (externalLinks != null && externalLinks.size() > 0) {
                        for (ExternalLink link : externalLinks) {
                            InstanceDetails ids = objectFactory.createInstanceDetails();
                            emptyTInfo.setInstanceDetails(ids);
                            if (link.getDescription() != null) {
                                Description description = objectFactory.createDescription();
                                ids.getDescription().add(description);
                                description.setValue(link.getDescription().getValue());
                            }
                            if (link.getExternalURI() != null) {
                                OverviewDoc overviewDoc = objectFactory.createOverviewDoc();
                                ids.setOverviewDoc(overviewDoc);
                                overviewDoc.setOverviewURL(link.getExternalURI());
                            }
                        }
                    }
                }
            }
        }
        bt.setTModelInstanceDetails(tid);
        log.debug("BindingTemplate=" + bt.toString());
    } catch (Exception ud) {
        throw new JAXRException("Apache JAXR Impl:", ud);
    }
    return bt;
}

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

private static OverviewDoc getOverviewDocFromExternalLink(ExternalLink link) throws JAXRException {
    OverviewDoc od = objectFactory.createOverviewDoc();
    String url = link.getExternalURI();
    if (url != null)
        od.setOverviewURL(url);/*from w w w  .  j  a  v  a2s .  co m*/
    InternationalString extDesc = link.getDescription();
    if (extDesc != null) {
        Description description = objectFactory.createDescription();
        od.getDescription().add(description);
        description.setValue(extDesc.getValue());
    }
    return od;
}

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

public static BindingTemplate getBindingTemplateFromJAXRSB(ServiceBinding serviceBinding) throws JAXRException {
    BindingTemplate bt = objectFactory.createBindingTemplate();
    if (serviceBinding.getKey() != null && serviceBinding.getKey().getId() != null) {
        bt.setBindingKey(serviceBinding.getKey().getId());
    } else {/*from  w w  w  .j  av a 2s .c  o m*/
        bt.setBindingKey("");
    }

    try {
        // Set Access URI
        String accessuri = serviceBinding.getAccessURI();
        if (accessuri != null) {
            AccessPoint accessPoint = objectFactory.createAccessPoint();
            accessPoint.setUseType(getUseType(accessuri));
            accessPoint.setValue(accessuri);
            bt.setAccessPoint(accessPoint);
        }
        ServiceBinding sb = serviceBinding.getTargetBinding();
        if (sb != null) {
            HostingRedirector red = objectFactory.createHostingRedirector();
            Key key = sb.getKey();
            if (key != null && key.getId() != null) {
                red.setBindingKey(key.getId());
            } else {
                red.setBindingKey("");
            }
            bt.setHostingRedirector(red);
        } else {
            if (bt.getAccessPoint() == null) {
                bt.setAccessPoint(objectFactory.createAccessPoint());
            }
        }
        // TODO:Need to look further at the mapping b/w BindingTemplate and
        // Jaxr ServiceBinding

        CategoryBag catBag = getCategoryBagFromClassifications(serviceBinding.getClassifications());
        if (catBag != null) {
            bt.setCategoryBag(catBag);
        }

        // Get Service information
        Service svc = serviceBinding.getService();
        if (svc != null && svc.getKey() != null && svc.getKey().getId() != null) {
            bt.setServiceKey(svc.getKey().getId());
        }

        InternationalString idesc = serviceBinding.getDescription();

        addDescriptions(bt.getDescription(), idesc);

        // SpecificationLink
        Collection<SpecificationLink> slcol = serviceBinding.getSpecificationLinks();
        TModelInstanceDetails tid = objectFactory.createTModelInstanceDetails();
        if (slcol != null && !slcol.isEmpty()) {
            Iterator<SpecificationLink> iter = slcol.iterator();
            while (iter.hasNext()) {
                SpecificationLink slink = (SpecificationLink) iter.next();

                TModelInstanceInfo emptyTInfo = objectFactory.createTModelInstanceInfo();
                tid.getTModelInstanceInfo().add(emptyTInfo);

                RegistryObject specificationObject = slink.getSpecificationObject();
                if (specificationObject.getKey() != null && specificationObject.getKey().getId() != null) {
                    emptyTInfo.setTModelKey(specificationObject.getKey().getId());
                    if (specificationObject.getDescription() != null) {
                        for (Object o : specificationObject.getDescription().getLocalizedStrings()) {
                            LocalizedString locDesc = (LocalizedString) o;
                            Description description = objectFactory.createDescription();
                            emptyTInfo.getDescription().add(description);
                            description.setValue(locDesc.getValue());
                            description.setLang(locDesc.getLocale().getLanguage());
                        }
                    }
                    Collection<ExternalLink> externalLinks = slink.getExternalLinks();
                    if (externalLinks != null && externalLinks.size() > 0) {
                        for (ExternalLink link : externalLinks) {
                            InstanceDetails ids = objectFactory.createInstanceDetails();
                            emptyTInfo.setInstanceDetails(ids);
                            if (link.getDescription() != null) {
                                Description description = objectFactory.createDescription();
                                ids.getDescription().add(description);
                                description.setValue(link.getDescription().getValue());
                            }
                            if (link.getExternalURI() != null) {
                                OverviewDoc overviewDoc = objectFactory.createOverviewDoc();
                                ids.getOverviewDoc().add(overviewDoc);
                                org.uddi.api_v3.OverviewURL ourl = new org.uddi.api_v3.OverviewURL();
                                ourl.setValue(link.getExternalURI());
                                overviewDoc.setOverviewURL(ourl);
                            }
                            if (slink.getUsageParameters() != null) {
                                StringBuffer buffer = new StringBuffer();
                                for (Object o : slink.getUsageParameters()) {
                                    String s = (String) o;
                                    buffer.append(s + " ");
                                }
                                ids.setInstanceParms(buffer.toString().trim());
                            }
                        }
                    }
                }
            }
        }
        if (tid.getTModelInstanceInfo().size() != 0) {
            bt.setTModelInstanceDetails(tid);
        }
        log.debug("BindingTemplate=" + bt.toString());
    } catch (Exception ud) {
        throw new JAXRException("Apache JAXR Impl:", ud);
    }
    return bt;
}

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

private static OverviewDoc getOverviewDocFromExternalLink(ExternalLink link) throws JAXRException {
    OverviewDoc od = objectFactory.createOverviewDoc();
    String url = link.getExternalURI();
    if (url != null) {
        org.uddi.api_v3.OverviewURL ourl = new org.uddi.api_v3.OverviewURL();
        ourl.setValue(url.toString());/*w w  w . j ava  2  s . c om*/
        od.setOverviewURL(ourl);
    }
    InternationalString extDesc = link.getDescription();
    if (extDesc != null) {
        Description description = objectFactory.createDescription();
        od.getDescription().add(description);
        description.setValue(extDesc.getValue());
    }
    return od;
}