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

RTC Plain Java API: Build Definition ID from Build Definition Handle

Hi,

How do I get to the Build Definition ID (or object) from the Build Definition Handle?  I'm using the Plain Java API (4.0.2) to generate a list of build definitions from queries based on labels and tags.  After the query, I have the following code:
String[] properties = new String[] { IBuildResult.PROPERTY_LABEL, IBuildResult.PROPERTY_TAGS, IBuildResult.PROPERTY_BUILD_DEFINITION};
List buildResults = teamRepository.itemManager().fetchPartialItems(queryPage.getItemHandles(), IItemManager.DEFAULT, Arrays.asList(properties), monitor);
buildResults.getTags() and buildResults.getLabel() both return strings, but when I use buildResults.getBuildDefinition(), I get the handle and can't find a way to access the Build Definition ID (or the object, for that matter) from that handle.

Thanks in advance.

0 votes


Accepted answer

Permanent link
when u have  handle to an object, you need to use some repository service to compose the full object

in one of my utilities I do
private static ITeamRepository Server = TeamPlatform.getTeamRepositoryService().getTeamRepository(Properties.get(ServerURL));
private static IAuditableClient auditableClient = null;

logon

auditableClient = (IAuditableClient) Server.getClientLibrary(IAuditableClient.class);
IBuildDefinitionHandle bdh;

IBuildDefinition bd = (IBuildDefinition)auditableClient.fetchCurrentAuditable(bdh, ItemProfile.createFullProfile(IBuildDefinition.ITEM_TYPE), null);

you can pass a set of properties to be loaded instead of just FULL. with ItemProfile.createProfile()
when u only need 1 or two properties
E Muehl selected this answer as the correct answer

0 votes

Comments

Works like a charm.  Thanks very much.  Being a relative newbie to the RTC object model, is there a place inside or outside of jazz.net where all of these interrelationships are documented and explained from a high-level viewpoint?

I have never seen information like this.

OK.  Thanks again for your help.

that is why I create samples.. and why Ralph has such a good blog
https://rsjazz.wordpress.com/

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,941

Question asked: Aug 24 '14, 9:19 p.m.

Question was seen: 4,295 times

Last updated: Aug 25 '14, 12:05 p.m.

Confirmation Cancel Confirm