javavelocitypolarionapache-velocity

Polarion ALM SDK API getWorkItem()


I have a question about the Polarion SDK API

I am in a Project -> Documents and Pages -> Testing. From there I created a new wiki article. In the editing of the article I did the following:

1) created a sql query using: #set ($sql_result = $sqlService.executeQuery("<sql query here>") The sql query produces an array that looks like this:

[[project.c_id, test_cases.c_id , test_cases count ], [project.c_id, test_cases.c_id , test_cases count ], [project.c_id, test_cases.c_id , test_cases count ], [project.c_id, test_cases.c_id , test_cases count ]]

2) Now I would like to iterate through this multi-dimensional array by doing this:

#foreach($item in $sql_result)
  $getWorkItem($item.get(0), $item.get(1)) <br>
#end

Unfortunately, Polarion does not appear to recognize the $getWorkItem(). I am pretty newbie at this, I'm sure I'm just calling the function incorrectly. I found the API Doc here: https://almdemo.polarion.com/polarion/sdk/doc/javadoc/index.html

It is in TrackerService.getWorkItem()

But I still don't know how to call the API correctly. Any help will be greatly appreciated.


Solution

  • You need to reference the instance of TrackerService which is in the Velocity context to be able to call getWorkItem(), something like:

    $trackerService.getWorkItem($item.get(0), $item.get(1))
    

    The main point is that you cannot call a method without a base object in Velocity.