Jazz Register Log in
Jazz Forum Welcome to the Jazz Community Forum

Welcome to the Jazz Community Forum

Connect and collaborate with IBM Engineering experts and users

How can I add constraint of relation type for asset type by

I want to add constraint of relation type for asset type by RAM API, but I cannot find that operations neither by java client nor web service API. I can create relation type, can create asset type, but no idea to connect them together. Have any idea? Thanks.

0 votes



2 answers

Permanent link
I want to add constraint of relation type for asset type by RAM API, but I cannot find that operations neither by java client nor web service API. I can create relation type, can create asset type, but no idea to connect them together. Have any idea? Thanks.


Unfortunately we have not had the time to fully flush out all the admin functions into API. We do not have a simple way to accomplish adding a relationship constraint to an Asset Type. However the constraints are stored in the Asset Type configuration. This can be set via the API.

I would recommend setting up your asset type in the UI just as you would like it. Than writing a test case that gets the Asset Type from the session and prints it out.


RAMAssetType type = session.getAssetType("AAA");
String config = type.getConfiguration();
System.out.println(config);


For example I have an Asset Type that requires a relationship of type "documentation" to an Asset of type Specification.


<?xml version="1.0" encoding="UTF-8"?>
<com.ibm.ram.common.emf:AssetTypeConfiguration xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:com.ibm.ram.common.emf="http:///com/ibm/ram/common/emf.ecore">
<constraints xsi:type="com.ibm.ram.common.emf:RelationshipGrouping">
<constraints count="1" relationship="documentation" requiredAssetType="classif/assetTypesSchema.xmi#specification"/>
</constraints>
</com.ibm.ram.common.emf:AssetTypeConfiguration>


Once you have the XML that describes the AssetType constraints you would like you can set this value in the configuration when programmatic creating a new type...


RAMAssetType type = session.createAssetType("New Type");
type.setDescription("This is a test type created to show how to programtically create a relationship constraint");
StringBuffer config = new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
config.append("<com.ibm.ram.common.emf:AssetTypeConfiguration xmi:version=\"2.0\"\n");
config.append(" xmlns:xmi=\"http://www.omg.org/XMI\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:com.ibm.ram.common.emf=\"http:///com/ibm/ram/common/emf.ecore\">");
config.append(" <constraints xsi:type=\"com.ibm.ram.common.emf:RelationshipGrouping\">");
config.append(" <constraints count=\"1\" relationship=\"documentation\" requiredAssetType=\"classif/assetTypesSchema.xmi#specification\"/>");
config.append(" </constraints>");
config.append("</com.ibm.ram.common.emf:AssetTypeConfiguration>");
type.setConfiguration(config.toString());

session.put(type, new RAMStatusMonitor(){
@Override
public void appendStatus(Object targetObject, int severity, int code, String message, Throwable exception) {
System.out.println(severity + " - " + code + " " + targetObject + ": " + message);
if(exception != null) exception.printStackTrace();
}}
);


There is an enhancement to better expose this functionality in the API...

https://jazz.net/jazz02/web/projects/Rational%20Asset%20Manager#action=com.ibm.team.workitem.viewWorkItem&id=25210

It is currently not in plan for 7.5

0 votes


Permanent link
Thank you very much. I will test on it.

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: May 04 '10, 11:33 p.m.

Question was seen: 7,445 times

Last updated: May 04 '10, 11:33 p.m.

Confirmation Cancel Confirm