Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

RTC Plain Java API - Find BuildResult id based on ChangeSet id or WorkItem id

I'm using the RTC's Plain Java API.

In my program, I have a list of WorkItems and their associated ChangeSets.

I need to check if each ChangeSet was successfully built.

Each ChangeSet can be found in multiple BuildResults.

Is there a way to query for the associated BuildResults (and retrieve their ids) based on WorkItem Id or (preferably) ChangeSet Id?

In the web version of RTC, I can view "Included in Builds" for each work Item. How can I grab that list using the Plain Java API?

0 votes


Accepted answer

Permanent link
That is likely not trivial. 

You could look into the Locate Change Set (Search>Jazz Source control) implementation in the RTC Eclipse Client using the SDK, to try to find out how it could be done.

The Included in builds is just another link type. See https://rsjazz.wordpress.com/2012/09/19/the-rtc-workitem-link-api-linking-workitems-to-other-elements/ for the link API. https://rsjazz.wordpress.com/2017/03/29/the-work-item-command-line-is-now-open-source/ also has examples for how to use link aPI.


Annie Steenson selected this answer as the correct answer

0 votes

Comments

Hi Ralph,

How can I grab the links attached to a BuildResult?

I'm not able to use

// get all references from the work item workingcopy
IWorkItemReferences references = workingCopy.getReferences();

or

IWorkItemCommon common= (IWorkItemCommon) ((ITeamRepository)workItem.getOrigin()).getClientLibrary(IWorkItemCommon.class); IWorkItemReferences references = common.resolveWorkItemReferences(workItem, null);
because..

IItem buildResultWorkingCopy = buildResult.getWorkingCopy();

and

(buildResultWorkingCopy instanceof IWorkItem) returns false.

I need to be able to grab the URI References to corresponding Jenkins build.
I also need to be able to grab the WorkItem References to the ChangeSets found in the BuildResult

Please look into the last link I posted in my answer, download and look at the code. 

If you have additional needs for that API, look into the links at the end of the blog post. 

The key here is IBuildResultContribution

Please note that the IBuildResultContributions only contain URLs that are stored in the build result. The work items and change sets that you see in the build result editor for a build result of public builds are calculated using the SCM snapshot/baseline. 


One other answer

Permanent link

Just to record solution for getting work item from buildResult use WorkItemHelper static method getFixedInBuild.


IWorkItemHandle[] workItemHandles = WorkItemHelper.getFixedInBuild(teamRepository, buildResult, monitor);

0 votes

Your answer

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

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,934
× 411
× 169

Question asked: May 04 '17, 4:35 p.m.

Question was seen: 4,366 times

Last updated: Dec 10 '18, 7:39 a.m.

Confirmation Cancel Confirm