Dynamic assignment – required methods implementation

Any class that implements the DynamicUserAssignmentStrategy interface (or the Group version) must provide implementations of the following methods.

getCandidateUsers
Your implementation of the getCandidateUsers method must return the set of users to consider for assignment. (As elsewhere, the Group parameter establishes the root group to use to find the users under consideration. The Boolean includeSubGroups parameter indicates whether to include users belonging to descendant groups, or only those that are members of the parent group.)
getLocksForAssignable
The getLocksForAssignable method takes the set of users returned by getCandidateUsers and returns a set of entities that you must lock. By locked, Guidewire means that the current server node obtains the database rows corresponding to those entities, which must be persistent entities. Any other server nodes that needs to access these rows must wait until the assignment process finishes. Round-robin and dynamic assignment require this sort of locking to mandate that multiple nodes do not perform simultaneous assignments. This ensures that multiple nodes do not perform simultaneous assignments and assign multiple activities (for example) to the same person, instead of progressing through the set of candidates.
findUserToAssign
Your implementation of the findUserToAssign method must perform the actual assignment work, using the two sets of entities returned by the previous two methods. (That is, it takes a set of users and the set of entities for which you need to lock the database rows and performs that actual assignment.) This method must do the following:
  • It makes any necessary state modifications (such as updating counters, and similar operations).
  • It returns the GroupUser entity representing the selected User and Group.
Make any modifications to items such as load count, for example, to entities in the bundle of the assignable. This ensures that PolicyCenter commits the modifications at the same time as it commits the assignment change.
rollbackAssignment
Guidewire provides the final two API methods to deal with situations in which, after the assignment flow, some problem in the bundle commit blocks the assignment. This can happen, for example, if a validation rule caused a database rollback. However, at this point, PolicyCenter has already updated the locked objects and committed the objects to the database (as in step 6 in the assignment flow).
If the bundle commit does not succeed, PolicyCenter calls the rollbackAssignment method automatically. Construct your implementation of this method to return true if it succeeds in rolling back the state numbers, and false otherwise.
In the event that the assignment does not get saved, you have the opportunity in your implementation of this method to re-adjust the load numbers.
getAssignmentToken
If the rollbackAssignment method returns false, then PolicyCenter calls the getAssignmentToken method. Your implementation of this method must return some object that you can use to preserve the results of the assignment operation.
The basic idea is that in the event that it is not possible to commit an assignment, your logic does one of the following:
  • PolicyCenter rolls back any database changes that you made.
  • PolicyCenter preserves the assignment in the event that you invoke the assignment logic again.