It's all about the answers!

Ask a question

Add user to project area


Laurence Caraccio (9166) | asked Sep 05 '11, 9:38 a.m.
I'm trying to add a user to a project area using the plain java the code I've been trying to use is:
 IContributorManager contribService= teamRepository.contributorManager();

IContributor[] c = new IContributor[1];
c[0] = contribService.fetchContributorByUserId("userID", null);

if(c == null){
System.out.println("User not found");
}

ProjectAreaWorkingCopy copy = (ProjectAreaWorkingCopy) projectArea.getWorkingCopy();

copy.addMembers(c);

copy.save(null);


but I can't cast from projectArea.getWorkingCopy to ProjectAreaWorkingCopy, tryint to do it straight to the process area gives an immutable property exception.

An help with this would be greatly appreciated, cheers.

7 answers



permanent link
Laurence Caraccio (9166) | answered Sep 07 '11, 6:49 a.m.
Ok, I've figured out how to add a user to a project area using:
 IContributorManager contribService= teamRepository.contributorManager();

IContributor[] c = new IContributor[1];
c[0] = contribService.fetchContributorByUserId("johndoe@uk.ibm.com", null);

ProjectAreaWorkingCopy wc = new ProjectAreaWorkingCopy(projectArea);
wc.addMembers(c);

wc.save(null);

Now I want to be able to set the user's role. So set their role to be team member (the other possible roles are scrum master, product owner and stakeholder, there is also a default which is the currently selected)

Any ideas? cheers.

permanent link
Qiong Feng Huang (76911610) | answered Sep 09 '11, 5:12 a.m.
JAZZ DEVELOPER
Why do you want to add user or assign roles to user by using java API? We don't have public java API for those operations. Normally, you should use UI to add user or assign roles.

permanent link
Laurence Caraccio (9166) | answered Sep 09 '11, 9:41 a.m.
Why do you want to add user or assign roles to user by using java API? We don't have public java API for those operations. Normally, you should use UI to add user or assign roles.


I'm part of a team migrating a company's defects, test cases, test scripts ect from HP quality center to the rational portfolio, as part of that all their users will need to be added to the projects and assigned specific roles.
This will take a lot of time to do manually so I was asked if I could figure out how to do it programatically, I've figured out how to add the users are you saying its impossible to set their roles in this way at the moment?

permanent link
Indradri Basu (1.8k1514) | answered Sep 11 '11, 11:10 p.m.
Why do you want to add user or assign roles to user by using java API? We don't have public java API for those operations. Normally, you should use UI to add user or assign roles.


I'm part of a team migrating a company's defects, test cases, test scripts ect from HP quality center to the rational portfolio, as part of that all their users will need to be added to the projects and assigned specific roles.
This will take a lot of time to do manually so I was asked if I could figure out how to do it programatically, I've figured out how to add the users are you saying its impossible to set their roles in this way at the moment?


Assuming you are migrating to 3.0.1, to give a second thought about the process of adding users, there is a way where users can register themselves. You can take a look at these two links.

http://publib.boulder.ibm.com/infocenter/clmhelp/v3r0m1/topic/com.ibm.jazz.repository.web.admin.doc/topics/t_users_self_register.html

http://publib.boulder.ibm.com/infocenter/clmhelp/v3r0m1/topic/com.ibm.jazz.repository.web.admin.doc/topics/tmanagedefaultlicense.html

permanent link
Geoffrey Clemm (30.1k33035) | answered Sep 11 '11, 11:41 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
This functionality is requested in work item 90321. Please add a
comment to that work item to indicate your interest/support.

Note that the mechanisms described below in an earlier response allows a
user to register themselves as a valid user of the repository, and
allows them to be auto-assigned a given type of (repository-defined)
license type. But it doesn't let them automatically add themselves as a
member of a given project area with a specified role. It is unlikely
that you will want to allow an arbitrary user to do this for themselves,
so "auto-assign is unlikely to be appropriate.

Cheers,
Geoff

On 9/11/2011 11:23 PM, indradrib wrote:
lc00141wrote:
Why do you want to add user or assign
roles to user by using java API? We don't have public java API for
those operations. Normally, you should use UI to add user or assign
roles.Why do you want to add user or assign roles to user by using
java API? We don't have public java API for those operations.
Normally, you should use UI to add user or assign
roles.


I'm part of a team migrating a company's defects, test cases, test
scripts ect from HP quality center to the rational portfolio, as part
of that all their users will need to be added to the projects and
assigned specific roles.
This will take a lot of time to do manually so I was asked if I could
figure out how to do it programatically, I've figured out how to add
the users are you saying its impossible to set their roles in this
way at the moment?



Assuming you are migrating to 3.0.1, to give a second thought about
the process of adding users, there is a way where users can register
themselves. You can take a look at these two links.

http://publib.boulder.ibm.com/infocenter/clmhelp/v3r0m1/topic/com.ibm.jazz.repository.web.admin.doc/topics/t_users_self_register.html


http://publib.boulder.ibm.com/infocenter/clmhelp/v3r0m1/topic/com.ibm.jazz.repository.web.admin.doc/topics/tmanagedefaultlicense.html

permanent link
Laurence Caraccio (9166) | answered Sep 12 '11, 5:52 a.m.
Ok cheers for your help.

permanent link
Qiong Feng Huang (76911610) | answered Sep 13 '11, 10:05 a.m.
JAZZ DEVELOPER
Why do you want to add user or assign roles to user by using java API? We don't have public java API for those operations. Normally, you should use UI to add user or assign roles.


I'm part of a team migrating a company's defects, test cases, test scripts ect from HP quality center to the rational portfolio, as part of that all their users will need to be added to the projects and assigned specific roles.
This will take a lot of time to do manually so I was asked if I could figure out how to do it programatically, I've figured out how to add the users are you saying its impossible to set their roles in this way at the moment?

There is a document about bulk manipulation of process memberships you might be interested in: https://jazz.net/library/article/633

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.