It's all about the answers!

Ask a question

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


MooR Rathinasamy (413) | asked Dec 04 '19, 11:33 a.m.
edited Dec 04 '19, 11:41 a.m.

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. 

One answer



permanent link
Ralph Schoon (63.5k33646) | answered Dec 05 '19, 2:35 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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.

Comments
MooR Rathinasamy commented Dec 06 '19, 11:02 a.m.

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. 

Ralph Schoon commented Dec 06 '19, 11:27 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.


Ralph Schoon commented Dec 06 '19, 11:29 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

"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.


Geoffrey Clemm commented Dec 06 '19, 11:39 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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


Ralph Schoon commented Dec 06 '19, 11:58 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.


Ralph Schoon commented Dec 06 '19, 12:03 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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