Get all work items included in a personal build
Hello. From an IBuildResultHandle I want to find all the work items checked into the workspace used in a personal build. I have found questions at
https://jazz.net/forum/questions/44127/finding-workitem-from-buildresult
and
https://jazz.net/forum/questions/112660/how-to-get-changes-out-of-build-api
that mention using the com.ibm.team.build.internal.client.workitem.WorkItemHelper class. However, I have called this API's getFixedInBuild() and getIncludedWorkItems() methods, and I always get an empty list, using an IBuildResultHandle representing a personal build using a workspace that I know has outgoing change sets.
I don't think getLinkedWorkItems() and getReportedWorkItems() are what I want. I am not looking for work items linked to the build nor those reported against the build.
This doesn't strike me as anything too tricky to do. Maybe I am missing something! I realize internal classes can change anytime--so that's why I also tried the code that Nick Edgar excerpted:
But that doesn't work either. :(
https://jazz.net/forum/questions/44127/finding-workitem-from-buildresult
and
https://jazz.net/forum/questions/112660/how-to-get-changes-out-of-build-api
that mention using the com.ibm.team.build.internal.client.workitem.WorkItemHelper class. However, I have called this API's getFixedInBuild() and getIncludedWorkItems() methods, and I always get an empty list, using an IBuildResultHandle representing a personal build using a workspace that I know has outgoing change sets.
I don't think getLinkedWorkItems() and getReportedWorkItems() are what I want. I am not looking for work items linked to the build nor those reported against the build.
This doesn't strike me as anything too tricky to do. Maybe I am missing something! I realize internal classes can change anytime--so that's why I also tried the code that Nick Edgar excerpted:
public static IWorkItemHandle[] getFixedInBuild(ITeamRepository teamRepository,
IBuildResultHandle buildResultHandle, IProgressMonitor monitor) throws TeamRepositoryException {
ValidationHelper.validateNotNull("teamRepository", teamRepository); //$NON-NLS-1$
ValidationHelper.validateNotNull("buildResultHandle", buildResultHandle); //$NON-NLS-1$
List workItemHandles = new ArrayList();
SubMonitor subMonitor = SubMonitor.convert(monitor, 2);
IBuildResultContribution[] buildResultContributions = ClientFactory.getTeamBuildClient(teamRepository).getBuildResultContributions(
buildResultHandle, WorkItemConstants.EXTENDED_DATA_TYPE_ID, subMonitor.newChild(1));
subMonitor.setWorkRemaining(buildResultContributions.length);
for (IBuildResultContribution contribution : buildResultContributions) {
IContent content = contribution.getExtendedContributionData();
if (content != null) {
String[] workItemHandleIds = ContentUtil.contentToStringArray(teamRepository, content,
EXTENDED_DATA_DELIMITER, subMonitor.newChild(1));
for (int i = 0; i < workItemHandleIds.length; i++) {
workItemHandles.add(IWorkItem.ITEM_TYPE.createItemHandle(UUID.valueOf(workItemHandleIds[i]), null));
}
}
}
return (IWorkItemHandle[]) workItemHandles.toArray(new IWorkItemHandle[workItemHandles.size()]);
}
But that doesn't work either. :(
One answer
I doubt if the IBuildResultHandle for personal builds would ever have the reference to changes included in the build. Personal builds just build the current configuration of the workspace and doesn't have the notion of updating the workspace from a flow target like a stream, by which we could determine the changes/work items included in the build.
Thanks,
Sridevi
Thanks,
Sridevi