Reassigning Leaver tasks in OIM11g
By user12587121 on Oct 24, 2011
The use case
OIM11g allows arbitrarily
complex approval rules to be defined via it's integration with SOA BPEL
workflow. It also allows the management of user lifecycle, for example
the classic joiner-mover-leaver cycle.
So what happens to a user's outstanding approvals if the user leaves the company or for example enters a disabled state for some reason ? Failure to address this point leaves end-user requests stalled, waiting on an approver who may never respond.
Using a combination of OIM11g's event handlers to detect an event and the SOA Workflow Services API one can easily address this by reassigning leaver tasks to some agreed user.
This JDeveloper project implements an OIM11g scheduled task that scans for user's in a Locked state and reassigns their outstanding approval tasks to their manager. The MDS data for the scheduled task is included in the
config directory. The scheduled task can be loaded to OIM as described here. One can use the same technique in an event handler to do the reassignment at the moment where the user enters a Locked or Disabled state. Note that once the user is Disabled one cannot reassign the approval tasks...so we have to make the reassignment action before the user is disabled.
The task scans all users matching the regular expression parameter to the scheduled task. For each such user it uses the
Workflow Services API to recover any tasks assigned to that user that are in the
states--we are only interested in reassigning currently active tasks.
getTasksForUser() method. OIM can recover the parameters (username, password, SOA URL) to
talk to SOA using the following code:
BPELConfig bpelConfig = Platform.getConfiguration().getBPELConfig();
For each task currently
assigned to a target user we use the
reassignTask() method to reassign
the task to the user's manager, or to a hardcoded user if no manager is
configured. The key call to the Workflow Services API is this one, where
wfCtx is the Workflow context and taskSvc is a reference to the task service:
taskSvc.reassignTask(wfCtx, t.getSystemAttributes().getTaskId(), newAssignee);
In the sample code one can see how to go from the BPEL Config object to recovering a task service and workflow context objects that can be used to do this reassignment.
OIM11g allows us to detect and responds to user-lifecycle events in a agile way, ensuring that any business processes in flight are kept moving in the face of user's entering locked, disabled or deleted states.
- SOA Workflow Services Developers Guide: examples of using the Worklist API
- Jar files required for the WorkList Services API. These jar files are available with JDeveloper: Use the Help->Check For Updates menu to install the SOA Extension:
- SOA Workflow Services API Javadoc