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);
// 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
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:
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);