Search in sources :

Example 21 with ExpressionManager

use of org.camunda.bpm.engine.impl.el.ExpressionManager in project camunda-bpm-platform by camunda.

the class HumanTaskItemHandler method initializeActivity.

@Override
protected void initializeActivity(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
    // execute standard initialization
    super.initializeActivity(element, activity, context);
    // create a taskDefinition
    TaskDefinition taskDefinition = createTaskDefinition(element, context);
    // get the caseDefinition...
    CaseDefinitionEntity caseDefinition = (CaseDefinitionEntity) context.getCaseDefinition();
    // ... and taskDefinition to caseDefinition
    caseDefinition.getTaskDefinitions().put(taskDefinition.getKey(), taskDefinition);
    ExpressionManager expressionManager = context.getExpressionManager();
    // create decorator
    TaskDecorator taskDecorator = new TaskDecorator(taskDefinition, expressionManager);
    // set taskDecorator on behavior
    HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior();
    behavior.setTaskDecorator(taskDecorator);
    // task listeners
    initializeTaskListeners(element, activity, context, taskDefinition);
}
Also used : ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) TaskDecorator(org.camunda.bpm.engine.impl.task.TaskDecorator) TaskDefinition(org.camunda.bpm.engine.impl.task.TaskDefinition) CaseDefinitionEntity(org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity) HumanTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.HumanTaskActivityBehavior)

Example 22 with ExpressionManager

use of org.camunda.bpm.engine.impl.el.ExpressionManager in project camunda-bpm-platform by camunda.

the class HumanTaskItemHandler method initializeTaskDefinitionCandidateUsers.

protected void initializeTaskDefinitionCandidateUsers(CmmnElement element, TaskDefinition taskDefinition, CmmnHandlerContext context) {
    HumanTask definition = getDefinition(element);
    ExpressionManager expressionManager = context.getExpressionManager();
    List<String> candidateUsers = definition.getCamundaCandidateUsersList();
    for (String candidateUser : candidateUsers) {
        Expression candidateUserExpression = expressionManager.createExpression(candidateUser);
        taskDefinition.addCandidateUserIdExpression(candidateUserExpression);
    }
}
Also used : ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) Expression(org.camunda.bpm.engine.delegate.Expression) HumanTask(org.camunda.bpm.model.cmmn.instance.HumanTask)

Example 23 with ExpressionManager

use of org.camunda.bpm.engine.impl.el.ExpressionManager in project camunda-bpm-platform by camunda.

the class HumanTaskItemHandler method initializeTaskDefinitionCandidateGroups.

protected void initializeTaskDefinitionCandidateGroups(CmmnElement element, TaskDefinition taskDefinition, CmmnHandlerContext context) {
    HumanTask definition = getDefinition(element);
    ExpressionManager expressionManager = context.getExpressionManager();
    List<String> candidateGroups = definition.getCamundaCandidateGroupsList();
    for (String candidateGroup : candidateGroups) {
        Expression candidateGroupExpression = expressionManager.createExpression(candidateGroup);
        taskDefinition.addCandidateGroupIdExpression(candidateGroupExpression);
    }
}
Also used : ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) Expression(org.camunda.bpm.engine.delegate.Expression) HumanTask(org.camunda.bpm.model.cmmn.instance.HumanTask)

Example 24 with ExpressionManager

use of org.camunda.bpm.engine.impl.el.ExpressionManager in project camunda-bpm-platform by camunda.

the class HumanTaskItemHandler method initializeTaskDefinitionDueDate.

protected void initializeTaskDefinitionDueDate(CmmnElement element, TaskDefinition taskDefinition, CmmnHandlerContext context) {
    HumanTask definition = getDefinition(element);
    String dueDate = definition.getCamundaDueDate();
    if (dueDate != null) {
        ExpressionManager expressionManager = context.getExpressionManager();
        Expression dueDateExpression = expressionManager.createExpression(dueDate);
        taskDefinition.setDueDateExpression(dueDateExpression);
    }
}
Also used : ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) Expression(org.camunda.bpm.engine.delegate.Expression) HumanTask(org.camunda.bpm.model.cmmn.instance.HumanTask)

Example 25 with ExpressionManager

use of org.camunda.bpm.engine.impl.el.ExpressionManager in project camunda-bpm-platform by camunda.

the class HumanTaskItemHandler method initializeTaskDescription.

protected void initializeTaskDescription(CmmnElement element, TaskDefinition taskDefinition, CmmnHandlerContext context) {
    String description = getDesciption(element);
    if (description != null && !description.isEmpty()) {
        ExpressionManager expressionManager = context.getExpressionManager();
        Expression descriptionExpression = expressionManager.createExpression(description);
        taskDefinition.setDescriptionExpression(descriptionExpression);
    } else {
        String documentation = getDocumentation(element);
        if (documentation != null && !documentation.isEmpty()) {
            ExpressionManager expressionManager = context.getExpressionManager();
            Expression documentationExpression = expressionManager.createExpression(documentation);
            taskDefinition.setDescriptionExpression(documentationExpression);
        }
    }
}
Also used : ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) Expression(org.camunda.bpm.engine.delegate.Expression)

Aggregations

ExpressionManager (org.camunda.bpm.engine.impl.el.ExpressionManager)27 Expression (org.camunda.bpm.engine.delegate.Expression)14 HumanTask (org.camunda.bpm.model.cmmn.instance.HumanTask)8 ParameterValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider)5 FieldDeclaration (org.camunda.bpm.engine.impl.bpmn.parser.FieldDeclaration)4 ConditionExpression (org.camunda.bpm.model.cmmn.instance.ConditionExpression)4 CamundaString (org.camunda.bpm.model.cmmn.instance.camunda.CamundaString)4 ExecutableScript (org.camunda.bpm.engine.impl.scripting.ExecutableScript)3 CamundaExpression (org.camunda.bpm.model.cmmn.instance.camunda.CamundaExpression)3 CamundaField (org.camunda.bpm.model.cmmn.instance.camunda.CamundaField)3 CamundaScript (org.camunda.bpm.model.cmmn.instance.camunda.CamundaScript)3 HumanTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.HumanTaskActivityBehavior)2 CaseDefinitionEntity (org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity)2 CallableElementParameter (org.camunda.bpm.engine.impl.core.model.CallableElementParameter)2 TaskDefinition (org.camunda.bpm.engine.impl.task.TaskDefinition)2 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 CaseExecutionListener (org.camunda.bpm.engine.delegate.CaseExecutionListener)1 CaseVariableListener (org.camunda.bpm.engine.delegate.CaseVariableListener)1 TaskListener (org.camunda.bpm.engine.delegate.TaskListener)1 NotValidException (org.camunda.bpm.engine.exception.NotValidException)1