It's all about the answers!

Ask a question

How to get Owner of a Build Definition from RTC side via RTC API


han huynh (19314) | asked Mar 01 '16, 4:19 a.m.
Dear RTC team,

Currently I have concern on the way to get Owner of a Build Definition from RTC side via RTC API.
Could you please help?

Thank in advance!

Comments
han huynh commented Mar 01 '16, 11:28 p.m. | edited Mar 03 '16, 1:46 a.m.

Thanks Ralph Schoon and Rafael Rezende for your answers.
I can pull the Process Area and the build definitions from RTC via API, but unfortunately I don't still see OWNER of the build definition or the project area.

Should the RTC team provide us the way to get the build owner?

Thanks for your support.


Ralph Schoon commented Mar 02 '16, 12:18 a.m. | edited Mar 03 '16, 1:46 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

As already stated:

As far as I  know there is no Owner for an com.ibm.team.build.common.model.IBuildDefinition There is a project or Team Area property defined by the property PROPERTY_PROCESS_AREA.


I am not aware of the concept of an owner for a build definition other than it is in a project area. So please provide us with a useful description what the owner of a build definition should be and where we should be able to see it in the RTC UI. If you can't show it in the UI, it is likely not there at all.

2 answers



permanent link
Ralph Schoon (63.6k33646) | answered Mar 01 '16, 10:47 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
As far as I  know there s no Owner for an com.ibm.team.build.common.model.IBuildDefinition
There is a project or Team Area property defined by the property PROPERTY_PROCESS_AREA.

permanent link
Rafael Rezende (431823) | answered Mar 01 '16, 10:49 a.m.
edited Mar 02 '16, 11:04 a.m.
From the IBuildDefinition it is possible to get the IProcessAreaHandle directly, which is a superinterface of both IProjectAreaHandle and ITeamAreaHandle.

The example below is complete and will print the unique UUID of the Process Area. The same you would see in the Project/Team Area URI.
public class Main {
  public static void main(String[] args) {

    IProgressMonitor myProgressMonitor = new NullProgressMonitor();
    final String userId = "abc0de";
final String password = "********";
String repoUri = "https://server.com/ccm/";
TeamPlatform.startup();
try { ITeamRepository repo = TeamPlatform.getTeamRepositoryService().getTeamRepository(repoUri); repo.registerLoginHandler(new ILoginHandler2() {
@Override public ILoginInfo2 challenge(ITeamRepository repo) {
return new UsernameAndPasswordLoginInfo(userId, password);
}
});
repo.login(myProgressMonitor);

/* Use the repo to get the build client library */ ITeamBuildClient buildClient = (ITeamBuildClient) repo.getClientLibrary(ITeamBuildClient.class); /* Get the build definition for "My Build Definition" */ IBuildDefinition definition = buildClient.getBuildDefinition("My Build Definition", myProgressMonitor);
IProcessAreaHandle processAreaHandle = definition.getProcessArea();
System.out.println(processAreaHandle.getItemId());
repo.logout();
}
catch (TeamRepositoryException e) {e.printStackTrace();}
finally {
TeamPlatform.shutdown();
}
}
}
Hope it helps!

Edit:
As Ralph Schoon mentioned, you cannot assign a USER as owner of a Build Definition. Instead, you can set an area (Project Area or Team Area) where it's visible and its users are allowed to modify/delete it based on roles and privileges assigned.
In RTC, some elements can be assigned to users and project/team areas (i.e. Components), only users (i.e. Repository Workspace) or only project/team areas (i.e. Streams).

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.