This feature is available since midPoint 3.7.
MidPoint offers an easy way of starting a task that is similar to a pre-existing one. The pre-existing task is called a template, although it is technically an ordinary task: with an exception that it is not meant to be executed directly.
This is a task template that sets a description for user
userName to the value of
userDescription. These two parameters are expected to be present as extension values in a task that is created from this template.
executionStatus of this task is set to
waiting, so that the task template itself will not be executed. The
userDescription extension items are not present: they are to be inserted into tasks created from this object. Finally, note the
cleanupAfterCompletion: it says that tasks created from this template will be automatically deleted 10 minutes after their completion (i.e. switching into the
Creation of a task from a template
Creation of a templated task is facilitated by two methods among midPoint functions:
The former method expects a list of prism items to be inserted into an extension of newly created task. The latter method is less general but easier to use: it expects a map of extension item name and its (real) value.
So, in our case the usage would look like this:
See also Variables in bulk actions for more information on using bulk actions with variables.
This method is likely to produce a lot of tasks that are relatively short-lived. There is a cleanup task in midPoint that deletes old closed tasks. However, the default setting may cause tasks to stay around for too long.
Therefore there is now a
cleanupAfterCompletion task property that can be used for finer control over the cleanup. This property can be set explicitly to force task cleanup after a specific interval.