class compatibility issue ......
I am trying to relate some assets programmatically using RAM Client API.
But getting com.ibm.ram.common.data.RelationshipType incompatible with com.ibm.ram.client.RAMRelationshipType Exception.
Getting Exception at thirld line below...
RelationshipType relationShipType = (RAMRelationshipType) new RelationshipType();
relationShipType.setName("Is Used By");
assetToBeRelated.addRelatedAsset(relateToAsset, relationShipType);
session.put(assetToBeRelated, new NullProgressMonitor());
But as per API I am creating RelationshipType object and passing it right way..
problem may look silly, but i have spent lot of time / thru different ways, with no luck.
But getting com.ibm.ram.common.data.RelationshipType incompatible with com.ibm.ram.client.RAMRelationshipType Exception.
Getting Exception at thirld line below...
RelationshipType relationShipType = (RAMRelationshipType) new RelationshipType();
relationShipType.setName("Is Used By");
assetToBeRelated.addRelatedAsset(relateToAsset, relationShipType);
session.put(assetToBeRelated, new NullProgressMonitor());
But as per API I am creating RelationshipType object and passing it right way..
problem may look silly, but i have spent lot of time / thru different ways, with no luck.
2 answers
Got it. Thanks.
First you need to create the relationship type in RAM if it does not already exist
RAMRelationshipType newRelationshipType = session.createRelationshipType("Is Used By", "Uses");
session.put(newRelationshipType, new NullProgressMonitor());
Next, you need to add the relationship to the asset
assetToBeRelated.addRelatedAsset(relateToAsset, session.getRelationshipType("Is Used By"));
session.put(assetToBeRelated, new NullProgressMonitor());
See the 'Create a new Relationship Type' and 'Add Related Assets to an Asset' topics at
http://publib.boulder.ibm.com/infocenter/ramhelp/v7r2m0/index.jsp?topic=/com.ibm.ram.doc/topics/t_using_api.html
First you need to create the relationship type in RAM if it does not already exist
RAMRelationshipType newRelationshipType = session.createRelationshipType("Is Used By", "Uses");
session.put(newRelationshipType, new NullProgressMonitor());
Next, you need to add the relationship to the asset
assetToBeRelated.addRelatedAsset(relateToAsset, session.getRelationshipType("Is Used By"));
session.put(assetToBeRelated, new NullProgressMonitor());
See the 'Create a new Relationship Type' and 'Add Related Assets to an Asset' topics at
http://publib.boulder.ibm.com/infocenter/ramhelp/v7r2m0/index.jsp?topic=/com.ibm.ram.doc/topics/t_using_api.html
RAMRelationshipType newRelationshipType = session.createRelationshipType("Is Used By", "Uses");
session.put(newRelationshipType, new NullProgressMonitor());
Next, you need to add the relationship to the asset
assetToBeRelated.addRelatedAsset(relateToAsset, session.getRelationshipType("Is Used By"));
session.put(assetToBeRelated, new NullProgressMonitor());
See the 'Create a new Relationship Type' and 'Add Related Assets to an Asset' topics at
http://publib.boulder.ibm.com/infocenter/ramhelp/v7r2m0/index.jsp?topic=/com.ibm.ram.doc/topics/t_using_api.html