It's all about the answers!

Ask a question

How to get Affected By Defect in Java API


1
1
Pankaj Sharma (401170) | asked Jan 27 '16, 10:42 a.m.
edited Jan 27 '16, 11:08 a.m.
 Hello Team,

I am trying to get the list of Affected By Defect logs using Java API, Though there is no direct parameter for Affected By Defect in WorkItemEndPoints
I am using the following code, but isItemReference() is not returning true


for(IReference ir: ((ISaveParameter) data).getNewReferences().getReferences(ILinkTypeRegistry.INSTANCE.getLinkType(WorkItemLinkTypes.AFFECTED_BY_DEFECT).getTargetEndPointDescriptor()))
{
if(ir.isItemReference())
{
IWorkItem r;
try {
r = iac.resolveAuditable((IWorkItemHandle)ir.resolve(),IWorkItem.FULL_PROFILE, null);
WorkflowInfo y =wfm.getWorkflowInfo(r, monitor);
String targetWItype = r.getWorkItemType();
String targetStateName = y.getStateName(r.getState2());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
How can i fetch the logs details, Thanks for help!!

Comments
Jayshri Burde commented Jul 05 '17, 2:36 a.m. | edited Nov 15 '17, 8:06 a.m.

 Hello Pankaj

My requirement is same as your.
Any luck on this?
Thanks in Advance!

Accepted answer


permanent link
Ralph Schoon (63.4k33646) | answered Jan 27 '16, 11:13 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Because it is not a WorkItem to Work Item Link and it is likely not an ItemReference either.

The link type should be com.ibm.team.workitem.common.model.WorkItemLinkTypes.AFFECTED_BY_DEFECT
and the endpoint should be ILinkTypeRegistry.INSTANCE.getLinkType(
                            WorkItemLinkTypes.AFFECTED_BY_DEFECT)
                            .getTargetEndPointDescriptor());

You will get an URI and will have to use REST/OSLC to access the details.
Ralph Schoon selected this answer as the correct answer

Comments
Pankaj Sharma commented Jan 28 '16, 7:49 a.m.

Hello Ralph,

Thanks for the suggestion.

Is there any sample code to use REST/OSLC?

Thanks.


Ralph Schoon commented Jan 28 '16, 8:07 a.m. | edited Jan 28 '16, 8:07 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I am not an OSLC guy, there have ben numerous answers on this forum, so it might be beneficial to search. Also the RTC server uses REST/OSLC, so it might be an idea to search how it does that in the source. Tedios, I know, but that would be my first approach. Maybe als interesting: https://jazz.net/forum/questions/214885/use-current-user-session-to-login-another-project-through-rtc-plugin/215303 maybe these internal interfaces provide a hint?

Your answer


Register or 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.