public class UserTaskHandler extends Object
| Constructor and Description |
|---|
UserTaskHandler(org.camunda.bpm.engine.ProcessEngine processEngine,
String activityId) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
apply(org.camunda.bpm.engine.runtime.ProcessInstance pi) |
void |
complete()
Completes the user task with an action that calls
complete, when the process instance is
waiting at the corresponding activity. |
protected void |
complete(org.camunda.bpm.engine.task.Task task) |
UserTaskHandler |
customize(Consumer<UserTaskHandler> customizer)
Customizes the handler, using the given
Consumer function. |
void |
execute(Consumer<org.camunda.bpm.engine.task.Task> action)
Executes a custom action that handles the user task, when the process instance is waiting at the
corresponding activity.
|
void |
handleBpmnError(String errorCode,
String errorMessage)
Continues the execution with an action that calls
handleBpmnError using the given error
code and message, when the process instance is waiting at the corresponding activity. |
protected void |
handleBpmnError(org.camunda.bpm.engine.task.Task task) |
void |
handleEscalation(String escalationCode)
Continues the execution with an action that calls
handleEscalation using the given
escalation code, when the process instance is waiting at the corresponding activity. |
protected void |
handleEscalation(org.camunda.bpm.engine.task.Task task) |
boolean |
isWaitingForBoundaryEvent()
Determines if the user task is waiting for a boundary message, signal or timer event.
|
UserTaskHandler |
verify(BiConsumer<org.camunda.bpm.engine.test.assertions.bpmn.ProcessInstanceAssert,org.camunda.bpm.engine.test.assertions.bpmn.TaskAssert> verifier)
Verifies the user task's waiting state.
|
void |
waitForBoundaryEvent()
Applies no action at the user task's wait state.
|
UserTaskHandler |
withErrorMessage(String errorMessage)
Sets the error message, which is used when the next activity is an error boundary event - in this
case the handler's action is
handleBpmnError. |
UserTaskHandler |
withVariable(String name,
Object value)
Sets a variable, which is passed to the execution when a predefined behavior (
complete,
handleBpmnError, or handleEscalation) is used. |
UserTaskHandler |
withVariables(Map<String,Object> variables)
Sets variables, which are passed to the execution when a predefined behavior (
complete,
handleBpmnError, or handleEscalation) is used. |
UserTaskHandler |
withVariableTyped(String name,
org.camunda.bpm.engine.variable.value.TypedValue value)
Sets a typed variable, which is passed to the execution when a predefined behavior
(
complete, handleBpmnError, or handleEscalation) is used. |
public UserTaskHandler(org.camunda.bpm.engine.ProcessEngine processEngine,
String activityId)
protected void apply(org.camunda.bpm.engine.runtime.ProcessInstance pi)
public void complete()
complete, when the process instance is
waiting at the corresponding activity. Please note: this is the default behavior.TaskService.complete(String, java.util.Map)protected void complete(org.camunda.bpm.engine.task.Task task)
public UserTaskHandler customize(Consumer<UserTaskHandler> customizer)
Consumer function. This method can be used to
apply a common customization needed for different test cases.
tc.handleUserTask().customize(this::prepareUserTask);
customizer - A function that accepts a UserTaskHandler.public void execute(Consumer<org.camunda.bpm.engine.task.Task> action)
action - A specific action that accepts the related Task.public void handleBpmnError(String errorCode, String errorMessage)
handleBpmnError using the given error
code and message, when the process instance is waiting at the corresponding activity.errorCode - The error code of the attached boundary error event.errorMessage - An error message or null.TaskService.handleBpmnError(String, String, String, java.util.Map)protected void handleBpmnError(org.camunda.bpm.engine.task.Task task)
public void handleEscalation(String escalationCode)
handleEscalation using the given
escalation code, when the process instance is waiting at the corresponding activity.escalationCode - The escalation code of the attached boundary escalation event.TaskService.handleEscalation(String, String, java.util.Map)protected void handleEscalation(org.camunda.bpm.engine.task.Task task)
public boolean isWaitingForBoundaryEvent()
true, if it is waiting for a boundary event. false, if not.public UserTaskHandler verify(BiConsumer<org.camunda.bpm.engine.test.assertions.bpmn.ProcessInstanceAssert,org.camunda.bpm.engine.test.assertions.bpmn.TaskAssert> verifier)
verifier - Verifier that accepts an ProcessInstanceAssert and an TaskAssert
instance.public void waitForBoundaryEvent()
public UserTaskHandler withErrorMessage(String errorMessage)
handleBpmnError.errorMessage - An error message or null.public UserTaskHandler withVariable(String name, Object value)
complete,
handleBpmnError, or handleEscalation) is used.name - The name of the variable.value - The variable's value.complete(),
handleBpmnError(String, String),
handleEscalation(String)public UserTaskHandler withVariables(Map<String,Object> variables)
complete,
handleBpmnError, or handleEscalation) is used.variables - A map of variables to set.complete(),
handleBpmnError(String, String),
handleEscalation(String)public UserTaskHandler withVariableTyped(String name, org.camunda.bpm.engine.variable.value.TypedValue value)
complete, handleBpmnError, or handleEscalation) is used.name - The name of the variable.value - The variable's typed value.complete(),
handleBpmnError(String, String),
handleEscalation(String)Copyright © 2023 Camunda. All rights reserved.