com.bea.wli.worklist.api.config
Interface AssignmentHandler

All Known Implementing Classes:
AbstractAssignmentHandlerImpl

public interface AssignmentHandler

Describes an assignment algorithm that can be used to assign a task of a given type to users as candidates for claiming the task. This algorithm may optionally choose to claim the task in the name of a designated candidate user. Implementations of this interface MUST provide a public default (no arg) constructor. Implementations must make no assumptions about the lifecycle of their instances nor their relationship to other instances. Lifecycle is controlled entirely via the initialize() and destroy() methods.


Nested Class Summary
static class AssignmentHandler.Request
          Request object passed to an assignment handler when Worklist is requesting the assignment of a task.
static interface AssignmentHandler.Response
          Response object an assignment handler returns describing the assignment decision that has been made for the task.
 
Method Summary
 AssignmentHandler.Response assignTask(AssignmentHandler.Request request)
          Make assignment decisions for the given task.
 AssignmentHandler.Response assignTaskToNextUser(String currentClaimant, String[] candidateUserIds)
          This method is called only when the action taken is of type AssignToNextUserAction.
 void destroy()
          Release any resources obtained in the call to initialize or calls to assignTask().
 void initialize()
          Initialize this instance in preparation for calls on assignTask()
 boolean isLastCandidateOnList(String currentClaimant, String[] candidateUserIds)
          Indicates if the currentClaimant parameter represents the 'last' candidate on the candidateUserIds list.
 void setProperties(Property[] props)
          Set any properties that were configured with this assignment handler.
 

Method Detail

setProperties

void setProperties(Property[] props)
Set any properties that were configured with this assignment handler. Note that the value should be obtained from the default value of the provided properties.

Parameters:
props -

initialize

void initialize()
                throws ManagementException
Initialize this instance in preparation for calls on assignTask()

Throws:
ManagementException - if any error occurs that would prevent this instance from properly handling calls to assignTask()

assignTask

AssignmentHandler.Response assignTask(AssignmentHandler.Request request)
                                      throws AssignmentException,
                                             ManagementException
Make assignment decisions for the given task. The given list of candidate claimant user names may be used by this method, or ignored. The candidate user name list is derived from the assignee list for the current step of the task, or the assignee list passed to WorklistTaskAdmin.assignTask(). This method MUST NOT actually modify the task to reflect the claimant it chooses (if any) or cause any other side effects to the task. Assignment decisions are communicated back to the caller via the returned Response instance.

Parameters:
request - A Request instance containing the information needed to assign a task.
Returns:
A Response instance indicating any newly calculated assignee list to be used for this task, and any claimant chosen for the task.
Throws:
AssignmentException - if any authorization or logical error happens during assignment.
ManagementException - If any other error occurs during assignment.

assignTaskToNextUser

AssignmentHandler.Response assignTaskToNextUser(String currentClaimant,
                                                String[] candidateUserIds)
                                                throws AssignmentException,
                                                       ManagementException
This method is called only when the action taken is of type AssignToNextUserAction. It is never called for WorklistTaskAdmin.assignTask() method. The method is supposed to find the if the current candidate is last on list. The typical logic is to find the candidate immediately following the current claimant. If currentClaimant == null, this method should pick the first candidate in the candidateUserIds list. If the current claimant is last on the list this method must return null in its response for the caller to make the decision to move on to the next step. AssignToNexUserAction is used to implement the ‘Iterate List’ type of candidate list handling to successively assign a task to a list of users, and have that task stay at a single step until all users have had a chance to interact with the task. This type of ‘candidate list handling’ works in conjunction with an AssignToNextUserAction on the step in order to move through the candidate list for a task. Each time an AssignToNextUserAction is taken, the task is assigned to (and automatically claimed for) the next user in the candidate list. This method MUST NOT actually modify the task to reflect the claimant it chooses (if any) or cause any other side effects to the task. Assignment decisions are communicated back to the caller via the returned Response instance.

Parameters:
currentClaimant - Current claimant of the task.
candidateUserIds - List of user ids for the users that have been designated as candidate claimants for the task. This list is guaranteed to be the same (same users in the same order) from first call to this method in the iteration of the list to the last call.
Returns:
A Response instance indicating any newly calculated assignee list to be used for this task, and any claimant chosen for the task. Implementations are free to traverse the list of candidates in any order they like.
Throws:
AssignmentException - if any authorization or logical error happens during assignment.
ManagementException - If any other error occurs during assignment.

isLastCandidateOnList

boolean isLastCandidateOnList(String currentClaimant,
                              String[] candidateUserIds)
                              throws AssignmentException,
                                     ManagementException
Indicates if the currentClaimant parameter represents the 'last' candidate on the candidateUserIds list. What constitutes the 'last' candidate, and how the candidateUserIds list is traversed is implementation specific.

Parameters:
currentClaimant - Current claimant of the task.
candidateUserIds - List of user ids for the users that have been designated as candidate claimants for the task. This list is guaranteed to be the same (same users in the same order) from first call to this method in the iteration of the list to the last call.
Returns:
True if the currentClaimant is the 'last' candidate on the list.
Throws:
AssignmentException - if any authorization or logical error happens during assignment.
ManagementException - If any other error occurs during assignment.

destroy

void destroy()
             throws ManagementException
Release any resources obtained in the call to initialize or calls to assignTask().

Throws:
ManagementException - If any error occurs releasing resources.