Interface AssignmentStrategy


  • public interface AssignmentStrategy
    Task assignment strategy that defines how to select actual owner based on task properties such as potential owners, task data etc. Depending on the strategy implementation additional source of information might be needed e.g. people availability etc. Each strategy must uniquely identify itself as it's placed in the registry for further use.
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      Assignment apply​(org.kie.api.task.model.Task task, org.kie.api.task.TaskContext context, java.lang.String excludedUser)
      Applies the strategy on given task based on concrete implementation details.
      java.lang.String getIdentifier()
      Returns unique identifier of the strategy
      default void taskDone​(org.kie.api.task.model.Task task, org.kie.api.task.TaskContext context)
      Optional method that notifies the strategy about task being done (completed, exited, etc).
    • Method Detail

      • getIdentifier

        java.lang.String getIdentifier()
        Returns unique identifier of the strategy
        Returns:
        identifier to be used for further look ups
      • apply

        Assignment apply​(org.kie.api.task.model.Task task,
                         org.kie.api.task.TaskContext context,
                         java.lang.String excludedUser)
        Applies the strategy on given task based on concrete implementation details.
        Parameters:
        task - task that should be assigned
        context - task context to be able to use various services including PersistenceContext
        excludedUser - user that should be excluded from the assignment as it's the one who performed operation e.g. use who has been assigned to the task and released should not be reassign to it again
        Returns:
        returns single Assignment selected for this task or null if none was found
      • taskDone

        default void taskDone​(org.kie.api.task.model.Task task,
                              org.kie.api.task.TaskContext context)
        Optional method that notifies the strategy about task being done (completed, exited, etc). Mainly for strategies that do maintain state so tasks that are done are removed from assignees' queues
        Parameters:
        task - task that has been done
        context - task context to be able to use various services including PersistenceContext