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.
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.
Accepted answer
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());
}
}
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());
}
}
Comments
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Jun 18 '14, 4:30 a.m.I don't think the answer is in there, but maybe some hints are: https://jazz.net/library/article/807
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Jun 18 '14, 4:32 a.m.This kind of data is often stored in some kind of 'contribution' that you can somehow access and retrieve.
Alix Pickerill
Jun 18 '14, 4:38 a.m.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.
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Jun 18 '14, 4:47 a.m.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.