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

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

0 votes



4 answers

Permanent link
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

0 votes


Permanent link
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

0 votes


Permanent link
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

0 votes


Permanent link
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

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: Apr 11 '11, 6:22 p.m.

Question was seen: 5,645 times

Last updated: Apr 11 '11, 6:22 p.m.

Confirmation Cancel Confirm