moving WI using Java API

Posts: 1
Joined: Thu Jun 22, 2017 12:10 pm

moving WI using Java API

Postby Daniel » Thu Jul 20, 2017 2:45 pm

I'm struggling with moving WorkItems using Java API issues.

I'm creating copy of WorkItems in document recycle bin and I would like them to move to heading section.

My best result is still:

Code: Select all


But work items are moved to the end of a document, they are becoming children of last heading. I would like them moved just after "headingTarget", even before this heading original children.

I've tested a little bit things like addLinkedItem, ExternalWorkItems, wi.copyTo or traverseLinkedWorkitems, but still to no effect.

Of coure moving WI to proper heading from Polarion UI works like it should. How to do the same from Java?

Any help is highly appreciated.

Posts: 4
Joined: Tue May 16, 2017 1:29 pm

Re: moving WI using Java API

Postby bmartins » Mon Aug 14, 2017 10:51 pm

You should use something like this:

Code: Select all

List<IWorkItem> items= new ArrayList<IWorkItem>();
IWorkItem headingTarget =  ...
IWorkItem workItemsInBin = ...
IModule document = ...

// more code here

//create a link with the header
workItemsInBin.addLinkedItem(headingTarget,  headingTarget.getLinkRole(), null, false);;

//List of object that you want to move in

// more code there

 document .moveIn(items); //Move the workitems to the right location in the document
 document .save();

After you commit your transaction the work items should be in the right place.

Posts: 1
Joined: Sat Sep 30, 2017 7:26 pm

Re: moving WI using Java API

Postby ompravin » Sat Sep 30, 2017 8:12 pm

Hi ,
im new to polarian tool. I would like to know, how to fetch WI using Java API or any scripts.
Please help me.

Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: callieow69, Google [Bot] and 7 guests