Example usage for javax.xml.registry.infomodel Association setSourceObject

List of usage examples for javax.xml.registry.infomodel Association setSourceObject

Introduction

In this page you can find the example usage for javax.xml.registry.infomodel Association setSourceObject.

Prototype

void setSourceObject(RegistryObject srcObject) throws JAXRException;

Source Link

Document

Sets the Object that is the source of this Association.

Usage

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

/**
* This method do Intialization for Relationship Operation and also 
* determine what kind of Relation(Reference and Assocation) should be establish 
* between two Registry Objects.  /*from w  ww  . j  a  va2  s  .  co  m*/
* 
* @param none
* @return String
*/
@SuppressWarnings("unused")
private String initAssocation() {
    ArrayList<Object> associationList = new ArrayList<Object>();
    String sourceType = null;
    String status = "failure";
    try {
        @SuppressWarnings("static-access")
        BusinessLifeCycleManagerImpl blcm = RegistryBrowser.getInstance().getBLCM();
        Association assoc = (Association) blcm.createObject(LifeCycleManager.ASSOCIATION);
        VersionInfoType vit = BindingUtility.getInstance().rimFac.createVersionInfoType();
        ((RegistryObjectImpl) assoc).setVersionInfo(vit);
        if (pivotalRegistryObjectBean.size() == 2) {
            if (this.referenceSourceCode != null) {
                if (this.referenceSourceCode
                        .equals(((RegistryObjectBean) pivotalRegistryObjectBean.get(0)).getId())) {
                    sourceType = "source";
                } else {
                    sourceType = "target";
                }
            } else {
                sourceType = "source";
            }
        }

        Concept concept = RegistryBrowser.getBQM()
                .findConceptByPath("/" + CanonicalSchemes.CANONICAL_CLASSIFICATION_SCHEME_LID_AssociationType
                        + "/AccessControlPolicyFor");
        assoc.setSourceObject(this.relationshipBean.getSourceRegistryObject());
        assoc.setTargetObject(this.relationshipBean.getTargetRegistryObject());
        assoc.setAssociationType(concept);
        RegistryObjectBean rob = new RegistryObjectBean(null, assoc);
        rob.initRelatedObjects();
        currentRegistryObject = rob;
        this.clearRelationObjects();
        status = "relationSuccessful";
    } catch (Exception ex) {
        log.error(WebUIResourceBundle.getInstance()
                .getString("message.FailedDuringCreationOfAssociationUIInitOperation"), ex);
        RegistryBrowser.getInstance()
                .setErrorMessage(WebUIResourceBundle.getInstance().getString("errorAssociationLcm"));
    }
    return status;
}