Search in sources :

Example 6 with FieldDeclaration

use of org.camunda.bpm.engine.impl.bpmn.parser.FieldDeclaration 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 7 with FieldDeclaration

use of org.camunda.bpm.engine.impl.bpmn.parser.FieldDeclaration in project camunda-bpm-platform by camunda.

the class DelegateExpressionExecutionListenerSpec method verifyListener.

public void verifyListener(DelegateListener<? extends BaseDelegateExecution> listener) {
    assertTrue(listener instanceof DelegateExpressionCaseExecutionListener);
    DelegateExpressionCaseExecutionListener delegateExpressionListener = (DelegateExpressionCaseExecutionListener) listener;
    assertEquals(DELEGATE_EXPRESSION, delegateExpressionListener.getExpressionText());
    List<FieldDeclaration> fieldDeclarations = delegateExpressionListener.getFieldDeclarations();
    assertEquals(fieldSpecs.size(), fieldDeclarations.size());
    for (int i = 0; i < fieldDeclarations.size(); i++) {
        FieldDeclaration declaration = fieldDeclarations.get(i);
        FieldSpec matchingFieldSpec = fieldSpecs.get(i);
        matchingFieldSpec.verify(declaration);
    }
}
Also used : DelegateExpressionCaseExecutionListener(org.camunda.bpm.engine.impl.cmmn.listener.DelegateExpressionCaseExecutionListener) FieldDeclaration(org.camunda.bpm.engine.impl.bpmn.parser.FieldDeclaration)

Aggregations

FieldDeclaration (org.camunda.bpm.engine.impl.bpmn.parser.FieldDeclaration)7 ExpressionManager (org.camunda.bpm.engine.impl.el.ExpressionManager)4 CamundaField (org.camunda.bpm.model.cmmn.instance.camunda.CamundaField)4 Expression (org.camunda.bpm.engine.delegate.Expression)3 ExecutableScript (org.camunda.bpm.engine.impl.scripting.ExecutableScript)3 CamundaScript (org.camunda.bpm.model.cmmn.instance.camunda.CamundaScript)3 CamundaString (org.camunda.bpm.model.cmmn.instance.camunda.CamundaString)3 ClassDelegateCaseExecutionListener (org.camunda.bpm.engine.impl.cmmn.listener.ClassDelegateCaseExecutionListener)2 DelegateExpressionCaseExecutionListener (org.camunda.bpm.engine.impl.cmmn.listener.DelegateExpressionCaseExecutionListener)2 ConditionExpression (org.camunda.bpm.model.cmmn.instance.ConditionExpression)2 CamundaExpression (org.camunda.bpm.model.cmmn.instance.camunda.CamundaExpression)2 ArrayList (java.util.ArrayList)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 ExpressionCaseExecutionListener (org.camunda.bpm.engine.impl.cmmn.listener.ExpressionCaseExecutionListener)1 ScriptCaseExecutionListener (org.camunda.bpm.engine.impl.cmmn.listener.ScriptCaseExecutionListener)1 ClassDelegateTaskListener (org.camunda.bpm.engine.impl.task.listener.ClassDelegateTaskListener)1 DelegateExpressionTaskListener (org.camunda.bpm.engine.impl.task.listener.DelegateExpressionTaskListener)1 ExpressionTaskListener (org.camunda.bpm.engine.impl.task.listener.ExpressionTaskListener)1