This extension intercepts all Polarion requests for saving or deleting Work Item actions and injects required functionality by invoking available hooks. A “Hook” is just a Java class which is implemented as special interface and stored as jar file in extension subfolder "hooks". Hooks can be added or changed without restarting Polarion, so you may manage hooks (e.g. apply fix) without interrupting users.
For Installing the Interceptor just copy the extension jar to Polarion extensions folder like it works for all other extensions. Hooks can be added at any time just by copying jars to the extension subfolder “hooks”. If a hook is added to the working server, then the extension should be enforced to reload hooks from the managing page. As well it is possible to disable or reload any hook.
You may interact with the extension functionality via wiki page (invoking workItemActionInterceptorManager by Velocity script). Following functionality is available from the wiki:
· Reloading hooks.
This makes it possible to change hook’s jars (e.g. add, delete, replace) and enforces reloading the code. After reloading, the extension will use the updated hook’s functionality.
· Reloading properties.
Enables to update and reload extension properties file (hook.properties).
· Enable extension functionality.
Supports to enable \ disable interceptions for actions. If the extension is disabled then no hooks will be invoked
· Requesting loaded properties showing on wiki
A sample of the Interceptor-managing wiki page is available in the extension archive as file manager_page.wiki.
Hook is a Java class implemented special interface (IActionHook) and stored as separate jar file in folder "hooks". The Jar manifest file must contain attribute "Main-Class". The extension archive already contains 2 hooks (with sources and Eclipse project file) so you can easily build your own hooks based on these samples:
Hook checking length for the title field. If it over then defined number of symbols then Polarion shows warning message without saving changes.
Control that only assignee user can delete WI
The Hook archives (folder samples) contains as well a file for creating delivering jar (and release)
Note: if a hook may modify WIs then special user "polarion" should have write permission in the project (access managing)
There is a Polarion extension with similar functionality for JS hooks: FMC Workitem Save. The difference of this extension is that it is offering Java code instead of JS hooks