Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Custom policies and default policies

Hi,

I was writing a custom policy in which i came across a situation where i would like to re-use the logic of one of the already available default policies. Is this possible? Can one policy call another policy? If so, can you please provide me with the snippet code of how I can actually do that?

Regards,
Sripriya.

0 votes



4 answers

Permanent link
Policies do not "call" other policies. If you want to re-use a function... you can extend a policy.

Which policy do you want to re-use and how?

0 votes


Permanent link
I would like to write a new custom policy that will check for a particular "asset type" and will invoke the Relationship Validation Policy by passing parameters such as:

1. Operator
2. Number of related assets
3. Related Asset Type
4. Relationships

Is this possible?

0 votes


Permanent link
I am not sure that I fully understood, but the following is a general guideline:

Extend the RelationshipValidationPolicy class. It is defined in the com.ibm.ram.repository.jar (you can get it from .... <wasinstall>/profiles/AppSrvxx/installedApps/RAM1WebApplication.ear/com.ibm.ram.repository.web.war/WEB-INF)


Make sure to override the getID() class.

If you need more configuration... make sure to call the super.getConfigurationDetail (Locale) ... and add to what's already there.

the parameters for that methond is defined as following.


public static final String RELATIONSHIP_FIELD = "ram_relationship_name"; //$NON-NLS-1$
public static final String RELATIONSHIP_ASSET_TYPE = "ram_relationship_asset_type"; //$NON-NLS-1$
public static final String RELATIONSHIP_ASSET_STATE = "ram_relationship_state"; //$NON-NLS-1$
public static final String RELATIONSHIP_CARDINALITY_TYPE = "ram_cardinality_type"; //$NON-NLS-1$
public static final String RELATIONSHIP_CARDINALITY_VALUE = "ram_cardinality_value"; //$NON-NLS-1$



From your test() method... you can test your asset type (use the getRelationshipTypes() method, and call super.test() as needed ... look at the result and go from there.

0 votes


Permanent link
Thanks for the help! I will get back to you if I get stuck again :)

Regards,
Sripriya

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: Aug 04 '11, 1:42 a.m.

Question was seen: 5,498 times

Last updated: Aug 04 '11, 1:42 a.m.

Confirmation Cancel Confirm