コード例 #1
0
        protected internal virtual void initCaseExecutionListeners(CmmnHistoryEventProducer historyEventProducer, HistoryLevel historyLevel)
        {
            CASE_INSTANCE_CREATE_LISTENER = new CaseInstanceCreateListener(historyEventProducer, historyLevel);
            CASE_INSTANCE_UPDATE_LISTENER = new CaseInstanceUpdateListener(historyEventProducer, historyLevel);
            CASE_INSTANCE_CLOSE_LISTENER  = new CaseInstanceCloseListener(historyEventProducer, historyLevel);

            CASE_ACTIVITY_INSTANCE_CREATE_LISTENER = new CaseActivityInstanceCreateListener(historyEventProducer, historyLevel);
            CASE_ACTIVITY_INSTANCE_UPDATE_LISTENER = new CaseActivityInstanceUpdateListener(historyEventProducer, historyLevel);
            CASE_ACTIVITY_INSTANCE_END_LISTENER    = new CaseActivityInstanceEndListener(historyEventProducer, historyLevel);
        }
コード例 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void notify(org.camunda.bpm.engine.delegate.DelegateCaseExecution caseExecution) throws Exception
        public virtual void notify(DelegateCaseExecution caseExecution)
        {
            // Note: we can't cache the result of the expression, because the
            // caseExecution can change: eg. delegateExpression='${mySpringBeanFactory.randomSpringBean()}'
            object @delegate = expression.getValue(caseExecution);

            applyFieldDeclaration(fieldDeclarations, @delegate);

            if (@delegate is CaseExecutionListener)
            {
                CaseExecutionListener listenerInstance = (CaseExecutionListener)@delegate;
                Context.ProcessEngineConfiguration.DelegateInterceptor.handleInvocation(new CaseExecutionListenerInvocation(listenerInstance, caseExecution));
            }
            else
            {
                throw new ProcessEngineException("Delegate expression " + expression + " did not resolve to an implementation of " + typeof(CaseExecutionListener));
            }
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        protected internal virtual void initializeCaseExecutionListeners(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context)
        {
            PlanItemDefinition definition = getDefinition(element);

            IList <CamundaCaseExecutionListener> listeners = queryExtensionElementsByClass(definition, typeof(CamundaCaseExecutionListener));

            foreach (CamundaCaseExecutionListener listener in listeners)
            {
                CaseExecutionListener caseExecutionListener = initializeCaseExecutionListener(element, activity, context, listener);

                string eventName = listener.CamundaEvent;
                if (!string.ReferenceEquals(eventName, null))
                {
                    activity.addListener(eventName, caseExecutionListener);
                }
                else
                {
                    foreach (string @event in getStandardEvents(element))
                    {
                        activity.addListener(@event, caseExecutionListener);
                    }
                }
            }
        }
コード例 #5
0
 public virtual CaseDefinitionBuilder listener(string eventName, CaseExecutionListener planItemListener)
 {
     activityStack.Peek().addListener(eventName, planItemListener);
     return(this);
 }
コード例 #6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void notify(org.camunda.bpm.engine.delegate.DelegateCaseExecution caseExecution) throws Exception
        public virtual void notify(DelegateCaseExecution caseExecution)
        {
            CaseExecutionListener listenerInstance = ListenerInstance;

            Context.ProcessEngineConfiguration.DelegateInterceptor.handleInvocation(new CaseExecutionListenerInvocation(listenerInstance, caseExecution));
        }