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
|
Accepted answer
Ralph Schoon (63.4k●3●36●46)
| answered Oct 22 '12, 9:49 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Oct 22 '12, 9:49 a.m.
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
Comments
John Kelly
commented Oct 22 '12, 10:08 a.m.
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...
John
thanks again
Ralph Schoon
commented Oct 22 '12, 10:16 a.m.
| edited Oct 23 '12, 2:15 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi John,
|
3 other answers
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 Comments +1. Preconditions shouldn't make modifications to the data.
Ralph Schoon
commented Oct 23 '12, 2:19 a.m.
| edited Oct 23 '12, 2:19 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Sam, Jared thanks for the hints. I updated the answer with your input.
|
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.
|
Ralph Schoon (63.4k●3●36●46)
| answered Oct 10 '13, 12:10 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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. |
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.