Community
Thumb_icon

Work Item Action Interceptor Framework

 Lets you easily run custom Java code (via Hooks), before Polarion saves/deletes a Work Item, Plan or Test Run.

Description

This extension for Polarion makes it possible to easily run your own Java code (hook) before the system saves or deletes any Work Item, Document, Document Comment, Plan, Test Run, or Work Record, so you have a powerful possibility to interact with or interrupt these actions for your needs. 

Example: A Hook can be implemented that checks all possible conditions when a user is about to delete or modify a Work Item. These Hooks can harness all the capabilities found within Polarion's Java API.

 

Building

  • A .jar file must contain a META-INF folder with the hivemodule.xml and MANIFEST.MF files copied from the project.
  • Due to an issue with Eclipse, you may need to add these files manually to replace the versions that are generated automatically.

 

Installation

  • To install the extension just copy its files to the Polarion extensions folder.
  • Hooks can be added at any time by copying .jar files to the extension's hooks subfolder. 
  • If a Hook is added while Polarion is running, the management page can be used to reload the Hooks. (See below for details.)

CAUTION: When upgrading from version 3.0.3 or earlier, make sure to update to the following folder structure.

Folder Structure
/extensions
  |- actions_interceptor
     |- eclipse
       |- plugins
          |- com.adva.polarion.WorkItemActionInterceptor_3.1.1
     |- com.adva.polarion.interceptor.jar
             |- hook.properties
             |- META-INF
                |- MANIFEST.MF
             |- hooks
                |- com.adva.polarion.WorkItemActionInterceptor.ControlTitleLengthHook_3.0.1.jar
                |- com.adva.polarion.WorkItemActionInterceptor.OnlyAssigneeCanDeleteHook_3.0.1.jar
                |- com.adva.polarion.WorkItemActionInterceptor.PlanSaveHook_3.0.1.jar
                |- com.adva.polarion.WorkItemActionInterceptor.SingleAssigneeHook_3.0.1.jar
                |- com.adva.polarion.WorkItemActionInterceptor.TestRunHook_1.0.1.jar


Interceptor Management Page
Users control what the extension does through a Wiki Page by invoking the following in a Velocity script:
 workItemActionInterceptorManager 

On any Wiki Page, you can:

  • Reload Hooks 
    • Edit the Hook .jars. (Add, delete, replace, or edit while the Polarion server is running.)
    • When triggered, the extension will use the most recent version of a Hook's code.
  • Reload Properties 
    • You can update and reload the extension's properties file. (hook.properties)
  • Control Extension Functions 
    • You can enable\disable interceptions for actions.
    • If the extension is disabled, no Hooks will be invoked.
  • Request a List of Loaded Hooks
  • Request the Currently Set Properties

 

A sample of the Interceptor Management Page is in the following extension archive file: 
manager_page.wiki.

Hooks

A Hook is a Java class that implements a special interface (IActionHook) that's stored as a separate .jar file in the hooks folder. The Jar Manifest file must contain the Main-Class attribute.

The extension archive already contains several sample Hooks (with sources and the Eclipse project file) to help you easily build your own Hooks.

  • ControlTitleLengthHook
    • Makes sure the length of the Title field does not exceed a defined number of characters.
  • OnlyAssigneeCanDeleteHook
    • Makes sure that only the current Assignee can delete a Work Item.
    • Hook archives (folder samples) also contain an Ant file for creating a delivery jar. (Ant Release)
    • Note: Because this Hook modifies the Work Item, a special "polarion" user must have write permissions in the current project.
  • PlanSaveHook
    • Adds all Work Items added to child Plans to their parent Plan.
  • SingleAssigneeHook
    • It only allows a single Assignee to be assigned a Work Item.
  • TestRunHook
    • Makes sure that a Test Case result is not set to "Passed" if one of the Test Step results has "Failed".

 

WARNING: Do not forget to modify the hook.properties file (in the extension's root folder) to activate the Hooks for your projects. (See details in the Hooks section of the README.TXT file.)

 

What's New in Version 3.1.1

Updated October 2023

Version 3.1.1 (by Kevin Schmiechen, TUM-FSD)
- Added support for IModule, IModuleComment, and IWorkRecord hooks
- Fixed compatibility issues with contained hooks

Version 3.0.4 (by Kevin Schmiechen, TUM-FSD)
- Fixed compatibility with Polarion 22 R2 logger
- Fixed issue where the save hooks were used for delete actions

Version 3.0.3
- Propagation of properties from the hooks.properties file to Hooks.
- Support for processing Test Runs deletions.
- Support for Test Run modification intercepting.
- Support for Plans modification intercepting.
- Support for Java 11 (Polarion 2019 GA - 3.19.0 - and newer)
- No longer uses dataService during the initialization. (System may return an exception.)
- Fixed a "Cannot set property 'i' of undefined" error when updating derived Documents.  

 

Information

Vendor Alexey Andrianov (ADVA Optical Networking SE)
Published Version 3.1.1 - October 2023
Categories
Products
Price Free
875 Downloads
Community Supported Extension This extension is not supported by Siemens PLM.
Requirements Polarion 20 R1 (3.20.1) and newer

Last tested with Polarion 2304 (3.23.4)

Related Extensions