Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Add subscriber in Work Item by programming

Hello,

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

Thank you in advance.

0 votes



6 answers

Permanent link
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.

0 votes


Permanent link
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.

0 votes


Permanent link
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.

0 votes


Permanent link
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.

0 votes


Permanent link
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.

0 votes


Permanent link
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.

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,954

Question asked: Jun 25 '09, 2:51 p.m.

Question was seen: 10,788 times

Last updated: Jun 25 '09, 2:51 p.m.

Confirmation Cancel Confirm