Search in sources :

Example 1 with CamundaScript

use of org.camunda.bpm.model.cmmn.instance.camunda.CamundaScript in project camunda-bpm-platform by camunda.

the class HumanTaskItemHandler method initializeTaskListener.

protected TaskListener initializeTaskListener(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, CamundaTaskListener listener) {
    Collection<CamundaField> fields = listener.getCamundaFields();
    List<FieldDeclaration> fieldDeclarations = initializeFieldDeclarations(element, activity, context, fields);
    ExpressionManager expressionManager = context.getExpressionManager();
    TaskListener taskListener = null;
    String className = listener.getCamundaClass();
    String expression = listener.getCamundaExpression();
    String delegateExpression = listener.getCamundaDelegateExpression();
    CamundaScript scriptElement = listener.getCamundaScript();
    if (className != null) {
        taskListener = new ClassDelegateTaskListener(className, fieldDeclarations);
    } else if (expression != null) {
        Expression expressionExp = expressionManager.createExpression(expression);
        taskListener = new ExpressionTaskListener(expressionExp);
    } else if (delegateExpression != null) {
        Expression delegateExp = expressionManager.createExpression(delegateExpression);
        taskListener = new DelegateExpressionTaskListener(delegateExp, fieldDeclarations);
    } else if (scriptElement != null) {
        ExecutableScript executableScript = initializeScript(element, activity, context, scriptElement);
        if (executableScript != null) {
            taskListener = new ScriptTaskListener(executableScript);
        }
    }
    return taskListener;
}
Also used : CamundaField(org.camunda.bpm.model.cmmn.instance.camunda.CamundaField) ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) DelegateExpressionTaskListener(org.camunda.bpm.engine.impl.task.listener.DelegateExpressionTaskListener) FieldDeclaration(org.camunda.bpm.engine.impl.bpmn.parser.FieldDeclaration) Expression(org.camunda.bpm.engine.delegate.Expression) ExpressionTaskListener(org.camunda.bpm.engine.impl.task.listener.ExpressionTaskListener) DelegateExpressionTaskListener(org.camunda.bpm.engine.impl.task.listener.DelegateExpressionTaskListener) CamundaTaskListener(org.camunda.bpm.model.cmmn.instance.camunda.CamundaTaskListener) ExpressionTaskListener(org.camunda.bpm.engine.impl.task.listener.ExpressionTaskListener) ClassDelegateTaskListener(org.camunda.bpm.engine.impl.task.listener.ClassDelegateTaskListener) TaskListener(org.camunda.bpm.engine.delegate.TaskListener) DelegateExpressionTaskListener(org.camunda.bpm.engine.impl.task.listener.DelegateExpressionTaskListener) ScriptTaskListener(org.camunda.bpm.engine.impl.task.listener.ScriptTaskListener) ExecutableScript(org.camunda.bpm.engine.impl.scripting.ExecutableScript) ClassDelegateTaskListener(org.camunda.bpm.engine.impl.task.listener.ClassDelegateTaskListener) ScriptTaskListener(org.camunda.bpm.engine.impl.task.listener.ScriptTaskListener) CamundaScript(org.camunda.bpm.model.cmmn.instance.camunda.CamundaScript)

Example 2 with CamundaScript

use of org.camunda.bpm.model.cmmn.instance.camunda.CamundaScript in project camunda-bpm-platform by camunda.

the class ScriptExecutionListenerSpec method configureCaseExecutionListener.

protected void configureCaseExecutionListener(CmmnModelInstance modelInstance, CamundaCaseExecutionListener listener) {
    CamundaScript script = SpecUtil.createElement(modelInstance, listener, null, CamundaScript.class);
    String scriptValue = "${myScript}";
    script.setCamundaScriptFormat(SCRIPT_FORMAT);
    script.setTextContent(scriptValue);
}
Also used : CamundaScript(org.camunda.bpm.model.cmmn.instance.camunda.CamundaScript)

Example 3 with CamundaScript

use of org.camunda.bpm.model.cmmn.instance.camunda.CamundaScript 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 4 with CamundaScript

use of org.camunda.bpm.model.cmmn.instance.camunda.CamundaScript 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 5 with CamundaScript

use of org.camunda.bpm.model.cmmn.instance.camunda.CamundaScript in project camunda-cmmn-model by camunda.

the class CamundaScriptImpl method registerType.

public static void registerType(ModelBuilder modelBuilder) {
    ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(CamundaScript.class, CAMUNDA_ELEMENT_SCRIPT).namespaceUri(CAMUNDA_NS).instanceProvider(new ModelTypeInstanceProvider<CamundaScript>() {

        public CamundaScript newInstance(ModelTypeInstanceContext instanceContext) {
            return new CamundaScriptImpl(instanceContext);
        }
    });
    camundaScriptFormatAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_SCRIPT_FORMAT).namespace(CAMUNDA_NS).build();
    camundaResourceAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_RESOURCE).namespace(CAMUNDA_NS).build();
    typeBuilder.build();
}
Also used : ModelElementTypeBuilder(org.camunda.bpm.model.xml.type.ModelElementTypeBuilder) ModelTypeInstanceContext(org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext) CamundaScript(org.camunda.bpm.model.cmmn.instance.camunda.CamundaScript)

Aggregations

CamundaScript (org.camunda.bpm.model.cmmn.instance.camunda.CamundaScript)5 Expression (org.camunda.bpm.engine.delegate.Expression)3 FieldDeclaration (org.camunda.bpm.engine.impl.bpmn.parser.FieldDeclaration)3 ExpressionManager (org.camunda.bpm.engine.impl.el.ExpressionManager)3 ExecutableScript (org.camunda.bpm.engine.impl.scripting.ExecutableScript)3 CamundaField (org.camunda.bpm.model.cmmn.instance.camunda.CamundaField)3 ConditionExpression (org.camunda.bpm.model.cmmn.instance.ConditionExpression)2 CamundaExpression (org.camunda.bpm.model.cmmn.instance.camunda.CamundaExpression)2 CamundaString (org.camunda.bpm.model.cmmn.instance.camunda.CamundaString)2 CaseExecutionListener (org.camunda.bpm.engine.delegate.CaseExecutionListener)1 CaseVariableListener (org.camunda.bpm.engine.delegate.CaseVariableListener)1 TaskListener (org.camunda.bpm.engine.delegate.TaskListener)1 ClassDelegateCaseExecutionListener (org.camunda.bpm.engine.impl.cmmn.listener.ClassDelegateCaseExecutionListener)1 DelegateExpressionCaseExecutionListener (org.camunda.bpm.engine.impl.cmmn.listener.DelegateExpressionCaseExecutionListener)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 ScriptTaskListener (org.camunda.bpm.engine.impl.task.listener.ScriptTaskListener)1