Polarion ALM extension to execute validation during save/delete actions

This Polarion extension provides possibility to run custom Java code (via hooks), before Polarion saves/deletes a Work Item, Document, Plan or Test Run.

Important

Starting from version 4.0.0 only latest version of Polarion is supported. Right now it is Polarion 2606.

Quick start

The latest version of the extension can be downloaded from the releases page and installed to Polarion instance without necessity to be compiled from the sources. The extension should be copied to <polarion_home>/polarion/extensions/ch.sbb.polarion.extension.intercaptor-manager/eclipse/plugins and changes will take effect after Polarion restart.

Important

Don't forget to clear <polarion_home>/data/workspace/.config folder after extension installation/update to make it work properly.

Polarion configuration

Interceptor Manager settings/customization

Use Administration -> Interceptor Manager -> Settings page to enable/disable or set specific properties for each existing hook.

Required setting entries

A hook can declare the setting entries it reads, by implementing RequireSettingEntries:

public class MyHook extends ActionHook implements HookExecutor, RequireSettingEntries {

    @Override
    public @NotNull List<String> getRequiredSettingEntryNames() {
        return List.of("projects", "types.*", "errorMessage");
    }
}

The settings page reports every declared entry which the stored settings miss, and refuses to save settings which miss one. This is how an administrator learns that a new hook version added an entry.

Declare each name as it appears in getDefaultSettings(). A * segment stands for any one selector, so types.* accepts types.* and types.myProject alike. The number of segments must match.

Implementing the interface is optional. The settings of a hook which does not implement it are not checked.

Hooks installation

Standalone jar hooks

Copy hook jar to hooks folder (<polarion_home>/polarion/extensions/ch.sbb.polarion.extension.interceptor-manager/eclipse/plugins/hooks) and enforce hooks reloading from the settings page or restart Polarion. By default, newly added hooks are disabled and must be enabled manually.

Hooks from Different Polarion Extension

Hooks can be located in another Polarion extension. In this case, the following two approaches to register the hooks are supported:

REST API

This extension provides REST API. OpenAPI Specification can be obtained here.

Upgrade

Upgrade from version 2.x.x to 3.0.0

Version 3.0.0 has received significant change - project+package rename. Verify you're using the new subfolder name in the extensions folder. Also, this change prevents previous hooks versions from working. They must be replaced with the new ones built especially for v.3.0.0+. Note that doing this will reset hooks settings tho their default values, so do not forget to backup your actual settings to restore them after update.

Upgrade from version 1.x.x to 2.0.0

Version 2.0.0 requires the new hooks model therefore hooks built for 1.x.x will stop working. They must be replaced with the new ones built especially for v.2.0.0+. Also the new version introduced some significant internal settings model changes/improvements which have made old settings data incompatible. This means that during the first run all settings will be reset to their default values ( unfortunately revisions history will be lost too).