It's all about the answers!

Ask a question

Get all work items included in a personal build


Wendy Raschke (30111) | asked Feb 25 '16, 10:36 p.m.
edited Feb 26 '16, 10:34 a.m. by Ralph Schoon (63.5k33646)
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:

    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



permanent link
Sridevi Sangaiah (59179) | answered Feb 25 '16, 11:52 p.m.
JAZZ DEVELOPER
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

Comments
Wendy Raschke commented Feb 26 '16, 8:58 a.m. | edited Feb 26 '16, 9:25 a.m.

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.


Ralph Schoon commented Feb 26 '16, 10:41 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.

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.