It's all about the answers!

Ask a question

Unable to create project Area using customized process template using RTC JAVA API


swapna das (3324572) | asked Nov 12 '15, 1:18 a.m.
 Hi Team,
   I want to create a Project Area using our customized process template using RTC API.
I am able to  create the project area using OOTB templates but it fails to create the project area while I used my customized process templates .By using RTC API  I am  able to fetch the all the process templates (OOTB + Customized).
And I want to add 'n' number of users to the project and team area programmatically. I am able to add only one user with whose id I logged into the tool.
Please help me on this.

Thanks,
Swapna Das

2 answers



permanent link
Ralph Schoon (63.1k33646) | answered Nov 12 '15, 2:29 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I would suggest to look at snippet3 in the plain Java client libraries for the basics. In addition see https://rsjazz.wordpress.com/2013/09/18/deploying-templates-and-creating-projects-using-the-plain-java-clients-library/

I assume that the project area needs to be initialized and saved with the user that runs the script being part of the administrators, before additional users can be added, but I could be wrong. There are also unit tests shipped with the SDK where you can have a look, which add multiple users.

If you need more help, come up with a decent description of the error you see.

Comments
swapna das commented May 09 '16, 4:17 a.m.

Hi Ralph,  

   By referring snippet3 , I am able to add only one user with whose id I logged into the tool to the newly created project Area. But I want to add "n" number of users to the team area at a time . can you please help me on the same ?

Thanks,

Swapna Das 


Ralph Schoon commented May 09 '16, 5:16 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 Note that some of the parameters are arrays so you could add more than one object.


permanent link
Ralph Schoon (63.1k33646) | answered May 09 '16, 5:13 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
 I have always found that in programming, if you can do it for one object, you can do it for many.

Here the full code for a small utility method that adds one user with a role to a process area. By using this repeatedly you should succeed.

/**
* Adds a user as a member with a specific role to a process area
* @param user
* @param role
* @param processArea
* @param itemService
* @param monitor
* @throws TeamRepositoryException
*/
public static void addMemberToProcessArea(IContributor user, IRole role,
IProcessArea processArea, IProcessItemService itemService,
IProgressMonitor monitor) throws TeamRepositoryException {
IProcessAreaWorkingCopy areaWc = (IProcessAreaWorkingCopy) itemService
.getWorkingCopyManager().createPrivateWorkingCopy(
processArea);
areaWc.getTeam().addContributorsSettingRoleCast(
new IContributor[] { user }, new IRole[] { role });
areaWc.save(monitor);
}

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.