Search in sources :

Example 56 with Expression

use of org.camunda.bpm.engine.delegate.Expression 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 57 with Expression

use of org.camunda.bpm.engine.delegate.Expression 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)

Example 58 with Expression

use of org.camunda.bpm.engine.delegate.Expression in project camunda-bpm-platform by camunda.

the class HumanTaskItemHandler method initializeTaskDefinitionFormKey.

protected void initializeTaskDefinitionFormKey(CmmnElement element, TaskDefinition taskDefinition, CmmnHandlerContext context) {
    HumanTask definition = getDefinition(element);
    String formKey = definition.getCamundaFormKey();
    if (formKey != null) {
        ExpressionManager expressionManager = context.getExpressionManager();
        Expression formKeyExpression = expressionManager.createExpression(formKey);
        taskDefinition.setFormKey(formKeyExpression);
    }
}
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 59 with Expression

use of org.camunda.bpm.engine.delegate.Expression in project camunda-bpm-platform by camunda.

the class HumanTaskItemHandler method initializeTaskDefinitionPriority.

protected void initializeTaskDefinitionPriority(CmmnElement element, TaskDefinition taskDefinition, CmmnHandlerContext context) {
    HumanTask definition = getDefinition(element);
    String priority = definition.getCamundaPriority();
    if (priority != null) {
        ExpressionManager expressionManager = context.getExpressionManager();
        Expression priorityExpression = expressionManager.createExpression(priority);
        taskDefinition.setPriorityExpression(priorityExpression);
    }
}
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 60 with Expression

use of org.camunda.bpm.engine.delegate.Expression in project camunda-bpm-platform by camunda.

the class TaskDecorator method initializeTaskCandidateUsers.

@SuppressWarnings({ "rawtypes", "unchecked" })
protected void initializeTaskCandidateUsers(TaskEntity task, VariableScope variableScope) {
    Set<Expression> candidateUserIdExpressions = taskDefinition.getCandidateUserIdExpressions();
    for (Expression userIdExpr : candidateUserIdExpressions) {
        Object value = userIdExpr.getValue(variableScope);
        if (value instanceof String) {
            List<String> candiates = extractCandidates((String) value);
            task.addCandidateUsers(candiates);
        } else if (value instanceof Collection) {
            task.addCandidateUsers((Collection) value);
        } else {
            throw new ProcessEngineException("Expression did not resolve to a string or collection of strings");
        }
    }
}
Also used : Expression(org.camunda.bpm.engine.delegate.Expression) Collection(java.util.Collection) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Aggregations

Expression (org.camunda.bpm.engine.delegate.Expression)62 ConditionExpression (org.camunda.bpm.model.cmmn.instance.ConditionExpression)18 Test (org.junit.Test)15 CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)14 ExpressionManager (org.camunda.bpm.engine.impl.el.ExpressionManager)14 HumanTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.HumanTaskActivityBehavior)12 TaskDefinition (org.camunda.bpm.engine.impl.task.TaskDefinition)12 HumanTask (org.camunda.bpm.model.cmmn.instance.HumanTask)8 ArrayList (java.util.ArrayList)4 Date (java.util.Date)4 CmmnIfPartDeclaration (org.camunda.bpm.engine.impl.cmmn.model.CmmnIfPartDeclaration)4 IdentityLink (org.camunda.bpm.engine.task.IdentityLink)4 CamundaField (org.camunda.bpm.model.cmmn.instance.camunda.CamundaField)4 FieldDeclaration (org.camunda.bpm.engine.impl.bpmn.parser.FieldDeclaration)3 CaseControlRuleImpl (org.camunda.bpm.engine.impl.cmmn.behavior.CaseControlRuleImpl)3 CmmnSentryDeclaration (org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration)3 ExecutableScript (org.camunda.bpm.engine.impl.scripting.ExecutableScript)3 CamundaExpression (org.camunda.bpm.model.cmmn.instance.camunda.CamundaExpression)3 CamundaString (org.camunda.bpm.model.cmmn.instance.camunda.CamundaString)3 Collection (java.util.Collection)2