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

RTC Java/Plugin API - How to set a project Area for Work Item?

What's the API method call to set Project Area for the given work item? Basically I am trying to move a Work Item from Project Area 'A' to Project Area 'B'.

I have a IWorkItem from WorkItemWorkingCopy, but I do not see any set method(s) to set Project Area. Someone mentioned that setContextId should work, but I don't think it works.

Below is the code snippet. The Save Status is 'OK'.

try
{
wiWorkingCopyMgr.connect(workItem, IWorkItem.FULL_PROFILE, monitor);
wiWorkingCopy = wiWorkingCopyMgr.getWorkingCopy(workItem);
copiedWorkItem = wiWorkingCopy.getWorkItem();
copiedWorkItem.setContextId(targetProjectArea.getItemId());
wiWorkingCopy.save(monitor);
}
catch (TeamRepositoryException e)
{
   // Log it
}

CopyToProjectAreaOperation  wizard doesn't move the work item. It opens the Work Item in editor and user action is required to save the work item. 

0 votes



One answer

Permanent link
The Context ID is, the access context and not the owning project area. See https://rsjazz.wordpress.com/2016/02/02/setting-access-control-permissions-for-work-items/ for details.

As far as I can tell, you can not just set the project area. The whole process is tied to to a project area. This includes attribute ID's etc. Even if you use the same process everywhere the same attribute in one project area is not the same attribute in another project area. The IAttribute has different values. You have to do a lot more to do this.

https://github.com/jazz-community/rtc-workitem-bulk-mover-ui does all this and you might want to check how it does it. It is JavaScript, not plain java API. The Eclipse built in Work Item mover is part of the SDK and you can find it in the SDK. I have looked at it and couldn't make a lot of sense of it, however.

0 votes

Comments

I was not able to find the code in SDK as not all jars/libraries come with java docs/how do documents.  Do you know what's the Java SDK call to setup the project area? 

On the other side, i have done coding to compare the source attributes, target attributes, workflows, missing attributes, mandatory attributes etc. 

I am now just looking for a piece of code (or bunch of lines) to set the project area for the given IWorkItem object. 

I would suggest to follow https://rsjazz.wordpress.com/2015/09/30/learning-to-fly-getting-started-with-the-rtc-java-apis/ and do the Extensions Workshop. Use the Extensions workshop workspace for API development. Make the projects all plugin projects to be able to use the PDE show the SDK and the Source code.

"Java SDK call to setup the project area" I can not make sense of this in the current topic. Code to setup project areas are in the snippets that ship with the plain java client libraries.

I think "setup the project area " was a typo ... I believe he just meant "set the project area". 

The work item creation call includes the project area the work item lives in. That sets the project area. I am not aware of a call that sets a different project area.


Note, I have tried looking into the SDK code for moving work items and gave up at some time as there was no need. I never figured it out completely.

showing 5 of 6 show 1 more comments

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,934
× 457
× 411
× 70

Question asked: Dec 04 '19, 11:33 a.m.

Question was seen: 2,711 times

Last updated: Dec 06 '19, 12:03 p.m.

Confirmation Cancel Confirm