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

Modifying a workitem with IOperationAdvisor or IOperationParticipant ?

 Hi,

I was looking for a way to change the value of a workitem's attribute during the Save phase.
In com.ibm.team.process.common.advice.runtime there are 2 hooks, namely IOperationAdvisor (pre-save) and IOperationParticipant (post-save). I've looked around for some examples of workitem modification, but haven't found any yet. It's not even clear to me if i makes sense to be able to make a change on a workitem during the either pre-save or post-save phase. Would someone please advise? 

thanks in advance
John

0 votes


Accepted answer

Permanent link
Hi John,

here is an example participant: http://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/

I would probably use a participant rather than an Advisor, however, I know others have done modifications in an Advisor as well. You might also want to look if you can use a java script based extension e.g. a calculated value provider https://jazz.net/wiki/bin/view/Main/AttributeCustomization .
John Kelly selected this answer as the correct answer

0 votes

Comments

Thanks so much for your prompt response Ralph... 


I had a look at the example and it appears to update the parent of the workitem-being-saved, is it valid to modify the workitem-being-saved itself? I will also check out the attribute customization, which may well help...

thanks again
John 

Hi John,

Update

You should use a Participant/followup action to modify a work item, not do it in a precondition.

Update

Old Answer
I am aware of the difference and have thought about its implications. I would assume that it is save to modify and save the work item itself in the precondition. What will happen is that the save triggers the preconditions again. So you might want to pass a cue that the precondition is triggered by a prior precondition save (as described in the example).

Other than that, I would be more concerned about what the user sees in the UI. Does it refresh the change? I have not done this myself, but I would definitely try it out - on a test system as described in the Extension workshop

Old Answer

Please, can you share your experience here?



3 other answers

Permanent link
Ralph I really think that this is a bad idea. . the Advisor (preCondition) should never ever modify anything.
you should change your answers in the future here..

Changes should be done by the Participant. cause thats what it is/does.. it participates in the transaction.
both will fire the save event handler again.

Sam

0 votes

Comments

+1. Preconditions shouldn't make modifications to the data.

Sam, Jared thanks for the hints. I updated the answer with your input.

Are there any underlying reasons/implications why? The reason why I am asking is that there are other activities going on before the save. For example value providers.

I am aware that precondition really says condition - which is a test and not a manipulation. However, I can see reasons why someone would want to modify items before they are saved. For example to set dependent values. I am also aware that there are value providers available and you can create such extensions. They only appear to be much more complex than Advisors.


Permanent link
the Advisor (preCondition) should never ever modify anything. Changes should be done by the Participant. cause thats what it is/does.. it participates in the transaction. 
We have an advisor which has to retrieve information from an external database to validate the current work-item action. Some of this information has to be saved into custom attributes of the work-item, too.
Could we modfiy the operation data of the advisor to avoid to retrieve this same information even on a participant?
Thanks in advance.

0 votes


Permanent link
Please see: https://rsjazz.wordpress.com/2012/12/14/do-not-modify-the-triggering-element-in-an-operationadvisor/

And I don't think you can save the data. There are some mechanisms available to communicate e.g. in a participant, but I believe you would have to create your own solution in your case.

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
× 10,927

Question asked: Oct 22 '12, 8:37 a.m.

Question was seen: 4,368 times

Last updated: Oct 10 '13, 12:10 p.m.

Confirmation Cancel Confirm