Add user to project area
I'm trying to add a user to a project area using the plain java the code I've been trying to use is:
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.
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
Ok, I've figured out how to add a user to a project area using:
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.
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.
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?
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
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:
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
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
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