use of org.camunda.bpm.engine.impl.cmmn.listener.ClassDelegateCaseExecutionListener in project camunda-bpm-platform by camunda.
the class ClassExecutionListenerSpec method verifyListener.
public void verifyListener(DelegateListener<? extends BaseDelegateExecution> listener) {
assertTrue(listener instanceof ClassDelegateCaseExecutionListener);
ClassDelegateCaseExecutionListener classDelegateListener = (ClassDelegateCaseExecutionListener) listener;
assertEquals(CLASS_NAME, classDelegateListener.getClassName());
List<FieldDeclaration> fieldDeclarations = classDelegateListener.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);
}
}
use of org.camunda.bpm.engine.impl.cmmn.listener.ClassDelegateCaseExecutionListener 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;
}
Aggregations