Code

As stated previously, any business process object method specified as an allocation function must return a structure of type curam.util.workflow.struct.AllocationTargetList.

As is the case with business methods associated with automatic activities, a failure of the allocation function when a manual activity is executed will cause the Workflow Error Handling strategy to be invoked. This may cause, for example, the activity associated with the failed method to be retried a number of times. Based on this fact the allocation functions associated with the allocation strategies of manual or decision activities should in general not throw exceptions unless an unrecoverable situation occurs.

The application must implement the curam.util.workflow.impl.WorkResolver callback interface to determine how tasks will be allocated in the application. The application property curam.custom.workflow.workresolver must refer to the curam.util.workflow.impl.WorkResolver implementation class in the application as the workflow engine will use this property to determine the correct function to allocate the task.

The curam.util.workflow.impl.WorkResolver class has an overloaded method resolveWork because the various allocation strategy types return the allocation targets in different formats. However this is an implementation detail that developers of custom work resolver classes should not have to deal with especially since the business processing for all versions of the method should be the same.

package curam.util.workflow.impl;
      
      ...
      
      public interface WorkResolver {
      
        void resolveWork(
          final TaskDetails taskDetails,
          final Object allocationTargets,
          final boolean previouslyAllocated);
      
        void resolveWork(
            final TaskDetails taskDetails,
            final Map allocationTargets,
            final boolean previouslyAllocated);
      
        void resolveWork(
            final TaskDetails taskDetails,
            final String allocationTargetID,
            final boolean previouslyAllocated);
            
            ...
      }

To mitigate this issue the curam.core.sl.impl.DefaultWorkResolverAdapter provides a more convenient mechanism for implementing a work resolver. This class implements the different methods and converts their input parameters into allocation target lists allowing developers of custom work resolution logic to extend this class and implement one method that is called regardless of the source of the allocation targets.

package curam.core.sl.impl;
      
      ...
      
      public abstract class DefaultWorkResolverAdapter
        implements curam.util.workflow.impl.WorkResolver {
      
        public abstract void resolveWork(
          final TaskDetails taskDetails,
          final AllocationTargetList allocationTargets,
          final boolean previouslyAllocated);
            
            ...
      }

In addition to this adapter class, the application ships with a work resolver implementation that is used out-of-the-box. This class is called curam.core.sl.impl.DefaultWorkResolver and it also serves as an example of how to extend the adapter.