Ejemplo n.º 1
0
        // helper //////////////////////////////////////////////////////////////////////

        protected internal virtual void ensureTransitionAllowed(CmmnActivityExecution execution, CaseExecutionState expected, CaseExecutionState target, string transition)
        {
            string id = execution.Id;

            CaseExecutionState currentState = execution.CurrentState;

            // the state "suspending" or "terminating" will set immediately
            // inside the corresponding AtomicOperation, that's why the
            // previous state will be used to ensure that the transition
            // is allowed.
            if (execution.Terminating || execution.Suspending)
            {
                currentState = execution.PreviousState;
            }

            // is the case execution already in the target state
            if (target.Equals(currentState))
            {
                throw LOG.isAlreadyInStateException(transition, id, target);
            }
            else
            {
                // is the case execution in the expected state
                if (!expected.Equals(currentState))
                {
                    throw LOG.unexpectedStateException(transition, id, expected, currentState);
                }
            }
        }
Ejemplo n.º 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 planItem) throws Exception
        public virtual void notify(DelegateCaseExecution planItem)
        {
            CmmnExecution execution = (CmmnExecution)planItem;

            string activityId = execution.EventSource.Id;

            CaseExecutionState previousState     = execution.PreviousState;
            string             previousStateName = "()";

            if (!previousState.Equals(org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionState_Fields.NEW))
            {
                previousStateName = previousState.ToString();
            }

            CaseExecutionState newState = execution.CurrentState;

            string stateTransition = previousStateName + " --" + execution.EventName + "(" + activityId + ")--> " + newState;

            LOG.debug("collecting state transition: " + stateTransition);

            stateTransitions.Add(stateTransition);
        }