Ejemplo n.º 1
0
            public Void execute(CommandContext commandContext)
            {
                CmmnExecution caseTask = (CmmnExecution)outerInstance.caseService.createCaseExecutionQuery().caseExecutionId(caseExecutionId).singleResult();

                caseTask.terminate();
                return(null);
            }
Ejemplo n.º 2
0
        public override void setCaseInstance(CmmnExecution caseInstance)
        {
            this.caseInstance = (CaseExecutionEntity)caseInstance;

            if (caseInstance != null)
            {
                this.caseInstanceId = this.caseInstance.Id;
            }
        }
Ejemplo n.º 3
0
        protected internal virtual CmmnExecution eventNotificationsStarted(CmmnExecution execution)
        {
            CmmnActivityBehavior behavior = getActivityBehavior(execution);

            triggerBehavior(behavior, execution);

            execution.CurrentState = COMPLETED;

            return(execution);
        }
Ejemplo n.º 4
0
        protected internal virtual CmmnExecution findFirstLeaf(CmmnExecution execution)
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.List<? extends org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution> executions = execution.getCaseExecutions();
            IList <CmmnExecution> executions = execution.CaseExecutions;

            if (executions.Count > 0)
            {
                return(findFirstLeaf(executions[0]));
            }
            return(execution);
        }
Ejemplo n.º 5
0
        public override void setCaseExecution(CmmnExecution caseExecution)
        {
            this.caseExecution = (CaseExecutionEntity)caseExecution;

            if (caseExecution != null)
            {
                caseExecutionId = caseExecution.Id;
            }
            else
            {
                caseExecutionId = null;
            }
        }
Ejemplo n.º 6
0
        public virtual void execute(CmmnExecution execution)
        {
            CmmnExecution firstLeaf = findFirstLeaf(execution);

            firstLeaf.remove();

            CmmnExecution parent = firstLeaf.Parent;

            if (parent != null)
            {
                parent.deleteCascade();
            }
        }
Ejemplo n.º 7
0
        public override void setParent(CmmnExecution parent)
        {
            this.parent = (CaseExecutionEntity)parent;

            if (parent != null)
            {
                this.parentId = parent.Id;
            }
            else
            {
                this.parentId = null;
            }
        }
Ejemplo n.º 8
0
        public virtual CmmnCaseInstance createCaseInstance(string businessKey)
        {
            // create a new case instance
            CmmnExecution caseInstance = newCaseInstance();

            // set the definition...
            caseInstance.CaseDefinition = this;
            // ... and the case instance (identity)
            caseInstance.CaseInstance = caseInstance;

            // set the business key
            caseInstance.BusinessKey = businessKey;

            // get the case plan model as "initial" activity
            CmmnActivity casePlanModel = Activities[0];

            // set the case plan model activity
            caseInstance.Activity = casePlanModel;

            return(caseInstance);
        }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
0
        protected internal virtual void terminateChild(CmmnExecution child)
        {
            CmmnActivityBehavior behavior = getActivityBehavior(child);

            // "child.isTerminated()": during resuming the children, it can
            // happen that a sentry will be satisfied, so that a child
            // will terminated. these terminated child cannot be resumed,
            // so ignore it.
            // "child.isCompleted()": in case that an exitCriteria on caseInstance
            // (ie. casePlanModel) has been fired, when a child inside has been
            // completed, so ignore it.
            if (!child.Terminated && !child.Completed)
            {
                if (behavior is StageOrTaskActivityBehavior)
                {
                    child.exit();
                }
                else
                {   // behavior instanceof EventListenerOrMilestoneActivityBehavior
                    child.parentTerminate();
                }
            }
        }
Ejemplo n.º 11
0
 public virtual bool isAsync(CmmnExecution execution)
 {
     return(false);
 }
Ejemplo n.º 12
0
 public virtual void completingSubCaseError(CmmnExecution execution, Exception cause)
 {
     logError("001", "Error while completing sub case of case execution '{}'. Reason: '{}'", execution, cause.Message, cause);
 }
Ejemplo n.º 13
0
 public virtual ProcessEngineException completingSubCaseErrorException(CmmnExecution execution, Exception cause)
 {
     return(new ProcessEngineException(exceptionMessage("002", "Error while completing sub case of case execution '{}'.", execution), cause));
 }
Ejemplo n.º 14
0
 public override void setParent(CmmnExecution parent)
 {
     this.parent = (CaseExecutionImpl)parent;
 }
Ejemplo n.º 15
0
 public override void setSuperCaseExecution(CmmnExecution superCaseExecution)
 {
     this.superCaseExecution = (CaseExecutionImpl)superCaseExecution;
 }
Ejemplo n.º 16
0
 public override void setSubCaseInstance(CmmnExecution subCaseInstance)
 {
     this.subCaseInstance = (CaseExecutionImpl)subCaseInstance;
 }
Ejemplo n.º 17
0
 protected internal abstract void triggerBehavior(CmmnActivityBehavior behavior, CmmnExecution execution);
Ejemplo n.º 18
0
 public override void setCaseInstance(CmmnExecution caseInstance)
 {
     this.caseInstance = (CaseExecutionImpl)caseInstance;
 }
Ejemplo n.º 19
0
        protected internal override void postTransitionNotification(CmmnExecution execution)
        {
            if (!execution.CaseInstanceExecution)
            {
                execution.remove();
            }
            else
            {
                CmmnExecution    superCaseExecution = execution.SuperCaseExecution;
                PvmExecutionImpl superExecution     = execution.SuperExecution;

                if (superCaseExecution != null)
                {
                    TransferVariablesActivityBehavior behavior = (TransferVariablesActivityBehavior)getActivityBehavior(superCaseExecution);
                    behavior.transferVariables(execution, superCaseExecution);
                    superCaseExecution.complete();
                }
                else if (superExecution != null)
                {
                    SubProcessActivityBehavior behavior = (SubProcessActivityBehavior)getActivityBehavior(superExecution);

                    try
                    {
                        behavior.passOutputVariables(superExecution, execution);
                    }
                    catch (Exception e)
                    {
                        LOG.completingSubCaseError(execution, e);
                        throw e;
                    }
                    catch (Exception e)
                    {
                        LOG.completingSubCaseError(execution, e);
                        throw LOG.completingSubCaseErrorException(execution, e);
                    }

                    // set sub case instance to null
                    superExecution.SubCaseInstance = null;

                    try
                    {
                        behavior.completed(superExecution);
                    }
                    catch (Exception e)
                    {
                        LOG.completingSubCaseError(execution, e);
                        throw e;
                    }
                    catch (Exception e)
                    {
                        LOG.completingSubCaseError(execution, e);
                        throw LOG.completingSubCaseErrorException(execution, e);
                    }
                }

                execution.SuperCaseExecution = null;
                execution.SuperExecution     = null;
            }

            CmmnExecution parent = execution.Parent;

            if (parent != null)
            {
                CmmnActivityBehavior behavior = getActivityBehavior(parent);
                if (behavior is CmmnCompositeActivityBehavior)
                {
                    CmmnCompositeActivityBehavior compositeBehavior = (CmmnCompositeActivityBehavior)behavior;
                    compositeBehavior.handleChildCompletion(parent, execution);
                }
            }
        }