Get all work items included in a personal build
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
Thanks,
Sridevi
Comments
Okay, thank you for telling me once and for all so I don't keep beating my head against my keyboard!
How about the IWorkspace or IWorkspaceHandle representing the workspace used in the build? Is there a way to get work items checked in to that? I have the 4.0.5 client API Java docs (https://jazz.net/downloads/rational-team-concert/releases/4.0.5/RTC-Client-plainJavaLib-API-javadoc-4.0.5.zip) and I find that a lot of those are sparsely documented.
Personal builds can't be used in this context, basically since the build user can NOT usually create a snapshot or baseline. The build user basically does not have the permission to do so.
As far as I can tell, the information you are looking fore is also not stored in the build. All the build result, I think, stores is the snapshot created for the public build. You can compare build results, which basically compares the snapshots/baselines and shows you the changes and work items involved.
The API documentation could be improved, and probably always will. Please see https://rsjazz.wordpress.com/2015/09/30/learning-to-fly-getting-started-with-the-rtc-java-apis/ for how to use the SDK to look at the APIs for examples. Also search fr example API usage on that blog.