How to get Affected By Defect in Java API
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
How can i fetch the logs details, Thanks for help!!
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();
}
}
}
Accepted answer
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.
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.
Comments
Jayshri Burde
Nov 15 '17, 8:06 a.m.