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

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

Introduction

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

Prototype

InternationalString getName() throws JAXRException;

Source Link

Document

Gets the user-friendly name of this object.

Usage

From source file:JAXRQueryPostal.java

/**
     * Returns the name value for a registry object.
     *//from  w w  w  . j  av  a2s  .c o m
     * @param ro        a RegistryObject
     * @return                the String value
     */
    private String getName(RegistryObject ro) throws JAXRException {
        try {
            return ro.getName().getValue();
        } catch (NullPointerException npe) {
            return "No Name";
        }
    }

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

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

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

private List<SelectItem> getSelectItems(RegistryObject ro) {
    List<SelectItem> types = null;
    String objectId = null;//from ww w.ja va2s.c  o  m
    try {
        objectId = ro.getKey().getId();
        types = new ArrayList<SelectItem>();
        if (ro instanceof ClassificationScheme) {
            Object obj = " ";
            String label = ro.getName().getValue();
            if (label == null) {
                String message = WebUIResourceBundle.getInstance().getString("valueNotFound",
                        new Object[] { ro.getKey().getId() });
                log.error(message);
                label = message;
            }
            types.add(new SelectItem(obj, label));
            Collection<RegistryObject> concepts = getConcepts(ro);
            loadTypes(concepts, types, "...");
        } else {
            Collection<RegistryObject> concepts = getConcepts(ro);
            loadTypes(concepts, types, "");
        }
    } catch (Throwable t) {
        log.error(WebUIResourceBundle.getInstance().getString("message.CouldNotLoadClassificationNodesWithId",
                new Object[] { objectId }), t);
    }
    return types;
}

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

private String getLocalizedNameString(RegistryObject ro) throws JAXRException {
    String nameValue = null;/*  ww  w  .  j a  v a2 s.c om*/
    LocalizedString lsName = ((InternationalStringImpl) ro.getName()).getClosestLocalizedString(getLocale(),
            getCharset());

    if (lsName != null) {
        nameValue = lsName.getValue();
    }
    if (nameValue == null) {
        nameValue = "";
    }
    return nameValue;
}

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>();
    }//from   w w w  . java2 s.c o m
    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;
}