It's all about the answers!

Ask a question

Can a follow-up action swallow a precondition failure?


Kyle Christianson (1261615) | asked Apr 11 '11, 6:22 p.m.
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



permanent link
Jared Burns (4.5k29) | answered Apr 12 '11, 1:20 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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


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

permanent link
Kyle Christianson (1261615) | answered Apr 12 '11, 10:55 p.m.
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

permanent link
Martha (Ruby) Andrews (3.0k44351) | answered Apr 13 '11, 12:34 p.m.
JAZZ DEVELOPER
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.

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

permanent link
Kyle Christianson (1261615) | answered Apr 14 '11, 7:28 p.m.
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


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.