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

How can I get the build properties from the build result using the Java api?

Hi,

I would like to get the properties for a build result in RTC, not the properties from the build definition but the properties from the actual result.

It is easy for a human to do in the eclipse client as it is a tab in the build result, but I can't work out how to do it using the java api, I have a IBuildResult how do I get to the properties (probably IBuildProperty)?

Any help would be much appreciated,
Thanks.

0 votes

Comments

I don't think the answer is in there, but maybe some hints are: https://jazz.net/library/article/807

This kind of data is often stored in some kind of 'contribution' that you can somehow access and retrieve.

Thanks for the link but I have already looked in there and not found the missing link, I will have another look.

I am already using a 'contribution' for getting the snapshot of the build result but I couldn't tell if 'contribution' would give me properties.

Sorry, haven't tried that myself. Maybe these answers can give you more ideas?

https://jazz.net/forum/questions/152703/how-to-upload-junit-results-to-build-through-java-api
https://jazz.net/forum/questions/70750/programatically-modify-build-result

The way I would approach this, is to use the Plain Java API and look at existing build results and into the contributions that are attached, to figure out where the data is and potentially to access it.

Sorry again, but this is my best advice currently.


Accepted answer

Permanent link
Solved the problem by getting the build definition instance.
IBuildResult -> IBuildRequestHandle -> IBuildRequest -> IBuildDefinitionInstance -> IBuildProperty

E.g.
IBuildResult result = ...
List<IBuildRequestHandle> requests = result.getBuildRequests();
                  for (IBuildRequestHandle handle : requests)
                  {
                      IBuildRequest buildRequest = (IBuildRequest) repo.itemManager().fetchCompleteItem(handle, ItemManager.REFRESH, monitor);
                      List<IBuildProperty> properties = buildRequest.getBuildDefinitionInstance().getProperties();
                      for (IBuildProperty property : properties)
                      {
                          System.out.println("Property " + property.getName());
                          System.out.println("Value " + property.getValue());
                      }
                  }
Ralph Schoon selected this answer as the correct answer

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

Question asked: Jun 18 '14, 4:20 a.m.

Question was seen: 3,116 times

Last updated: Jun 18 '14, 12:27 p.m.

Confirmation Cancel Confirm