It's all about the answers!

Ask a question

Fetching snapshot from BuildResult


Kelvin Lui (51299) | asked Dec 19 '12, 4:11 p.m.
edited Mar 28 '18, 12:09 p.m. by David Lafreniere (4.8k7)

 In RTC client someone could download the snapshot generated by the Build in the BuildResult page (there is a link to lead you to the snapshot).


I checked the IBuildResult class but couldn't find out any API associated with the snapshot.  Could someone show me the API to be used to fetch the snapshot created by specific Build?

Thanks

Accepted answer


permanent link
David Lafreniere (4.8k7) | answered Mar 28 '18, 12:12 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
edited Mar 28 '18, 12:15 p.m.

Here is how you retrieve the snapshot (IBaselineSetHandle) associated with a build result using the client-side Java API. (Note: I am assuming you already know the code used to fetch the full IBaselineSet from the IBaselineSetHandle):

   ...
   IBuildResultHandle buildResultHandle = getBuildResultHandle(); // This can be 'any' build result or 'release'
   IBaselineSetHandle snapshotHandle = null;
   ITeamBuildClient client = (ITeamBuildClient) getRepository().getClientLibrary(ITeamBuildClient.class);
   IBuildResultContribution[] contribution = client.getBuildResultContributions(buildResultHandle ,
      new String[] { ScmConstants.EXTENDED_DATA_TYPE_ID_BUILD_SNAPSHOT }, monitor);

   if (contribution.length > 0) { // It's possible for a build to NOT have a snapshot contribution
      snapshotHandle = (IBaselineSetHandle) contribution[0].getExtendedContribution();
   }
   ...

Ralph Schoon selected this answer as the correct answer

2 other answers



permanent link
Ralph Schoon (63.6k33646) | answered Dec 19 '12, 6:16 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
 It is very unclear what you are trying to do here is a hint on the API, however https://jazz.net/library/article/807  Robins blog also mentions some interesting insight into the API http://ryehle.wordpress.com/ .

Comments
Kelvin Lui commented Dec 19 '12, 11:41 p.m. | edited Mar 28 '18, 12:09 p.m.

 Thanks Ralph,  I have reviewed https://jazz.net/library/article/807  but couldn't find any luck.


As far as I know when the build is complete a snapshot will be generated automatically and link to the build.

If someone search the build in RTC client, they can find the link to get this snapshot in the Overview tab -> Contribution Summary section.

I would like to find out the logic (api) how to fetch this snapshot associated with the specific build.

Hope that clarifies. 

Thanks.


permanent link
Stefan Sauterleute (2815) | answered Feb 22 '18, 10:14 a.m.
I would like to reactivate this question:

Is there any opportunity to fetch a snapshot from a release via java plain api?


Comments
Ralph Schoon commented Feb 23 '18, 3:26 a.m. | edited Mar 28 '18, 12:09 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

It does not make sense to "reactivate" a 6 years old question. Anyway, if the release was created from a build you can open the build result from the release in the Eclipse client and from the build result you can get at the snapshot, It is available in the Eclipse client, so the likelihood to be able to do this using the plain java API is pretty high. It might use internal API. I have no example code.

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.