Skip to end of metadata
Go to start of metadata

Introduction

Hooks are midPoint mechanism for injecting a code to or intercepting of normal midPoint flows. E.g. a hook can be used to inset custom notification after an operation is complete, modify the operation request before it is even processed, redirect processing to a workflow or trouble-ticket system or do any other kind of advanced customization magic.

Hooks are typically pieces of Java code that has to be compiled and assembled into midPoint. However there is also a lightweight way to create a hook using a scripting code. Each hook is simply a piece of script code that is executed at the specified moment in the midPoint recompute and execute flow (see Clockwork and Projector). The code can influence the recomputation and execution by manipulating the model context, it can invoke script expression functions, invoke external functions or do almost any other thing.

Scripting Hook Definition

Scripting hooks can be defined in System Configuration Object. The modelHooks element is used the define both heavyweight Java hooks and lightweight scripting hooks. The following code block provides an example of Groovy scripting hook.

Example 1

Following scripting hook removes all assignments from disabled users. Please note usage of modelContext.rot()

 

 

  • No labels