use of org.camunda.bpm.model.cmmn.instance.HumanTask in project camunda-bpm-platform by camunda.
the class HumanTaskItemHandler method initializeTaskDefinitionAssignee.
protected void initializeTaskDefinitionAssignee(CmmnElement element, TaskDefinition taskDefinition, CmmnHandlerContext context) {
HumanTask definition = getDefinition(element);
Role performer = definition.getPerformer();
String assignee = null;
if (performer != null) {
assignee = performer.getName();
} else {
assignee = definition.getCamundaAssignee();
}
if (assignee != null) {
ExpressionManager expressionManager = context.getExpressionManager();
Expression assigneeExpression = expressionManager.createExpression(assignee);
taskDefinition.setAssigneeExpression(assigneeExpression);
}
}
use of org.camunda.bpm.model.cmmn.instance.HumanTask in project camunda-bpm-platform by camunda.
the class HumanTaskItemHandler method initializeTaskDefinitionFollowUpDate.
protected void initializeTaskDefinitionFollowUpDate(CmmnElement element, TaskDefinition taskDefinition, CmmnHandlerContext context) {
HumanTask definition = getDefinition(element);
String followUpDate = definition.getCamundaFollowUpDate();
if (followUpDate != null) {
ExpressionManager expressionManager = context.getExpressionManager();
Expression followUpDateExpression = expressionManager.createExpression(followUpDate);
taskDefinition.setFollowUpDateExpression(followUpDateExpression);
}
}
use of org.camunda.bpm.model.cmmn.instance.HumanTask in project camunda-bpm-platform by camunda.
the class HumanTaskItemHandler method initializeTaskListeners.
protected void initializeTaskListeners(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, TaskDefinition taskDefinition) {
HumanTask humanTask = getDefinition(element);
List<CamundaTaskListener> listeners = queryExtensionElementsByClass(humanTask, CamundaTaskListener.class);
for (CamundaTaskListener listener : listeners) {
TaskListener taskListener = initializeTaskListener(element, activity, context, listener);
String eventName = listener.getCamundaEvent();
if (eventName != null) {
taskDefinition.addTaskListener(eventName, taskListener);
} else {
taskDefinition.addTaskListener(TaskListener.EVENTNAME_CREATE, taskListener);
taskDefinition.addTaskListener(TaskListener.EVENTNAME_ASSIGNMENT, taskListener);
taskDefinition.addTaskListener(TaskListener.EVENTNAME_COMPLETE, taskListener);
taskDefinition.addTaskListener(TaskListener.EVENTNAME_DELETE, taskListener);
}
}
}
use of org.camunda.bpm.model.cmmn.instance.HumanTask in project camunda-bpm-platform by camunda.
the class CmmnTransformerTest method testActivityTreeWithOneStageAndNestedHumanTasks.
/**
* +-----------------+ +-----------------+
* | Case1 \ | aCaseDefinition |
* +-------------------+-----------------+ +-----------------+
* | | |
* | +------------------------+ | +-----------------+
* | / X \ | | aCasePlanModel |
* | + +-------+ +-------+ + | +-----------------+
* | | | A | | B | | | ==> |
* | + +-------+ +-------+ + | +-----------------+
* | \ / | | X |
* | +------------------------+ | +-----------------+
* | | / \
* +-------------------------------------+ / \
* +-----------------+ +-----------------+
* | A | | B |
* +-----------------+ +-----------------+
*/
@Test
public void testActivityTreeWithOneStageAndNestedHumanTasks() {
// given
Stage stage = createElement(casePlanModel, "X", Stage.class);
HumanTask humanTaskA = createElement(casePlanModel, "A", HumanTask.class);
HumanTask humanTaskB = createElement(casePlanModel, "B", HumanTask.class);
PlanItem planItemX = createElement(casePlanModel, "PI_X", PlanItem.class);
PlanItem planItemA = createElement(stage, "PI_A", PlanItem.class);
PlanItem planItemB = createElement(stage, "PI_B", PlanItem.class);
planItemX.setDefinition(stage);
planItemA.setDefinition(humanTaskA);
planItemB.setDefinition(humanTaskB);
// when
List<CaseDefinitionEntity> caseDefinitions = transform();
// then
assertEquals(1, caseDefinitions.size());
CaseDefinitionEntity caseDefinition = caseDefinitions.get(0);
List<CmmnActivity> activities = caseDefinition.getActivities();
CmmnActivity casePlanModelActivity = activities.get(0);
List<CmmnActivity> children = casePlanModelActivity.getActivities();
assertEquals(1, children.size());
CmmnActivity planItemStage = children.get(0);
assertEquals(planItemX.getId(), planItemStage.getId());
children = planItemStage.getActivities();
assertEquals(2, children.size());
CmmnActivity childPlanItem = children.get(0);
assertEquals(planItemA.getId(), childPlanItem.getId());
assertTrue(childPlanItem.getActivities().isEmpty());
childPlanItem = children.get(1);
assertEquals(planItemB.getId(), childPlanItem.getId());
assertTrue(childPlanItem.getActivities().isEmpty());
}
use of org.camunda.bpm.model.cmmn.instance.HumanTask in project camunda-bpm-platform by camunda.
the class CmmnTransformerTest method testActivityTreeWithOneHumanTask.
/**
* +-----------------+ +-----------------+
* | Case1 \ | aCaseDefinition |
* +-------------------+---+ +-----------------+
* | | |
* | +-------+ | ==> +-----------------+
* | | A | | | aCasePlanModel |
* | +-------+ | +-----------------+
* | | |
* +-----------------------+ +-----------------+
* | A |
* +-----------------+
*/
@Test
public void testActivityTreeWithOneHumanTask() {
// given
HumanTask humanTask = createElement(casePlanModel, "A", HumanTask.class);
PlanItem planItem = createElement(casePlanModel, "PI_A", PlanItem.class);
planItem.setDefinition(humanTask);
// when
List<CaseDefinitionEntity> caseDefinitions = transform();
// then
assertEquals(1, caseDefinitions.size());
CaseDefinitionEntity caseDefinition = caseDefinitions.get(0);
List<CmmnActivity> activities = caseDefinition.getActivities();
CmmnActivity casePlanModelActivity = activities.get(0);
List<CmmnActivity> planItemActivities = casePlanModelActivity.getActivities();
assertEquals(1, planItemActivities.size());
CmmnActivity child = planItemActivities.get(0);
assertEquals(planItem.getId(), child.getId());
assertTrue(child.getActivities().isEmpty());
}
Aggregations