Can a follow-up action swallow a precondition failure?
Hi,
I've written many preconditions and follow-up actions for work items in STG. I have a case where a follow-up action should fail silently if a precondition failed during it's follow-up save. Is this possible? In the follow-up action, IWorkItemServer#saveWorkItem2() throws an exception because a precondition failed. I catch that exception and handle it accordingly, however the entire transaction is still rolled back! Is there a way that my follow-up action can remove the precondition failure from the collector so that the user's original changes can persist? This is very urgent and may block a big deployment internally. Please help as soon as possible. Thanks, Kyle Christianson STG Rational Solutions |
4 answers
Jared Burns (4.5k●2●9)
| answered Apr 12 '11, 1:20 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Hi, If a precondition fails, the operation cannot proceed and the entire transaction is rolled back. This is the expected behavior and cannot be circumvented. If you want your operation to proceed even when the precondition fails, then it isn't really a precondition. - Jared |
Hi Jared, thanks for the reply.
The problem is there are multiple save actions with the follow-up actions. The first preconditions from the user's save changes all succeed, so we want these changes to persist. Then we are doing follow-up actions which save the work item again and run the preconditions again. If these preconditions fail, yes we want that follow-up save to fail, but we still need the original user's changes to persist because their preconditions succeeded. Is there a way I can "advise" the save operation before actually performing the save to see if any preconditions are going to fail? Thanks, Kyle Christianson STG Rational Solutions |
Hi Kyle,
Have you looked at the IServerProcess#advise method? This computes the advice and will re-throw any exceptions the advisors throw. Martha Jazz Developer, Process Component Hi Jared, thanks for the reply. |
Hi Martha,
The advise method sounds like exactly what I need. However how do I get an AdvisableOperation object for the next save? I've been digging in the internal APIs and think I need to construct a WorkItemProcessAreaOperation, but I don't know how to get the correct parameters to pass to the constructor. Any help would be greatly appreciated. Thanks, Kyle Christianson STG Rational Solutions |
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.