Exemple #1
0
        public virtual void handleChildTermination(CmmnActivityExecution execution, CmmnActivityExecution child)
        {
            fireForceUpdate(execution);

            if (execution.Active)
            {
                checkAndCompleteCaseExecution(execution);
            }
            else if (execution.Terminating && isAbleToTerminate(execution))
            {
                string             id           = execution.Id;
                CaseExecutionState currentState = execution.CurrentState;

                if (TERMINATING_ON_TERMINATION.Equals(currentState))
                {
                    execution.performTerminate();
                }
                else if (TERMINATING_ON_EXIT.Equals(currentState))
                {
                    execution.performExit();
                }
                else if (TERMINATING_ON_PARENT_TERMINATION.Equals(currentState))
                {
                    throw LOG.illegalStateTransitionException("parentTerminate", id, TypeName);
                }
                else
                {
                    throw LOG.terminateCaseException(id, currentState);
                }
            }
        }
Exemple #2
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);
                }
            }
        }
Exemple #3
0
        public override void reactivated(CmmnActivityExecution execution)
        {
            if (execution.CaseInstanceExecution)
            {
                CaseExecutionState previousState = execution.PreviousState;

                if (SUSPENDED.Equals(previousState))
                {
                    resumed(execution);
                }
            }

            // at the moment it is not possible to re-activate a case execution
            // because the state "FAILED" is not implemented.
        }
Exemple #4
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);
        }
Exemple #5
0
        public virtual void handleChildSuspension(CmmnActivityExecution execution, CmmnActivityExecution child)
        {
            // if the given execution is not suspending currently, then ignore this notification.
            if (execution.Suspending && isAbleToSuspend(execution))
            {
                string             id           = execution.Id;
                CaseExecutionState currentState = execution.CurrentState;

                if (SUSPENDING_ON_SUSPENSION.Equals(currentState))
                {
                    execution.performSuspension();
                }
                else if (SUSPENDING_ON_PARENT_SUSPENSION.Equals(currentState))
                {
                    execution.performParentSuspension();
                }
                else
                {
                    throw LOG.suspendCaseException(id, currentState);
                }
            }
        }
Exemple #6
0
 public virtual PvmException terminateCaseException(string id, CaseExecutionState currentState)
 {
     return(transitCaseException("terminate", id, currentState));
 }
Exemple #7
0
 public virtual PvmException suspendCaseException(string id, CaseExecutionState currentState)
 {
     return(transitCaseException("suspend", id, currentState));
 }
Exemple #8
0
 public virtual PvmException transitCaseException(string transition, string id, CaseExecutionState currentState)
 {
     return(new PvmException(exceptionMessage("015", caseStateTransitionMessage + "Reason: Expected case execution state to be {terminatingOnTermination|terminatingOnExit} but it was '{}'.", transition, id, currentState)));
 }
Exemple #9
0
 public virtual CaseIllegalStateTransitionException remainingChildException(string transition, string id, string childId, CaseExecutionState childState)
 {
     return(new CaseIllegalStateTransitionException(exceptionMessage("013", caseStateTransitionMessage + "Reason: There is a child case execution with id '{}' in state '{}'", transition, id, childId, childState)));
 }
Exemple #10
0
 public virtual CaseIllegalStateTransitionException unexpectedStateException(string transition, string id, CaseExecutionState expectedState, CaseExecutionState currentState)
 {
     return(new CaseIllegalStateTransitionException(exceptionMessage("011", caseStateTransitionMessage + "Reason: The case execution must be in state '{}' to {}, but it was in state '{}'", transition, id, expectedState, transition, currentState)));
 }
Exemple #11
0
 public virtual CaseIllegalStateTransitionException isAlreadyInStateException(string transition, string id, CaseExecutionState state)
 {
     return(new CaseIllegalStateTransitionException(exceptionMessage("010", caseStateTransitionMessage + "Reason: The case execution is already in state '{}'.", transition, id, state)));
 }
Exemple #12
0
 public virtual CaseInstanceQuery terminated()
 {
     state = org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionState_Fields.TERMINATED;
     return(this);
 }
Exemple #13
0
 public virtual CaseInstanceQuery completed()
 {
     state = org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionState_Fields.COMPLETED;
     return(this);
 }
Exemple #14
0
 public virtual CaseInstanceQuery active()
 {
     state = org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionState_Fields.ACTIVE;
     return(this);
 }
Exemple #15
0
 public virtual CaseExecutionQuery disabled()
 {
     state = org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionState_Fields.DISABLED;
     return(this);
 }
Exemple #16
0
 public virtual CaseExecutionQuery available()
 {
     state = org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionState_Fields.AVAILABLE;
     return(this);
 }