Search in sources :

Example 16 with ExpressionManager

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

the class ItemHandler method initializeVariableListener.

protected CaseVariableListener initializeVariableListener(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, CamundaVariableListener listener) {
    Collection<CamundaField> fields = listener.getCamundaFields();
    List<FieldDeclaration> fieldDeclarations = initializeFieldDeclarations(element, activity, context, fields);
    ExpressionManager expressionManager = context.getExpressionManager();
    String className = listener.getCamundaClass();
    String expression = listener.getCamundaExpression();
    String delegateExpression = listener.getCamundaDelegateExpression();
    CamundaScript scriptElement = listener.getCamundaScript();
    CaseVariableListener variableListener = null;
    if (className != null) {
        variableListener = new ClassDelegateCaseVariableListener(className, fieldDeclarations);
    } else if (expression != null) {
        Expression expressionExp = expressionManager.createExpression(expression);
        variableListener = new ExpressionCaseVariableListener(expressionExp);
    } else if (delegateExpression != null) {
        Expression delegateExp = expressionManager.createExpression(delegateExpression);
        variableListener = new DelegateExpressionCaseVariableListener(delegateExp, fieldDeclarations);
    } else if (scriptElement != null) {
        ExecutableScript executableScript = initializeScript(element, activity, context, scriptElement);
        if (executableScript != null) {
            variableListener = new ScriptCaseVariableListener(executableScript);
        }
    }
    return variableListener;
}
Also used : CamundaField(org.camunda.bpm.model.cmmn.instance.camunda.CamundaField) ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) ScriptCaseVariableListener(org.camunda.bpm.engine.impl.variable.listener.ScriptCaseVariableListener) DelegateExpressionCaseVariableListener(org.camunda.bpm.engine.impl.variable.listener.DelegateExpressionCaseVariableListener) CamundaString(org.camunda.bpm.model.cmmn.instance.camunda.CamundaString) ExpressionCaseVariableListener(org.camunda.bpm.engine.impl.variable.listener.ExpressionCaseVariableListener) DelegateExpressionCaseVariableListener(org.camunda.bpm.engine.impl.variable.listener.DelegateExpressionCaseVariableListener) CaseVariableListener(org.camunda.bpm.engine.delegate.CaseVariableListener) ScriptCaseVariableListener(org.camunda.bpm.engine.impl.variable.listener.ScriptCaseVariableListener) ClassDelegateCaseVariableListener(org.camunda.bpm.engine.impl.variable.listener.ClassDelegateCaseVariableListener) FieldDeclaration(org.camunda.bpm.engine.impl.bpmn.parser.FieldDeclaration) CamundaExpression(org.camunda.bpm.model.cmmn.instance.camunda.CamundaExpression) Expression(org.camunda.bpm.engine.delegate.Expression) ConditionExpression(org.camunda.bpm.model.cmmn.instance.ConditionExpression) ExecutableScript(org.camunda.bpm.engine.impl.scripting.ExecutableScript) ClassDelegateCaseVariableListener(org.camunda.bpm.engine.impl.variable.listener.ClassDelegateCaseVariableListener) ExpressionCaseVariableListener(org.camunda.bpm.engine.impl.variable.listener.ExpressionCaseVariableListener) DelegateExpressionCaseVariableListener(org.camunda.bpm.engine.impl.variable.listener.DelegateExpressionCaseVariableListener) CamundaScript(org.camunda.bpm.model.cmmn.instance.camunda.CamundaScript)

Example 17 with ExpressionManager

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

the class ItemHandler method initializeCaseExecutionListener.

protected CaseExecutionListener initializeCaseExecutionListener(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, CamundaCaseExecutionListener listener) {
    Collection<CamundaField> fields = listener.getCamundaFields();
    List<FieldDeclaration> fieldDeclarations = initializeFieldDeclarations(element, activity, context, fields);
    ExpressionManager expressionManager = context.getExpressionManager();
    CaseExecutionListener caseExecutionListener = null;
    String className = listener.getCamundaClass();
    String expression = listener.getCamundaExpression();
    String delegateExpression = listener.getCamundaDelegateExpression();
    CamundaScript scriptElement = listener.getCamundaScript();
    if (className != null) {
        caseExecutionListener = new ClassDelegateCaseExecutionListener(className, fieldDeclarations);
    } else if (expression != null) {
        Expression expressionExp = expressionManager.createExpression(expression);
        caseExecutionListener = new ExpressionCaseExecutionListener(expressionExp);
    } else if (delegateExpression != null) {
        Expression delegateExp = expressionManager.createExpression(delegateExpression);
        caseExecutionListener = new DelegateExpressionCaseExecutionListener(delegateExp, fieldDeclarations);
    } else if (scriptElement != null) {
        ExecutableScript executableScript = initializeScript(element, activity, context, scriptElement);
        if (executableScript != null) {
            caseExecutionListener = new ScriptCaseExecutionListener(executableScript);
        }
    }
    return caseExecutionListener;
}
Also used : CamundaField(org.camunda.bpm.model.cmmn.instance.camunda.CamundaField) ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) ClassDelegateCaseExecutionListener(org.camunda.bpm.engine.impl.cmmn.listener.ClassDelegateCaseExecutionListener) DelegateExpressionCaseExecutionListener(org.camunda.bpm.engine.impl.cmmn.listener.DelegateExpressionCaseExecutionListener) ExpressionCaseExecutionListener(org.camunda.bpm.engine.impl.cmmn.listener.ExpressionCaseExecutionListener) DelegateExpressionCaseExecutionListener(org.camunda.bpm.engine.impl.cmmn.listener.DelegateExpressionCaseExecutionListener) ScriptCaseExecutionListener(org.camunda.bpm.engine.impl.cmmn.listener.ScriptCaseExecutionListener) ClassDelegateCaseExecutionListener(org.camunda.bpm.engine.impl.cmmn.listener.ClassDelegateCaseExecutionListener) CamundaCaseExecutionListener(org.camunda.bpm.model.cmmn.instance.camunda.CamundaCaseExecutionListener) CaseExecutionListener(org.camunda.bpm.engine.delegate.CaseExecutionListener) ScriptCaseExecutionListener(org.camunda.bpm.engine.impl.cmmn.listener.ScriptCaseExecutionListener) CamundaString(org.camunda.bpm.model.cmmn.instance.camunda.CamundaString) FieldDeclaration(org.camunda.bpm.engine.impl.bpmn.parser.FieldDeclaration) ExpressionCaseExecutionListener(org.camunda.bpm.engine.impl.cmmn.listener.ExpressionCaseExecutionListener) DelegateExpressionCaseExecutionListener(org.camunda.bpm.engine.impl.cmmn.listener.DelegateExpressionCaseExecutionListener) CamundaExpression(org.camunda.bpm.model.cmmn.instance.camunda.CamundaExpression) Expression(org.camunda.bpm.engine.delegate.Expression) ConditionExpression(org.camunda.bpm.model.cmmn.instance.ConditionExpression) ExecutableScript(org.camunda.bpm.engine.impl.scripting.ExecutableScript) CamundaScript(org.camunda.bpm.model.cmmn.instance.camunda.CamundaScript)

Example 18 with ExpressionManager

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

the class ProcessOrCaseTaskItemHandler method initializeInputParameter.

protected void initializeInputParameter(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, CallableElement callableElement) {
    ExpressionManager expressionManager = context.getExpressionManager();
    List<CamundaIn> inputs = getInputs(element);
    for (CamundaIn input : inputs) {
        // businessKey
        String businessKey = input.getCamundaBusinessKey();
        if (businessKey != null && !businessKey.isEmpty()) {
            ParameterValueProvider businessKeyValueProvider = createParameterValueProvider(businessKey, expressionManager);
            callableElement.setBusinessKeyValueProvider(businessKeyValueProvider);
        } else {
            // create new parameter
            CallableElementParameter parameter = new CallableElementParameter();
            callableElement.addInput(parameter);
            if (input.getCamundaLocal()) {
                parameter.setReadLocal(true);
            }
            // all variables
            String variables = input.getCamundaVariables();
            if ("all".equals(variables)) {
                parameter.setAllVariables(true);
                continue;
            }
            // source/sourceExpression
            String source = input.getCamundaSource();
            if (source == null || source.isEmpty()) {
                source = input.getCamundaSourceExpression();
            }
            ParameterValueProvider sourceValueProvider = createParameterValueProvider(source, expressionManager);
            parameter.setSourceValueProvider(sourceValueProvider);
            // target
            String target = input.getCamundaTarget();
            parameter.setTarget(target);
        }
    }
}
Also used : ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) ParameterValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider) CallableElementParameter(org.camunda.bpm.engine.impl.core.model.CallableElementParameter) CamundaIn(org.camunda.bpm.model.cmmn.instance.camunda.CamundaIn)

Example 19 with ExpressionManager

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

the class CallingTaskItemHandler method initializeVersion.

protected void initializeVersion(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, BaseCallableElement callableElement) {
    ExpressionManager expressionManager = context.getExpressionManager();
    String version = getVersion(element, activity, context);
    ParameterValueProvider versionProvider = createParameterValueProvider(version, expressionManager);
    callableElement.setVersionValueProvider(versionProvider);
}
Also used : ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) ParameterValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider)

Example 20 with ExpressionManager

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

the class CallingTaskItemHandler method initializeTenantId.

protected void initializeTenantId(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, BaseCallableElement callableElement) {
    ParameterValueProvider tenantIdProvider;
    ExpressionManager expressionManager = context.getExpressionManager();
    String tenantId = getTenantId(element, activity, context);
    if (tenantId != null && tenantId.length() > 0) {
        tenantIdProvider = createParameterValueProvider(tenantId, expressionManager);
    } else {
        tenantIdProvider = new DefaultCallableElementTenantIdProvider();
    }
    callableElement.setTenantIdProvider(tenantIdProvider);
}
Also used : ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) ParameterValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider) DefaultCallableElementTenantIdProvider(org.camunda.bpm.engine.impl.core.model.DefaultCallableElementTenantIdProvider)

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