use of org.camunda.bpm.engine.impl.task.TaskDefinition in project camunda-bpm-platform by camunda.
the class CdiEventSupportBpmnParseListener method parseUserTask.
@Override
public void parseUserTask(Element userTaskElement, ScopeImpl scope, ActivityImpl activity) {
addStartEventListener(activity);
addEndEventListener(activity);
UserTaskActivityBehavior activityBehavior = (UserTaskActivityBehavior) activity.getActivityBehavior();
TaskDefinition taskDefinition = activityBehavior.getTaskDefinition();
addTaskCreateListeners(taskDefinition);
addTaskAssignmentListeners(taskDefinition);
addTaskCompleteListeners(taskDefinition);
addTaskDeleteListeners(taskDefinition);
}
use of org.camunda.bpm.engine.impl.task.TaskDefinition in project camunda-bpm-platform by camunda.
the class ProcessApplicationEventParseListener method parseUserTask.
@Override
public void parseUserTask(Element userTaskElement, ScopeImpl scope, ActivityImpl activity) {
addStartEventListener(activity);
addEndEventListener(activity);
UserTaskActivityBehavior activityBehavior = (UserTaskActivityBehavior) activity.getActivityBehavior();
TaskDefinition taskDefinition = activityBehavior.getTaskDefinition();
addTaskCreateListeners(taskDefinition);
addTaskAssignmentListeners(taskDefinition);
addTaskCompleteListeners(taskDefinition);
addTaskDeleteListeners(taskDefinition);
}
use of org.camunda.bpm.engine.impl.task.TaskDefinition in project camunda-bpm-platform by camunda.
the class HistoryParseListener method parseUserTask.
public void parseUserTask(Element userTaskElement, ScopeImpl scope, ActivityImpl activity) {
addActivityHandlers(activity);
if (historyLevel.isHistoryEventProduced(HistoryEventTypes.TASK_INSTANCE_CREATE, null)) {
TaskDefinition taskDefinition = ((UserTaskActivityBehavior) activity.getActivityBehavior()).getTaskDefinition();
taskDefinition.addBuiltInTaskListener(TaskListener.EVENTNAME_ASSIGNMENT, USER_TASK_ASSIGNMENT_HANDLER);
taskDefinition.addBuiltInTaskListener(TaskListener.EVENTNAME_CREATE, USER_TASK_ID_HANDLER);
}
}
use of org.camunda.bpm.engine.impl.task.TaskDefinition in project camunda-bpm-platform by camunda.
the class HumanTaskPlanItemHandlerTest method testAssignmentTaskListenerByDelegateExpression.
@Test
public void testAssignmentTaskListenerByDelegateExpression() {
// given:
ExtensionElements extensionElements = addExtensionElements(humanTask);
CamundaTaskListener taskListener = createElement(extensionElements, null, CamundaTaskListener.class);
String delegateExpression = "${myDelegateExpression}";
String event = TaskListener.EVENTNAME_ASSIGNMENT;
taskListener.setCamundaEvent(event);
taskListener.setCamundaDelegateExpression(delegateExpression);
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
assertEquals(0, activity.getListeners().size());
HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior();
TaskDefinition taskDefinition = behavior.getTaskDefinition();
assertNotNull(taskDefinition);
assertEquals(1, taskDefinition.getTaskListeners().size());
List<TaskListener> createListeners = taskDefinition.getTaskListeners(event);
assertEquals(1, createListeners.size());
TaskListener listener = createListeners.get(0);
assertTrue(listener instanceof DelegateExpressionTaskListener);
DelegateExpressionTaskListener delegateExpressionListener = (DelegateExpressionTaskListener) listener;
assertEquals(delegateExpression, delegateExpressionListener.getExpressionText());
assertTrue(delegateExpressionListener.getFieldDeclarations().isEmpty());
}
use of org.camunda.bpm.engine.impl.task.TaskDefinition in project camunda-bpm-platform by camunda.
the class HumanTaskPlanItemHandlerTest method testCompleteTaskListenerByDelegateExpression.
@Test
public void testCompleteTaskListenerByDelegateExpression() {
// given:
ExtensionElements extensionElements = addExtensionElements(humanTask);
CamundaTaskListener taskListener = createElement(extensionElements, null, CamundaTaskListener.class);
String delegateExpression = "${myDelegateExpression}";
String event = TaskListener.EVENTNAME_COMPLETE;
taskListener.setCamundaEvent(event);
taskListener.setCamundaDelegateExpression(delegateExpression);
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
assertEquals(0, activity.getListeners().size());
HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior();
TaskDefinition taskDefinition = behavior.getTaskDefinition();
assertNotNull(taskDefinition);
assertEquals(1, taskDefinition.getTaskListeners().size());
List<TaskListener> createListeners = taskDefinition.getTaskListeners(event);
assertEquals(1, createListeners.size());
TaskListener listener = createListeners.get(0);
assertTrue(listener instanceof DelegateExpressionTaskListener);
DelegateExpressionTaskListener delegateExpressionListener = (DelegateExpressionTaskListener) listener;
assertEquals(delegateExpression, delegateExpressionListener.getExpressionText());
assertTrue(delegateExpressionListener.getFieldDeclarations().isEmpty());
}
Aggregations