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:it.cnr.icar.eric.client.xml.registry.BusinessQueryManagerImpl.java

@SuppressWarnings("unused")
static private String classificationToConceptId(Object obj) throws JAXRException {
    if (!(obj instanceof Classification)) {
        throw new UnexpectedObjectException(JAXRResourceBundle.getInstance()
                .getString("message.error.expected.collection.objectType.Classification"));
    }/*from   w  w w .  j a  v a2s. c  om*/

    Classification cl = (Classification) obj;

    if (cl.isExternal()) {
        throw new JAXRException(JAXRResourceBundle.getInstance()
                .getString("message.error.no.support.external.classification.qaulifier"));
    }

    Concept concept = cl.getConcept();

    if (concept == null) {
        throw new JAXRException(JAXRResourceBundle.getInstance()
                .getString("message.error.internal.classification.concept.null"));
    }

    return concept.getKey().getId();
}

From source file:it.cnr.icar.eric.client.xml.registry.infomodel.ConceptImpl.java

public void setParentConcept(Concept c) throws JAXRException {
    if ((parentRef == null) || (!(parentRef.getId().equals(c.getKey().getId())))) {
        parentRef = new RegistryObjectRef(lcm, c);
        c.addChildConcept(this);

        setModified(true);/*w  ww  .  java 2 s .  co m*/
    }
}

From source file:it.cnr.icar.eric.client.ui.common.UIUtility.java

public ObjectTypeConfigType getObjectTypeConfig(Concept commonObjectType) throws JAXRException {
    ObjectTypeConfigType uiObjectTypeConfigType = null;

    while (true) {
        if (commonObjectType == null) {
            //This could happen if there is some problem with access control on the server and the ObjectType node for RegistryObject is not returned.
            //Use RegistryObject as default objectType
            uiObjectTypeConfigType = objectTypeToConfigMap
                    .get(BindingUtility.CANONICAL_OBJECT_TYPE_ID_RegistryObject);
        } else {//from  w  w  w .j  a  v a 2s  .c om
            //Now get the ObjectTypeConfig for the commonObjectType
            uiObjectTypeConfigType = objectTypeToConfigMap.get(commonObjectType.getKey().getId());
        }

        if (uiObjectTypeConfigType != null) {
            break;
        } else {
            Concept parent = commonObjectType.getParentConcept();

            if (parent == null) {
                //Use RegistryObject (id BindingUtility.CANONICAL_OBJECT_TYPE_ID_RegistryObject) as default objectType
                uiObjectTypeConfigType = objectTypeToConfigMap
                        .get(BindingUtility.CANONICAL_OBJECT_TYPE_ID_RegistryObject);

                break;
            } else {
                commonObjectType = parent;
            }
        }
    }
    return uiObjectTypeConfigType;
}

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

public RegistryObjectBean(Collection<SearchResultValueBean> searchResultValueBeans,
        RegistryObject registryObject) {
    this(searchResultValueBeans);
    this.registryObject = registryObject;
    if (registryObject != null) {
        try {//w  ww .  j  av a 2 s  . c  o m
            this.id = registryObject.getKey().getId();
        } catch (JAXRException ex) {
            log.warn(WebUIResourceBundle.getInstance()
                    .getString("message.CouldNotGetObjectTypeDefaultToRegistryObject"), ex);
            this.objectType = "RegistryObject";
        }
        try {
            if (nonRegistryObject == null) {
                this.objectType = registryObject.getObjectType().getValue();
                Concept objectTypeConcept = registryObject.getObjectType();

                if (registryObject instanceof Association) {
                    extendedObjectType = ((Association) registryObject).getAssociationType().getKey().getId();
                } else {
                    extendedObjectType = objectTypeConcept.getKey().getId();
                }
                if (registryObject instanceof ExternalLink) {
                    this.objectType = "ExternalLink";
                } else if (objectTypeConcept.getPath()
                        .startsWith("/" + CanonicalSchemes.CANONICAL_CLASSIFICATION_SCHEME_LID_ObjectType
                                + "/RegistryObject/ExtrinsicObject/")) {
                    this.objectType = "ExtrinsicObject";
                }
            }
        } catch (Throwable t) {
            log.error(WebUIResourceBundle.getInstance()
                    .getString("message.ErrorInConstructingRegistryObjectBean"), t);
        }
    }
}

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

/**
 * Create a RegistryObject based on teh current setting of
 * objectTypeCombo//from  w w  w.  j a  v  a2 s  . c o m
 *
 * @return DOCUMENT ME!
 *
 * @throws JAXRException DOCUMENT ME!
 */
@SuppressWarnings("unused")
private RegistryObject createRegistryObject() throws JAXRException {
    RegistryObject ro = null;

    JAXRClient client = RegistryBrowser.getInstance().getClient();
    BusinessLifeCycleManager lcm = client.getBusinessLifeCycleManager();
    Concept objectTypeConcept = null;

    Object conceptsTreeNode = objectTypeCombo.getSelectedItemsObject();
    Object nodeInfo = ((javax.swing.tree.DefaultMutableTreeNode) conceptsTreeNode).getUserObject();

    if (nodeInfo instanceof it.cnr.icar.eric.client.ui.swing.NodeInfo) {
        Object obj = ((it.cnr.icar.eric.client.ui.swing.NodeInfo) nodeInfo).obj;

        if (obj instanceof javax.xml.registry.infomodel.Concept) {
            objectTypeConcept = (Concept) obj;

            if ((objectTypeConcept.getKey().getId()
                    .equals(BindingUtility.CANONICAL_OBJECT_TYPE_ID_AuditableEvent))
                    || (objectTypeConcept.getKey().getId()
                            .equals(BindingUtility.CANONICAL_OBJECT_TYPE_ID_Notification))
                    || (objectTypeConcept.getKey().getId()
                            .equals(BindingUtility.CANONICAL_OBJECT_TYPE_ID_RegistryObject))) {
                throw new JAXRException(
                        "Please choose a different item from ObjectType list. A user is not allowed to create an object of this type: "
                                + objectTypeConcept.getKey().getId());
            }
        } else {
            throw new JAXRException("Invalid objectType. Please choose a child item from ObjectType list.");
        }
    }

    it.cnr.icar.eric.client.xml.registry.util.QueryUtil qu = it.cnr.icar.eric.client.xml.registry.util.QueryUtil
            .getInstance();

    ro = (RegistryObject) (((LifeCycleManagerImpl) lcm).createObject(objectTypeConcept));

    return ro;
}

From source file:it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl.java

/**
 * Create an ExtrinsicObject instance of the given type.
 * <p>//from w w  w.ja v a 2 s  .c  om
 * The implementation class returned depends on whether an extension class
 * has been defined for the given objectType or not. Default is
 * <code>.infomodel.ExtrinsicObjectImpl</code>.
 * 
 * @param objectType
 *            The type for the ExtrinsicObject (Concept)
 * @return a new instance of an ExtrinsicObject
 * @throws JAXRException
 *             if the JAXR provider encounters an internal error
 */
public ExtrinsicObject createExtrinsicObject(Concept objectType) throws javax.xml.registry.JAXRException {
    String type = objectType.getKey().getId();
    ExtrinsicObjectImpl eo = imFactory.createExtrinsicObject(this, type);
    eo.setObjectType(objectType);

    return eo;
}

From source file:it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl.java

/**
 * Create an Association instance of the given type. The sourceObject and
 * target object must be set later.//from   www .  j av  a 2  s. c o m
 * <p>
 * The implementation class returned depends on whether an extension class
 * has been defined for the given associationType or not. Default is
 * <code>.infomodel.AssociationImpl</code>.
 * 
 * @param associationType
 *            The type for the Association (Concept)
 * @return a new instance of an Association
 * @throws JAXRException
 *             if the JAXR provider encounters an internal error
 */
public Association createAssociation(Concept associationType) throws JAXRException {
    String type = null;
    if (associationType != null) {
        type = associationType.getKey().getId();
    }
    AssociationImpl ass = imFactory.createAssociation(this, type);
    ass.setAssociationType(associationType);

    return ass;
}

From source file:it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl.java

/**
 * Create an object for the specified objectType Add to JAXR 2.0
 *//*  www. j ava  2  s  .com*/
public Object createObject(Concept objectTypeConcept)
        throws JAXRException, InvalidRequestException, UnsupportedCapabilityException {

    Object obj = null;
    String path = objectTypeConcept.getPath();
    if (path == null) {
        throw new JAXRException(JAXRResourceBundle.getInstance().getString("message.error.Concept.path.null",
                new Object[] { objectTypeConcept.getKey().getId() }));
    }
    if (path.startsWith("/" + BindingUtility.CANONICAL_CLASSIFICATION_SCHEME_LID_ObjectType
            + "/RegistryObject/ExtrinsicObject")) {
        obj = createExtrinsicObject(objectTypeConcept);
    } else if (path.startsWith("" + BindingUtility.CANONICAL_CLASSIFICATION_SCHEME_LID_AssociationType + "/")
            || path.startsWith("/" + BindingUtility.CANONICAL_CLASSIFICATION_SCHEME_LID_ObjectType
                    + "/RegistryObject/Association")) {
        obj = createAssociation(objectTypeConcept);
    } else {
        String className = getJAXRClassNameFromObjectType(objectTypeConcept);
        obj = createObject(className);
    }

    return obj;
}

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

public List<SelectItem> getAssociationTypes() throws JAXRException {
    ArrayList<SelectItem> list = new ArrayList<SelectItem>();
    Collection<?> concepts = ((BusinessQueryManagerImpl) UIUtility.getInstance().getBusinessQueryManager())
            .findConceptsByPath(//from   w  w w  . j ava  2s.  com
                    "/" + BindingUtility.CANONICAL_CLASSIFICATION_SCHEME_LID_AssociationType + "/%");
    Iterator<?> conceptsItr = concepts.iterator();
    while (conceptsItr.hasNext()) {
        Concept concept = (Concept) conceptsItr.next();
        list.add(new SelectItem(concept.getKey().getId(), concept.getValue()));
    }
    return list;
}

From source file:org.apache.ws.scout.registry.BusinessQueryManagerImpl.java

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

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

        try {//from www.j  av  a2 s .c o  m

            TModelDetail tmodeldetail = registry.getTModelDetail(id);
            Concept c = ScoutUddiJaxrHelper.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 (RegistryException e) {
            throw new JAXRException(e.getLocalizedMessage());
        }
    } else if (LifeCycleManager.ORGANIZATION.equalsIgnoreCase(objectType)) {
        try {
            BusinessDetail orgdetail = registry.getBusinessDetail(id);
            return ScoutUddiJaxrHelper.getOrganization(orgdetail, lcm);
        } catch (RegistryException e) {
            throw new JAXRException(e.getLocalizedMessage());
        }

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

        try {
            TModelDetail tmodeldetail = registry.getTModelDetail(id);
            return ScoutUddiJaxrHelper.getConcept(tmodeldetail, lcm);
        } catch (RegistryException 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 (RegistryException e) {
            throw new RuntimeException(e);
        }
    }

    return null;
}