Retrieve Enumerations in Polarion?

119 Views Asked by At

Is there any way to retrieve all Options for a Enumeration (including description) in Polarion?

I have tried multiple things:

  1. Searching the enum via Dataservice
$trackerService.getDataService().getEnumerationObjectFactories().get("@WorkItems").getEnumeration("processes-enum.xml", $contextId).getAllOptions().get(0)

this does return an EnumOption, but its from the "wrong side". If i use .getName() or getId() it returns the name and Id of a Workitem (so getAllOptions means I get all possible Applications for an Enumeration but not the content of the actual Enumeration file.

  1. Using custom Fields
#set($projectId = $page.getReference().projectId())
#set($trackerProject = $trackerService.getTrackerProject($projectId))
$trackerProject.getWorkItem("myWorkitem").getCustomField("myEnum").getProperty("description")

This correctly gets the description for the EnumOption for myWorkitem for myEnum. This is already good, but now I can only access EnumOptions descriptions that are "used" in a Workitem.

  1. CustomFieldsService
#set($customFieldsService = $trackerService.getDataService().getCustomFieldsService())
$customFieldsService.getCustomField("myEnum", "WorkItem", $contextId)

This correctly returns an instance of a CustomField, but this doesnt really help me, since I can't search for all possible Options for this Custom Field

Is there something I am missing? Is there a way to access the description of EnumOptions for an Enum in Polarion?

1

There are 1 best solutions below

0
Florian Straub On

Using .getClass().getName() on the output of getCustomField(key), I learned that it actually is an AbstractTypedList which has a get(int) method.

Retrieving the first item of the field suddenly lets you call the id property:

$workitem.getCustomField("release").get(0).id