It's all about the answers!

Ask a question

Is it possible to check Related -> Type in Java API?


0
1
Karthik Krishnan (8594101152) | asked May 14 '13, 7:04 a.m.
edited May 15 '13, 3:12 a.m.
 I am trying to build the following filter (Query building) using Plain Java API 

Type: Defect AND Related (Link) -> Type is: Task AND Defect Status is UnResolved

I am able to do this in Web client. Just that I am not sure how to get the "Related" link's type using API

Edit: I need to build the below using Expressions in Plain Java API. Is this possible?
Query filters

Comments
Millard Ellingsworth commented May 14 '13, 6:55 p.m.
FORUM ADMINISTRATOR / JAZZ DEVELOPER

Have you looked at this blog post from Ralph about working with the Work Item Linking API?


Karthik Krishnan commented May 15 '13, 3:07 a.m.

Yes, but I am looking for how to build  "Related" Links in query filter using Plain Java API 






Karthik Krishnan commented May 15 '13, 11:35 a.m. | edited May 15 '13, 12:04 p.m.

 anyone?


Karthik Krishnan commented May 18 '13, 1:23 a.m.

Is this possible at all using API's?  Reason is I cannot achieve this using Eclipse client where as it's possible using web client 


Karthik Krishnan commented May 23 '13, 10:04 a.m.

Hello Ralph Schoon  


Would you be able to be help me here?


1
Ralph Schoon commented May 23 '13, 11:16 a.m. | edited May 23 '13, 11:18 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I would suggest - like Millard - to start with my blog. Start here: https://rsjazz.wordpress.com/2013/02/28/setting-up-rational-team-concert-for-api-development/

The blog contains articles about server and client link API's and also how to programmatic create and use queries, if you want that. If you can do it with the WebUI normal query mechanism you could do it using the API. See: http://rsjazz.wordpress.com/2012/10/29/using-work-item-queris-for-automation/

If the Eclipse and the Web UI behave differently, this is a defect you should report.

Dependant on what you want to do, you can do more with the API e.g. investigate the data in work items, look at links etc. See for example https://rsjazz.wordpress.com/2012/09/19/the-rtc-workitem-link-api-linking-workitems-to-other-elements/ or https://rsjazz.wordpress.com/2012/09/20/the-rtc-workitem-server-link-api-linking-to-work-items-and-other-elements/

showing 5 of 6 show 1 more comments

One answer



permanent link
praveen patidar (8613044) | answered May 14 '13, 8:25 p.m.

Hello ,

I am not sure about the API type(Server side or client side.). I am providing you for client side API to get Related artifact. If you want server side as well let me know.

List<IReference> relatedRefs = workItemClient.resolveWorkItemReferences(
    retrofitWI, null).getReferences(WorkItemEndPoints.RELATED_WORK_ITEM);
  for (IReference relatedRef : relatedRefs) {
   if (relatedRef.resolve() instanceof IWorkItemHandle){
    IWorkItem relatedWI= auditableClient.resolveAuditable((IWorkItemHandle) relatedRef.resolve(),IWorkItem.FULL_PROFILE, null);

String stateName = WorkflowUtilities.findWorkflowInfo(
        relatedWI, null).getStateName(relatedWI.getState2());
       System.out.println("Type  "+relatedWI.getWorkItemType());

       System.out.println("State Name  "+stateName);

}

}


Comments
Karthik Krishnan commented May 15 '13, 3:13 a.m.

Thanks for this but I want to have this in the Filter condition of  a query. I've edited my post with a screenshot. Please check that 

Your answer


Register or to post your answer.