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

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

Introduction

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

Prototype

InternationalString getDescription() throws JAXRException;

Source Link

Document

Gets the textual description for this object.

Usage

From source file:JAXRQueryPostal.java

/**
     * Returns the description value for a registry object.
     */*from   w  ww .j av a  2  s  . c  om*/
     * @param ro        a RegistryObject
     * @return                the String value
     */
    private String getDescription(RegistryObject ro) throws JAXRException {
        try {
            return ro.getDescription().getValue();
        } catch (NullPointerException npe) {
            return "No Description";
        }
    }

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

/**
 * DOCUMENT ME!/*from  ww w .j a v a  2 s  . c o m*/
 * 
 * @param ro
 *            DOCUMENT ME!
 * 
 * @return DOCUMENT ME!
 * 
 * @throws JAXRException
 *             DOCUMENT ME!
 */
public static String getDescription(RegistryObject ro) throws JAXRException {
    try {
        return ((InternationalStringImpl) ro.getDescription()).getClosestValue();
    } catch (NullPointerException npe) {
        return "";
    }
}

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

private String getLocalizedDescriptionString(RegistryObject ro) throws JAXRException {
    String descValue = null;//from   w ww.ja  v  a 2s.  co m
    LocalizedString lsDesc = ((InternationalStringImpl) ro.getDescription())
            .getClosestLocalizedString(getLocale(), getCharset());

    if (lsDesc != null) {
        descValue = lsDesc.getValue();
    }
    if (descValue == null) {
        descValue = "";
    }
    return descValue;
}

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

public List<RegistryObjectBean> createRegistryObjectBeans(Collection<RegistryObject> registryObjects,
        boolean enableIterateAdjustment)
        throws ClassNotFoundException, NoSuchMethodException, ExceptionInInitializerError, Exception {
    int numRegistryObjects = registryObjects.size();
    if (numRegistryObjects == 0) {
        return new ArrayList<RegistryObjectBean>();
    }/*  ww w. ja  va  2  s.com*/
    List<RegistryObjectBean> roBeans = new ArrayList<RegistryObjectBean>(numRegistryObjects);

    Iterator<RegistryObject> roItr = registryObjects.iterator();
    if (log.isDebugEnabled()) {
        log.debug("Query results: ");
    }
    Collection<RegistryObject> allROs = registryObjects;

    Concept commonObjectType = UIUtility.getInstance().getCommonObjectType(allROs);
    ObjectTypeConfigType otCfg = UIUtility.getInstance().getObjectTypeConfig(commonObjectType);
    SearchResultsConfigType srCfg = otCfg.getSearchResultsConfig();

    List<SearchResultsColumnType> srCols = srCfg.getSearchResultsColumn();
    int numCols = srCols.size();
    // Replace ObjectType with Id. TODO - formalize this convention
    for (@SuppressWarnings("unused")
    int i = 0; roItr.hasNext(); i++) {

        RegistryObject registryObject = roItr.next();
        if (log.isDebugEnabled()) {
            log.debug("Name: " + registryObject.getName());
            log.debug("Description: " + registryObject.getDescription());
        }
        String header = null;
        String className = otCfg.getClassName();
        if (registryObject instanceof javax.xml.registry.infomodel.ExternalLink) {
            className = "it.cnr.icar.eric.client.xml.registry.infomodel.ExternalLinkImpl";
        }
        List<SearchResultValueBean> searchResultValueBeans = new ArrayList<SearchResultValueBean>(numCols + 1);
        header = WebUIResourceBundle.getInstance().getString("details", "Details");
        SearchResultValueBean srvb = new SearchResultValueBean(header, registryObject.getKey().getId());
        searchResultValueBeans.add(srvb);
        /*
        if (passROB !=null && (passROB.getId()).equals(registryObject.getKey().getId())) {
        registryObject = passROB.getRegistryObject();
        }
        */
        @SuppressWarnings("unused")
        List<?> srvbHeader = new ArrayList<Object>(numCols + 1);
        // Replace data with link to Id. TODO - formalize this convention
        for (int j = 0; j < numCols; j++) {
            SearchResultsColumnType srColType = srCols.get(j);
            header = srColType.getColumnHeader();
            header = WebUIResourceBundle.getInstance().getString(header, header);
            Object columnValue = UIUtility.getInstance().getColumnValue(srColType, className, registryObject,
                    getLocale(), getCharset());
            srvb = new SearchResultValueBean(header, columnValue);

            searchResultValueBeans.add(srvb);
        }
        RegistryObjectBean srb = new RegistryObjectBean(searchResultValueBeans, registryObject,
                enableIterateAdjustment, otCfg);
        roBeans.add(srb);
    }
    return roBeans;
}

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 {// ww  w.j  a va2 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.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 {//w ww . jav a 2  s  .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;
}