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

How Can I get childworkitems ,its type and current state from references.

  1. I can get type and current state of the parent workitem.
  2. I want to fetch its child workitems and its type and its current state.
  3. and want to put condition by checking the states of parent and child.
  4. I used operation advisor for this.
  5. (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. 

0 votes


Accepted answer

Permanent link
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.
Kaushik Bhalerao selected this answer as the correct answer

0 votes

Comments

Thanks Ralph.
Second Link is very Useful.


One other answer

Permanent link

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.

1 vote

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"


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: Nov 19 '12, 1:56 a.m.

Question was seen: 4,065 times

Last updated: Nov 20 '12, 7:39 a.m.

Confirmation Cancel Confirm