Unable to create project Area using customized process template using RTC JAVA API
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
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.
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
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
Note that some of the parameters are arrays so you could add more than one object.
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
*
* @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);
}