It's all about the answers!

Ask a question

How to move work item to other project area using java client API


vikrant kamble (132251) | asked Feb 18 '16, 4:50 a.m.
 I want to move workitem from project area to other project area using java client API.
Is there any API which can move work item from project area to other project area.

2 answers



permanent link
Ralph Schoon (55.3k23642) | answered Feb 18 '16, 5:06 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Feb 18 '16, 5:08 a.m.
By opening the Copy/Move Work item Wizard in the Eclipse client and using the Plugin Spy (SHIFT+ALT+F1) on the dialog window you can find and open the wizard class com.ibm.team.workitem.rcp.ui.internal.wizards.CopyToProjectAreaWizard

You can look at the code how they do it. I doubt there is a special API. You have to find the source and target attributes and create a value mapping in any case, because the UUID's and ID's of referenced items are almost certainly different in both project areas in most of the cases.

Comments
vikrant kamble commented Feb 24 '16, 12:58 a.m.

 HI Ralph, <o:p> </o:p>

I was understanding about class CopyToProjectArea, as you mentioned in your answer in this link performFinish() method does the move of work item. But I was not able to understand how it happens as this method is called nowhere in CopyToProjectArea.class

Any suggestions

<o:p>   </o:p>


Ralph Schoon commented Feb 24 '16, 2:00 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

It is just a UI pattern and how the wizards (superclass) work. If you had bothered to set a debug break point in a debug eclipse client, you would see how it gets called once you press finish.


Ralph Schoon commented Feb 24 '16, 2:28 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Please also note, that the code here is part of the RTC Client SDK. It is not a part of the plain java client libraries and it is also internal code for all I can see. I have looked at that code a while back, because I wanted to do what you are attempting but Did not find the time to really pursue the task,


vikrant kamble commented Feb 29 '16, 6:33 a.m.

  Hi Ralph,

I was unable to set a debug break point in a debug eclipse client, but I studied about performFinish() method,
I believe that 
CopyToProjectAreaOperation operation= new CopyToProjectAreaOperation(name, fTargetArea, true, fMove, fResolveSource, fMoveAttachments, fCopyAttachments);

operation.run(fWorkItems.toArray(new IWorkItemHandle[fWorkItems.size()]), monitor);

This code snippet is responsible for moving work item.
Is it right?


Ralph Schoon commented Jun 23 '16, 4:15 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I looked at it, and that is used. Note it is com.ibm.team.workitem.rcp.ui.internal.wizards.CopyToProjectAreaOperation which means it is internal client code and not part of the Plain Java Client Libraries.


permanent link
vikrant kamble (132251) | answered Jun 23 '16, 2:22 a.m.
edited Jun 23 '16, 4:46 a.m.
Hi Ralph,
I was surfing on google and jazz.net to find If I can get anything to move work item from project area to another.
I did not find client Java API to move work item but I found server API to move work item.
Exact code is given in https://jazz.net/forum/questions/53755/move-workitem-from-a-project-area-to-another this link
I did it myself and work item is moved to specified project area, Some changes in code needs to be done however.


Comments
Ralph Schoon commented Jun 23 '16, 3:40 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

The link above points to this post and not to one with server API.


vikrant kamble commented Jun 23 '16, 4:11 a.m.

Code is given in the link. If required I can also provide executable code to move work item


Ralph Schoon commented Jun 23 '16, 4:13 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

If I click the link, I end up in THIS QUESTION


vikrant kamble commented Jun 23 '16, 4:47 a.m.

My bad, I hyperlinked my own question. I updated my answer


Ralph Schoon commented Jun 23 '16, 4:59 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

The code is server API. I can't see how this would work in the client API com.ibm.team.workitem.rcp.ui.internal.wizards.CopyToProjectAreaOperation would, but is part of the RTC Eclipse client internal API and not the Plain Java Client Libraries.


vikrant kamble commented Jun 23 '16, 5:35 a.m. | edited Jun 23 '16, 5:50 a.m.

Yes code is server API, I developed 'participant' to move work item from project area to other project area on work item save operation.
WorkItemWrapper wiWrapper = new WorkItemWrapper(workingCopy, workItemReferences, "");
ServerCopyToProjectOperation op = new ServerCopyToProjectOperation(processArea.getProjectArea(), true, false, false);
op.run(wiWrapper, workItemServer, linkServiceLibrary, contentService);

These server API are responsible to move work item from project area to other.

I guess com.ibm.team.workitem.common.internal.CopyToProjectOperation is counter client side API. I did not use it or developed a program using it though.


vikrant kamble commented Jun 23 '16, 6:15 a.m. | edited Jun 23 '16, 6:16 a.m.

Hi Ralph,
I had a doubt about saving work item.

If work item is moved from project area to other project area from RTC eclipse or web UI, it is unsaved in that project area i.e. User has to save work item in specified project area after it is moved.

Is it possible to keep work item unsaved if work item is being modified by client api or server api?

showing 5 of 7 show 2 more comments

Your answer


Register or to post your answer.