Get work item from whole repository with Java API

Posts: 2
Joined: Wed May 25, 2016 11:50 am

Get work item from whole repository with Java API

Postby etruog » Mon May 30, 2016 8:16 am

Hello community

I'm trying to figure out how to get a work item from the whole repository without the project ID.
Every function i can find to get a work item needs the project ID as parameter.

What I wanna do is to find a work item by ID to find out in which project this work item is. After that i want to create a new work item in the same project and link it to the work item i found.

I tried something like

Code: Select all

trackerService.getWorkItemById("Default Repository", itemID);


Code: Select all

trackerService.getWorkItemById("Reporitory", itemID);

but none of these are working.

With the web interface it is possible to search the whole repository for a particular work item.
So my question is: How can i do this with the Java API?

Thank you very much! :)

Posts: 3
Joined: Tue Mar 13, 2018 4:16 pm

Re: Get work item from whole repository with Java API

Postby stewarca » Wed Mar 21, 2018 4:06 pm

Did you find a way to do this?

Posts: 17
Joined: Thu Oct 26, 2017 4:08 pm

Re: Get work item from whole repository with Java API

Postby rpn » Mon Jul 30, 2018 1:06 pm

I am using the WebServices via the .ne-wrapper, the methods there should be the same.

Why don't you iterate over all projects/Modules/WorkItems in that space and search for the item in every project?

Alternative 1: The TrackerService has a method that allows you to pass an arbitrary lucene-query:
Tracker.queryWorkItems(string query, string sort, string[] fields)
The query can be buildt using the webinterface of polarion.

Alternative 2: Check the postgre-DB that runs in your polarion-installation. You can write concise SQL-Queries against that, which would be faster, than iterating and using the webservice/SDK. [SQL query is available also over the WebService TrackerWebService.queryWorkItemsBySQL([...])]

In the installation I am working with, every item is prefixes with a project-prefix, so there is no question about the project a item belongs to.
No native speaker, sorry for my bad English.

Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 8 guests