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
}
Note: I have already gone thru https://jazz.net/forum/questions/216707/how-to-move-work-item-to-other-project-area-using-java-client-api and https://jazz.net/forum/questions/53755/move-workitem-from-a-project-area-to-another posts.
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
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
showing 5 of 6
show 1 more comments