1

I have a question regarding the Polarion JAVA API SDK.

I can get the workItem using:

WorkItem wi = trackerService.getWorkItem(workItemURL);

Then I get the type:

EnumOptionId type = wi.getType();

Now how can I get the Type representation text? And can I get the Icon of the WorkItem using API? Also is there a way to get all WorkItem Types from Polarion?

avocadoLambda
  • 1,332
  • 7
  • 16
  • 33
TerTerro
  • 31
  • 4

3 Answers3

1

For your tasks, the EnumOptionId object has the following methods(:

.getId()       // returns the Id of this type
.getName()     // returns the human readable name of this type
.getProperty(IEnumOption.PROPERTY_KEY_ICON_URL)   // returns the URL of the Icon of this type

Note that these methods are available also for other enumeration types, like priority, status or user defined enums.

Peter Parker
  • 29,093
  • 5
  • 52
  • 80
0

for rendering Work Items, you might consider using the rendering API.

You could use something like this in Velocity (You can use it in script blocks in report pages):

## Get Project Id
#set($projectId = $page.fields().project().projectId())

## Get Work Items with new API
#set($renderWIs = $transaction.workItems().search().query("type:systemrequirement AND project.id:$projectId"))

## Render Work Items
#foreach($WI in $renderWIs)
    $WI.render().withLinks()<br>
#end

Check out this blog post explaing the difference: https://polarion.code.blog/2020/06/16/rendering-vs-open-api/

Blaquie
  • 1
  • 1
0

After getting EnumOptionId from WorkItem.

for type name - type.getName();

for icon url - type.getProperty("iconURL")

for other requirements, you can refer to the following image. enter image description here ITypeOpt

Constant Values

shahooo
  • 563
  • 4
  • 14