It's all about the answers!

Ask a question

Add subscriber in Work Item by programming


Francisco Javier Moreno López (0187) | asked Jun 25 '09, 2:51 p.m.
Hello,

How Can I add subscribers in a work item by programming?

Thank you in advance.

6 answers



permanent link
Andre Weinand (4811) | answered Jun 30 '09, 5:05 a.m.
You have two options:

- use the Java API, see:
https://jazz.net:443/wiki/bin/view/Main/QueryDevGuide
https://jazz.net:443/wiki/bin/view/Main/ProgrammaticWorkItemCreation

- use the REST API, see:
https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2
(see section: Adding Links to a Work Item)

hth,
--Andre Weinand
RTC Work Item Team



On 2009-06-25 20:52:59 +0200, fco.moreno@gmail-dot-com.no-spam.invalid
(fco.moreno) said:

Hello,

How Can I add subscribers in a work item by programming?

Thank you in advance.

permanent link
Andre Weinand (4811) | answered Jun 30 '09, 8:52 a.m.
And the Java code is straightforward:

IContributor user=... some user;
IWorkItem wi= ... some work item (may be from a WorkItemWorkingCopy);
ISubscriptions subscription= wi.getSubscriptions();
subscription.add(user);

--andre weinand
RTC Work Item Team


On 2009-06-25 20:52:59 +0200, fco.moreno@gmail-dot-com.no-spam.invalid
(fco.moreno) said:

Hello,

How Can I add subscribers in a work item by programming?

Thank you in advance.

permanent link
Francisco Javier Moreno López (0187) | answered Jun 30 '09, 2:50 p.m.
Thank you very much!!

And the Java code is straightforward:

IContributor user=... some user;
IWorkItem wi= ... some work item (may be from a WorkItemWorkingCopy);
ISubscriptions subscription= wi.getSubscriptions();
subscription.add(user);

--andre weinand
RTC Work Item Team


On 2009-06-25 20:52:59 +0200, fco.moreno@gmail-dot-com.no-spam.invalid
(fco.moreno) said:

Hello,

How Can I add subscribers in a work item by programming?

Thank you in advance.

permanent link
rajendra prasad (2625) | answered Nov 12 '11, 2:58 a.m.
Could you please provide me complete code ?

Thank you very much!!

And the Java code is straightforward:

IContributor user=... some user;
IWorkItem wi= ... some work item (may be from a WorkItemWorkingCopy);
ISubscriptions subscription= wi.getSubscriptions();
subscription.add(user);

--andre weinand
RTC Work Item Team


On 2009-06-25 20:52:59 +0200, fco.moreno@gmail-dot-com.no-spam.invalid
(fco.moreno) said:

Hello,

Ho
w Can I add subscribers in a work item by programming?

Thank you in advance.

permanent link
Roger Layani (5313238) | answered Apr 16 '12, 8:02 a.m.
this code fail when I am trying to save the change by itemCopy.save
can you advice why?

And the Java code is straightforward:

IContributor user=... some user;
IWorkItem wi= ... some work item (may be from a WorkItemWorkingCopy);
ISubscriptions subscription= wi.getSubscriptions();
subscription.add(user);

--andre weinand
RTC Work Item Team


On 2009-06-25 20:52:59 +0200, fco.moreno@gmail-dot-com.no-spam.invalid
(fco.moreno) said:

Hello,

How Can I add subscribers in a work item by programming?

Thank you in advance.

permanent link
Roger Layani (5313238) | answered May 29 '12, 10:21 a.m.
This code now works fine with user login parameter (subscriber)
.....
copyManager.connect(handle, IWorkItem.FULL_PROFILE, null);
WorkItemWorkingCopy itemCopy = copyManager.getWorkingCopy(handle);

IWorkItem item = itemCopy.getWorkItem();

IContributorManager contributorManager = teamRepository.contributorManager();

IContributor toadd = contributorManager.fetchContributorByUserId(subscriber, null);


ISubscriptions subscription= item.getSubscriptions();
subscription.add(toadd);
IDetailedStatus detailedStatus = itemCopy.save(null);
System.out.println(detailedStatus.getDetails());
.....




this code fail when I am trying to save the change by itemCopy.save
can you advice why?

And the Java code is straightforward:

IContributor user=... some user;
IWorkItem wi= ... some work item (may be from a WorkItemWorkingCopy);
ISubscriptions subscription= wi.getSubscriptions();
subscription.add(user);

--andre weinand
RTC Work Item Team


On 2009-06-25 20:52:59 +0200, fco.moreno@gmail-dot-com.no-spam.invalid
(fco.moreno) said:

Hello,

How Can I add subscribers in a work item by programming?

Thank you in advance.

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.