Is it possible to check Related -> Type in Java API?
One answer
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
Millard Ellingsworth
FORUM ADMINISTRATOR / JAZZ DEVELOPER May 14 '13, 6:55 p.m.Have you looked at this blog post from Ralph about working with the Work Item Linking API?
Karthik Krishnan
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
May 15 '13, 12:04 p.m.anyone?
Karthik Krishnan
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
May 23 '13, 10:04 a.m.Hello Ralph Schoon
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER May 23 '13, 11:18 a.m.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/
1 vote