MidPoint 4.2 and later
This feature is available only in midPoint 4.2 and later.
This is a limited midPoint feature. This feature currently supports only some specific use-cases. We are perfectly capable to finish the feature, just the funding for the work is needed. Please consider the possibility for supporting development of this feature by using midPoint Platform subscription. If you are midPoint Platform subscriber and this feature is within the goals of your deployment you may be able to use your subscription to endorse implementation of this feature.
A task is said to be orphaned if it has a link to a parent (its
parent property that contains the identifier of the parent is not null) but no task with given identifier value exists.
We want to do various things with orphaned tasks: at least we need to see them and to delete them - in an automated way, if possible.
Unfortunately, current midPoint query API does not allow us to specify a query that would return a list of orphaned tasks. Therefore we had to devise an alternate way.
We have chosen to employ
policySituation property that is generally useful for such cases. In this property we store a value of
http://midpoint.evolveum.com/xml/ns/public/model/policy/situation#orphaned if and only if the task is orphaned. This is ensured by appropriate policy rule.
Therefore, to mark orphaned tasks as such, one has to provide two things:
- a policy rule that provides the marking,
- a task that would regularly go through all the tasks and update their policy situation.
The policy rule
Generally, policy rules can be assigned or global. In this particular case, global policy rule is the easiest to use. The following is to be included in the system configuration object:
The task that updates policy situation
The following task will update policy situation for tasks. It does a very lightweight "recompute" by skipping everything except for policy rule processing.
<name>Mark orphaned tasks</name>
<targetRef oid="00000000-0000-0000-0000-000000000502" relation="org:default" type="c:ArchetypeType">
<!-- Recomputation task -->
<ownerRef oid="00000000-0000-0000-0000-000000000002" relation="org:default" type="c:UserType">
<!-- administrator -->
Of course, the recurrence should be set appropriately, to run e.g. once a day.