public virtual void addListenerToElement(CmmnModelInstance modelInstance, CmmnModelElementInstance modelElement) { ExtensionElements extensionElements = SpecUtil.createElement(modelInstance, modelElement, null, typeof(ExtensionElements)); CamundaCaseExecutionListener caseExecutionListener = SpecUtil.createElement(modelInstance, extensionElements, null, typeof(CamundaCaseExecutionListener)); if (!ANY_EVENT.Equals(eventNameToRegisterOn)) { caseExecutionListener.CamundaEvent = eventNameToRegisterOn; } configureCaseExecutionListener(modelInstance, caseExecutionListener); foreach (FieldSpec fieldSpec in fieldSpecs) { fieldSpec.addFieldToListenerElement(modelInstance, caseExecutionListener); } }
protected internal override void configureCaseExecutionListener(CmmnModelInstance modelInstance, CamundaCaseExecutionListener listener) { listener.CamundaDelegateExpression = DELEGATE_EXPRESSION; }
protected internal abstract void configureCaseExecutionListener(CmmnModelInstance modelInstance, CamundaCaseExecutionListener listener);
protected internal override void configureCaseExecutionListener(CmmnModelInstance modelInstance, CamundaCaseExecutionListener listener) { listener.CamundaClass = CLASS_NAME; }
protected internal virtual CaseExecutionListener initializeCaseExecutionListener(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, CamundaCaseExecutionListener listener) { ICollection <CamundaField> fields = listener.CamundaFields; IList <FieldDeclaration> fieldDeclarations = initializeFieldDeclarations(element, activity, context, fields); ExpressionManager expressionManager = context.ExpressionManager; CaseExecutionListener caseExecutionListener = null; string className = listener.CamundaClass; string expression = listener.CamundaExpression; string delegateExpression = listener.CamundaDelegateExpression; CamundaScript scriptElement = listener.CamundaScript; if (!string.ReferenceEquals(className, null)) { caseExecutionListener = new ClassDelegateCaseExecutionListener(className, fieldDeclarations); } else if (!string.ReferenceEquals(expression, null)) { Expression expressionExp = expressionManager.createExpression(expression); caseExecutionListener = new ExpressionCaseExecutionListener(expressionExp); } else if (!string.ReferenceEquals(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); }