Add Subscriber to a Work item from JAVA API.
Hi All,
I am trying to add a Subscriber through java API. I am succeeded partially. My code snippet is as follows.
But My requirement is that how to pass User Id of my own.. Ofcoourse, i will pass the User ID which is existing in the repository. Thanks |
Accepted answer
Andrew Niefer (713●5)
| answered May 30 '12, 12:21 p.m.
JAZZ DEVELOPER edited Jun 05 '12, 11:32 a.m. Hi All, On the client side, there is IContributorManager.fetchContributorByUserId(String userId, IProgressMonitor monitor). You can get the contributor manager from the repository with ITeamRepository.contributorManager(). On the server side, there is IContributorService.fetchContributorByUserId(String userId) which returns an IContributorHandle. If your code is in a service, you can add a dependency on IContributorService and use IAbstractScmService#getService to get it. Otherwise you might be able to use OsgiServicesManager.INSTANCE.getService. Muthukumar C selected this answer as the correct answer
|
3 other answers
Hi,
I think your code is for Client side. I want to implement this as Server side plugin code. Thanks Hi All, There is IContributorManager.fetchContributorByUserId(String userId, IProgressMonitor monitor). You can get the contributor manager from the repository with ITeamRepository.contributorManager() |
Hi All.
Here is the working code to add a Given user id as subscriber [Server Side] IContributorService IConService = getService(IContributorService.class); IContributorHandle user = IConService.fetchContributorByUserId("myuserid"); WorkItem.getSubscriptions().add(user); NOTE : Its assumed that we are passing the exiting user id. else, a condition to be added to throw User does not exists error message. Thanks to all !!! |
Hi
I am getting an error when I use the line:
IContributorService IConService = getService(IContributorService.class);
the exception says: the service cant be found,Do you know why this can be happenning ?
I am using this line in a class that extends from AbstractService and implements IOperationParticipant
|
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.