List of usage examples for javax.xml.registry LifeCycleManager ASSOCIATION
String ASSOCIATION
To view the source code for javax.xml.registry LifeCycleManager ASSOCIATION.
Click Source Link
From source file:it.cnr.icar.eric.client.xml.registry.InfomodelFactoryTest.java
/** * Test lcm.create, lcm.save and query of extended Association *//*from www .ja v a 2 s .c o m*/ public void testExtendedAssociationLCM() throws Exception { System.out.println("\ntestExtendedAssociationLCM"); Object o; @SuppressWarnings("unused") InfomodelFactory extUtil = InfomodelFactory.getInstance(); Concept parentConcept = (Concept) bqm.getRegistryObject(BindingUtility.CANONICAL_OBJECT_TYPE_ID_Association, "ClassificationNode"); Concept myAssociationType = lcm.createConcept(parentConcept, "MyAssociation", "MyAssociation"); myAssociationType.setKey(lcm.createKey(ASS_EXT_UUID)); try { BulkResponse br; // Save concept and update it, to get the path br = lcm.saveObjects(Collections.singleton(myAssociationType)); assertResponseSuccess(br); Query q = dqm.createQuery(QueryImpl.QUERY_TYPE_SQL, "select * from ClassificationNode where id = '" + ASS_EXT_UUID + "'"); br = dqm.executeQuery(q); assertResponseSuccess(br); myAssociationType = (Concept) br.getCollection().iterator().next(); // test lcm.createObject(Concept) o = lcm.createObject(myAssociationType); assertNotNull(o); assertTrue("Association extensions must extend AssociationImpl", o instanceof AssociationImpl); assertEquals("Should have been default class", ASS_EXT_CLASSNAME, o.getClass().getName()); assertEquals("Should be of type MyAssociation", myAssociationType, ((Association) o).getAssociationType()); // test lcm.createObject(String) o = lcm.createObject(ASS_NICKNAME); assertNotNull(o); assertTrue("Association extensions must extend AssociationImpl", o instanceof AssociationImpl); assertEquals("Should have been default class", ASS_EXT_CLASSNAME, o.getClass().getName()); assertEquals("Should be of type MyAssociation", myAssociationType, ((Association) o).getAssociationType()); // test lcm.createAssociation o = lcm.createAssociation(myAssociationType); assertNotNull(o); assertTrue("Association extensions must extend AssociationImpl", o instanceof AssociationImpl); assertEquals("Should have been default class", ASS_EXT_CLASSNAME, o.getClass().getName()); assertEquals("Should be of type MyAssociation", myAssociationType, ((Association) o).getAssociationType()); ((RegistryObject) o).setKey(lcm.createKey(ASS_TEST_UUID)); // Association needs a source and a target RegistryObject target = lcm.createExtrinsicObject(); target.setKey(lcm.createKey(EO_TEST_UUID)); assertNotNull(target); ((AssociationImpl) o).setTargetObject(target); ((AssociationImpl) o).setSourceObject(parentConcept); ArrayList<Object> objects = new ArrayList<Object>(); objects.add(o); objects.add(target); br = lcm.saveObjects(objects); assertResponseSuccess(br); q = dqm.createQuery(QueryImpl.QUERY_TYPE_SQL, "select * from Association where id = '" + ASS_TEST_UUID + "'"); br = dqm.executeQuery(q); assertResponseSuccess(br); o = br.getCollection().iterator().next(); assertEquals("Should have been default class", ASS_EXT_CLASSNAME, o.getClass().getName()); } finally { // cleanup deleteIfExist(ASS_EXT_UUID, LifeCycleManager.ASSOCIATION); deleteIfExist(EO_TEST_UUID, LifeCycleManager.EXTRINSIC_OBJECT); deleteIfExist(ASS_TEST_UUID, LifeCycleManager.ASSOCIATION); } }
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 w w . j ava2 s. com*/ * * @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; }
From source file:org.apache.ws.scout.registry.BusinessLifeCycleManagerImpl.java
/** * Deletes one or more previously submitted objects from the registry * using the object keys and a specified objectType attribute. * * @param keys//from w w w .ja va2 s . c om * @param objectType * @return BulkResponse object * @throws JAXRException */ public BulkResponse deleteObjects(Collection keys, String objectType) throws JAXRException { BulkResponse bulk = null; if (objectType == LifeCycleManager.ASSOCIATION) { bulk = this.deleteAssociations(keys); } else if (objectType == LifeCycleManager.CLASSIFICATION_SCHEME) { bulk = this.deleteClassificationSchemes(keys); } else if (objectType == LifeCycleManager.CONCEPT) { bulk = this.deleteConcepts(keys); } else if (objectType == LifeCycleManager.ORGANIZATION) { bulk = this.deleteOrganizations(keys); } else if (objectType == LifeCycleManager.SERVICE) { bulk = this.deleteServices(keys); } else if (objectType == LifeCycleManager.SERVICE_BINDING) { bulk = this.deleteServiceBindings(keys); } else { throw new JAXRException("Delete Operation for " + objectType + " not implemented by Scout"); } return bulk; }