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.
GUI configuration to display orphaned tasks
To display orphaned tasks in GUI, you can configure object collection with the filter for orphaned tasks.
Object collection looks like
<objectCollection xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3" xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3" xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" oid="32456589-1122-1643-2751-469323287545" version="10">
<collectionRef oid="00000000-0000-0000-0001-000000000007" relation="org:default" type="c:ObjectCollectionType">
<!-- All tasks -->
To add menu item for Orphaned tasks collection to the Server tasks section, add the following configuration to the system configuration.
<collectionRef oid="32456589-1122-1643-2751-469323287545" relation="org:default" type="c:ObjectCollectionType">
<!-- Orphaned tasks -->