
org.ow2.bonita.definition.PerformerAssign Maven / Gradle / Ivy
package org.ow2.bonita.definition;
import java.util.Set;
import org.ow2.bonita.facade.QueryAPIAccessor;
import org.ow2.bonita.facade.runtime.ActivityInstance;
/**
* Performer assignment is dedicated to manual activity (ie. activity with startMode=Manual, aka human task).
* Implementing this interface allows to assign the activity to a user of a group.
* Within xpdl definition, the performer assignment feature is specified within
* external attributes of the Activity element.
* There is two parameters to define a performer assignment:
*
* - the type of the performer assignment (ie. custom)
* - the name of the class that implements this interface
*
*
* The {@link #selectUser selectUser()} method to be implemented is called when the execution enters into the node of
* the activity after the creation of the human task and after the execution of
* the {@link RoleMapper role mapper} if there is one.
*
* This task will be assign to the returned user and only this user can get the task.
* In other word, this task is returned by {@link org.ow2.bonita.facade.QueryRuntimeAPI#getTaskList getTaskList() method}
* (with state=READY) only if executed by the assigned user (being authenticated).
*/
public interface PerformerAssign {
/**
* Selecting one user from the candidates list is the good practice.
* Candidates list results from the execution of a role mapper.
* @param accessor The QueryAPIAccessor interface to access: QueryRuntimeAPI or QueryDefinitionAPI.
* @param activityInstance the activity.
* @param candidates The unordered set of user uuid that are candidate to start the task.
* @return The user Id that can start the task.
* @throws Exception If an Exception has occurred.
*/
String selectUser(QueryAPIAccessor accessor, ActivityInstance activityInstance,
Set candidates) throws Exception;
}