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

Set workItem attribs in server side follow-up condition

I am creating a follow-up / post condition which retrieves the child work item links from a parent work item. The code should traverse the child work items setting the workflow state to the same as the parent. After setting the childWorkItem.setState2(parentState), an Immutable Property Exception is thrown. This is a server-side code module extension. I am thinking I need to have a working copy of the work item to perform the update. However, I'm not sure how to establish a workingCopy in the server side code. Here is a code snippet:

// Access Repository Service
IRepositoryItemService repositoryItemService = getService(IRepositoryItemService.class);

// Get Parent state
Identifier<IState> parentState = rootWorkItem.getState2();

////........ some code .......

// Establish the child work item object
IWorkItem childWorkItem = (IWorkItem) repositoryItemService.fetchItem(childHandle,IRepositoryItemService.COMPLETE);

// Get Child State
Identifier<IState> childState = childWorkItem.getState2();

// Compare parent and child state here

// Set child state = parent
childWorkItem.setState2(parentState);

0 votes



2 answers

Permanent link
IWorkItem implements IItem, which has a method getWorkingCopy(). To get
a working copy for a workitem you could do something like:

IWorkItem item = <get>
IWorkItem workingCopy = (IWorkingCopy)item.getWorkingCopy().

-
Matt Lavin
Jazz Server Team


On Tue, 2008-11-04 at 16:27 +0000, bcope wrote:
I am creating a follow-up / post condition which retrieves the child
work item links from a parent work item. The code should traverse the
child work items setting the workflow state to the same as the parent.
After setting the childWorkItem.setState2(parentState), an Immutable
Property Exception is thrown. This is a server-side code module
extension. I am thinking I need to have a working copy of the work
item to perform the update. However, I'm not sure how to establish a
workingCopy in the server side code. Here is a code snippet:

// Access Repository Service
IRepositoryItemService repositoryItemService =
getService(IRepositoryItemService.class);

// Get Parent state
Identifier<IState> parentState = rootWorkItem.getState2();

////........ some code .......

// Establish the child work item object
IWorkItem childWorkItem = (IWorkItem)
repositoryItemService.fetchItem(childHandle,IRepositoryItemService.COMPLETE);

// Get Child State
Identifier<IState> childState = childWorkItem.getState2();

// Compare parent and child state here

// Set child state = parent
childWorkItem.setState2(parentState);

0 votes


Permanent link
Alternate for setState2() for server side precondition as it is deprecated now.

Thanks
Megha

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,937

Question asked: Nov 04 '08, 11:20 a.m.

Question was seen: 5,945 times

Last updated: Nov 04 '08, 11:20 a.m.

Confirmation Cancel Confirm