It's all about the answers!

Ask a question

Running a policy from another policy?


Unai Mayo (3154) | asked May 11 '11, 7:12 a.m.
Hi.
I want to run policies depending on some custom conditions. They only way I can imagine to implements this it's creating a custom policy that check the conditions and fire the right policy. So, is it possible to run policies using the policy API? Any other possible approach?
Regards,
-unai

3 answers



permanent link
Gili Mendel (1.8k56) | answered May 12 '11, 8:30 a.m.
JAZZ DEVELOPER
A policy gets to run on a server thread, as a response to an asset event (e.g., enters a state, update ...). The policy gets a context (the asset, policy configuration on that state ....).

What the policy does, and what code it returns when it ends, is up to that policy. Policy can update the (context) asset, other assets... delegate work to other systems (e.g., build / automation, opening a change request ...), or read a rule file (say an XML content from another asset) to determine what to do. The last one imply that you have one generic policy that do different thing based on the environment it is executing, and the rules associated with that environment.


Not sure for the exact reason you want a policy to "fire the right policy" ...
Can you provide an example, specifically, when is the "main" policy activated, what what conditions it will drive what action

permanent link
Unai Mayo (3154) | answered May 12 '11, 11:35 a.m.
Simple example: imagine I want to send an email to asset owner depending on some custom conditions. I could associate default 'send email' policy with the state but with no event. Then I could run this policy from another policy that checks custom conditions, passing the 'policy context' to default 'send email' policy.

Obviously, I can create some custom code that implements the 'send email' behaviour, but in that case I can not reuse default policy. This applies to the rest of default policies.

Also, RAM could track what policies were run on that asset/state and show them in web UI. That applies also to custom policies. If I have rules A, B and C, and they are executed as policies from Controler policy, RAM web UI would show policies A, B, C and Controler were executed on that asset. But if they are implemented as rules inside my custom code, only Controler would be showed.

permanent link
Gili Mendel (1.8k56) | answered May 16 '11, 8:40 a.m.
JAZZ DEVELOPER
... so you want to reUse the existing eMail policy to: get users (reviewers, owners ...), and send them an email?

Your answer


Register or 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.