How Can I get childworkitems ,its type and current state from references.
- I can get type and current state of the parent workitem.
- I want to fetch its child workitems and its type and its current state.
- and want to put condition by checking the states of parent and child.
- I used operation advisor for this.
-
(I referred other forums too ,which are related to the child workitems but didn't t get help. )
I got the child references. I tried following code.
Object data = operation.getOperationData(); // The action is save if (data instanceof ISaveParameter)
{ // Get state of auditable item
ISaveParameter saveParameter = (ISaveParameter) data; IAuditable auditable = saveParameter.getNewState();
// If everything is correct, the auditable is an WorkItem if (auditable instanceof IWorkItem)
{ IWorkItem parentWorkItem = (IWorkItem) auditable; //Getting WorkItem service
IWorkItemServer workItemServer = getService(IWorkItemServer.class);
IWorkItemReferences references = workItemServer.resolveWorkItemReferences(parentWorkItem, null);
List<IReference> listChildReferences = references.getReferences(WorkItemEndPoints.CHILD_WORK_ITEMS);
for (Iterator iterator = listChildReferences.iterator(); iterator .hasNext();
{ IReference childReference = (IReference) iterator.next();
ILink link = childReference.getLink();
Please give me your valuable suggestion to achieve my task.
Accepted answer
Kaushik,
I would suggest to read https://jazz.net/library/article/1000 carefully and maybe http://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/ because it talks about similar items.
You need to use this.getService() to get services in participants and advisors.
IRepositoryItemService reposervice = getService(IRepositoryItemService.class);
Should get it. You probably have to add it to the prerequisites in the plugin.xml too. See the post mentioned above to understand what a prerequisite is.
I would suggest to read https://jazz.net/library/article/1000 carefully and maybe http://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/ because it talks about similar items.
You need to use this.getService() to get services in participants and advisors.
IRepositoryItemService reposervice = getService(IRepositoryItemService.class);
Should get it. You probably have to add it to the prerequisites in the plugin.xml too. See the post mentioned above to understand what a prerequisite is.
One other answer
IWorkItemHandle ChildWIHandle = (IWorkItemHandle) childReference
.resolve();
if(ChildWIHandle != null){
ChildWorkItem = (IWorkItem) repositoryItemService.fetchItem(ChildWIHandle ,IRepositoryItemService.COMPLETE);
}
With this Child Workitem, you can get the Type and ID details.
Comments
Hi Muthukumar
Its very Helpful.
can you give me some details like....
In above code
What exactly I am getting in
"ChildWIHandle
" and
in "ChildWorkItem"
?
what is the type of
"ChildWorkItem".
Also am not getting "repositoryItemService" .
ERROR is "Cannot make a static reference to the non-static method fetchItem(IItemHandle, String[]) from the type RepositoryItemService"