0

In the Polarion documentation: https://almdemo.polarion.com/polarion/sdk/doc/javadoc/com/polarion/alm/tracker/model/IWorkItem.html#traverseLinkedWorkitems(java.util.Set,java.util.Set,java.util.Set,com.polarion.alm.tracker.model.IWorkItem.ITerminalCondition)

I have created empty sets using $objectFactory.newSet() to account for the first 3 parameters, and I have tried "null" for the conditional parameter, but nothing works.

This is an example of what I have tried:

#set($project = "Project X"
#set($workItem1 = 'ABC-123')
#set($emptySet = $objectFactory.newSet())

#set($ts1 = $trackerService.getWorkItem($project,$workItem1))
$ts1 ##output: PObject(WorkItem; subterra:data-service:objects:/default/Project X${WorkItem}ABC-123) 
$ts1.traverseLinkedWorkItems($emptySet,$emptySet,$emptySet,'null')

The output is always $ts1.traverseLinkedWorkItems($emptySet,$emptySet,$emptySet,'null')

Is there no way to do this in Velocity? I have seen only one other post regarding this question: https://community.sw.siemens.com/s/question/0D54O000075P0SCSA0/any-way-to-call-traverselinkedworkitems-from-a-velocity-script-block-widget

1 Answers1

1

Have you tried $null as the last argument? As an undefined reference, it will translate to null.

But this solution will only work if Velocity is not running in strict mode.

Claude Brisson
  • 4,085
  • 1
  • 22
  • 30
  • Currently `$null` translates to $null because in the Velocity configuration file `directive.set.null.allowed = false`, but changing this to true should allow me to set `$null` as an undefined reference. – unsure_engineer Oct 26 '22 at 18:46
  • @unsure_engineer `directive.set.null.allowed` only handles the case where you have `#set($var = ...something null...)`, it is not pertinent in your context. My proposal is to write `$null` (undefined reference that will translate to a `null` argument) instead of the `'null'` string in your attempt. – Claude Brisson Oct 26 '22 at 20:45
  • I see. Currently if I use `$null` I get the same output as above `$ts1.traverseLinkedWorkItems($emptySet,$emptySet,$emptySet,$null)`. The settings in the Velocity.properties config file did not have a setting for `runtime.references.strict`, so hopefully adding `runtime.references.strict = false` will allow me to use $null as in your context above. I will report back. Thank you for your help. – unsure_engineer Oct 27 '22 at 22:52
  • Still no luck. I added the `runtime.references.strict = false` setting, I confirmed that I am allowed to use `null` values, but my Method call `$ts1.traverseLinkedWorkItems($emptySet,$emptySet,$emptySet,$null)` still does not work :( – unsure_engineer Nov 01 '22 at 21:24
  • Adding `runtime.references.strict = false` allowed me to use `$null` as `null`. However that did not solve the problem. The method returns a Boolean value of `true` and terminates with an empty set. I will try and consult the Siemens blog about this issue. – unsure_engineer Nov 02 '22 at 17:36