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

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

Introduction

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

Prototype

boolean isExternal() throws JAXRException;

Source Link

Document

Determines whether this ClassificationScheme is an external ClassificationScheme or an internal ClassificationScheme.

Usage

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

/**
 * This method return the Status after setting the value in Registry Object 
 * //w w  w  .j  a  v  a 2 s  . com
 * @param none
 * @return String
 */
@SuppressWarnings("unused")
public String doSetClassSchemeOrNode() {
    String status = "failure";
    String node = null;
    String classScheme = null;
    String temp = null;
    String value = null;
    ClassificationScheme classificationScheme = null;
    Concept concept = null;
    String message = null;
    try {
        Collection<?> nodes = SearchPanelBean.getInstance().getClassSchemeSelector().getSelectedNodes();
        if (nodes.size() < 1) {
            append(WebUIResourceBundle.getInstance().getString("selectClassSchemeOrNode"));
        } else {
            // Get first selected node
            // TODO: add attribute to ClassSchemeGraph bean to enforce single 
            // node selection. In this case, user should only be able to 
            // select a single ClassificationNode
            RegistryObjectNode ron = (RegistryObjectNode) nodes.iterator().next();
            RegistryObject registryObject = ron.getRegistryObject();
            if (registryObject instanceof ClassificationScheme) {
                classificationScheme = (ClassificationScheme) registryObject;
                concept = classificationScheme.getObjectType();
            } else {
                concept = (Concept) registryObject;
                classificationScheme = concept.getClassificationScheme();
            }
            value = concept.getValue();
            RegistryObject ro = getCurrentRegistryObjectBean().getRegistryObject();
            if (ro instanceof Classification) {
                boolean external = classificationScheme.isExternal();
                //If the node value is null and the Class scheme in not External 
                //type it will return the control to the error page along 
                //with the message.     
                if (value == null && !external) {
                    append(WebUIResourceBundle.getInstance().getString("selectExternalCSorCN"));
                    status = "showErrorMessage";
                    return status;
                }
                ((Classification) ro).setClassificationScheme(classificationScheme);
                if (external) {
                    concept = null;
                    ((Classification) ro).setConcept(concept);
                    ((Classification) ro).setValue(null);
                } else {
                    ((Classification) ro).setConcept(concept);
                    ((Classification) ro).setValue(value);
                }
            }
            if (ro instanceof ExternalIdentifier) {
                ((ExternalIdentifier) ro).setIdentificationScheme(classificationScheme);
                if (value != null) {
                    ((ExternalIdentifier) ro).setValue(value);
                } else {
                    ((ExternalIdentifier) ro).setValue("");
                }
            }
            if (registryObject instanceof ClassificationScheme) {
                append(WebUIResourceBundle.getInstance().getString("selectNewCSSuccessful"));
            } else {
                append(WebUIResourceBundle.getInstance().getString("selectNewCNSuccessful"));
            }
            SearchPanelBean.getInstance().clearClassSchemeSelector();
            status = "showMessagePage";
        }

    } catch (Exception ex) {
        log.error(WebUIResourceBundle.getInstance()
                .getString("message.ExceptionOccuredWhileSetingClassSchemeOrNode"), ex);
        append(WebUIResourceBundle.getInstance().getString("errorSettingCSorCN") + " "
                + ex.getLocalizedMessage());
    }
    return status;
}