It's all about the answers!

Ask a question

Set workItem attribs in server side follow-up condition


Billy Cope (651) | asked Nov 04 '08, 11:20 a.m.
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);

2 answers



permanent link
Matt Lavin (2.7k2) | answered Nov 04 '08, 1:08 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
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);

permanent link
megha mittal (15112615) | answered Feb 11 '11, 7:42 a.m.
Alternate for setState2() for server side precondition as it is deprecated now.

Thanks
Megha

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.