예제 #1
0
        public override CaseExecutionEntity createSubCaseInstance(CmmnCaseDefinition caseDefinition, string businessKey)
        {
            CaseExecutionEntity subCaseInstance = (CaseExecutionEntity)caseDefinition.createCaseInstance(businessKey);

            // inherit the tenant-id from the case definition
            string tenantId = ((CaseDefinitionEntity)caseDefinition).TenantId;

            if (!string.ReferenceEquals(tenantId, null))
            {
                subCaseInstance.TenantId = tenantId;
            }
            else
            {
                // if case definition has no tenant id, inherit this case instance's tenant id
                subCaseInstance.TenantId = this.tenantId;
            }

            // manage bidirectional super-sub-case-instances relation
            subCaseInstance.SuperCaseExecution = this;
            setSubCaseInstance(subCaseInstance);

            fireHistoricCaseActivityInstanceUpdate();

            return(subCaseInstance);
        }
예제 #2
0
 protected internal virtual void ensureSourceCaseExecutionInitialized()
 {
     if ((sourceCaseExecution == null) && (!string.ReferenceEquals(sourceCaseExecutionId, null)))
     {
         sourceCaseExecution = findCaseExecutionById(sourceCaseExecutionId);
     }
 }
예제 #3
0
        protected internal override CaseExecutionEntity createCaseExecution(CmmnActivity activity)
        {
            CaseExecutionEntity child = newCaseExecution();

            // set activity to execute
            child.Activity = activity;

            // handle child/parent-relation
            child.setParent(this);
            CaseExecutionsInternal.Add(child);

            // set case instance
            child.setCaseInstance(getCaseInstance());

            // set case definition
            child.CaseDefinition = CaseDefinition;

            // inherit the tenant id from parent case execution
            if (!string.ReferenceEquals(tenantId, null))
            {
                child.TenantId = tenantId;
            }

            return(child);
        }
예제 #4
0
 protected internal virtual void ensureCaseInstanceInitialized()
 {
     if ((caseInstance == null) && (!string.ReferenceEquals(caseInstanceId, null)))
     {
         caseInstance = findCaseExecutionById(caseInstanceId);
     }
 }
예제 #5
0
        /// <seealso cref= ExecutionEntity#ensureExecutionTreeInitialized </seealso>
        protected internal virtual void ensureCaseExecutionTreeInitialized()
        {
            IList <CaseExecutionEntity> executions = Context.CommandContext.CaseExecutionManager.findChildCaseExecutionsByCaseInstanceId(caseInstanceId);

            CaseExecutionEntity caseInstance = null;

            IDictionary <string, CaseExecutionEntity> executionMap = new Dictionary <string, CaseExecutionEntity>();

            foreach (CaseExecutionEntity execution in executions)
            {
                execution.caseExecutions   = new List <CaseExecutionEntity>();
                executionMap[execution.Id] = execution;
                if (execution.CaseInstanceExecution)
                {
                    caseInstance = execution;
                }
            }

            foreach (CaseExecutionEntity execution in executions)
            {
                string parentId            = execution.ParentId;
                CaseExecutionEntity parent = executionMap[parentId];
                if (!execution.CaseInstanceExecution)
                {
                    execution.caseInstance = caseInstance;
                    execution.parent       = parent;
                    parent.caseExecutions.Add(execution);
                }
                else
                {
                    execution.caseInstance = execution;
                }
            }
        }
예제 #6
0
 protected internal virtual void ensureSuperCaseExecutionInitialized()
 {
     if (superCaseExecution == null && !string.ReferenceEquals(superCaseExecutionId, null))
     {
         superCaseExecution = Context.CommandContext.CaseExecutionManager.findCaseExecutionById(superCaseExecutionId);
     }
 }
예제 #7
0
 protected internal virtual void ensureSubCaseInstanceInitialized()
 {
     if (subCaseInstance == null)
     {
         subCaseInstance = Context.CommandContext.CaseExecutionManager.findSubCaseInstanceBySuperCaseExecutionId(id);
     }
 }
예제 #8
0
        protected internal override CaseExecutionEntity newCaseExecution()
        {
            CaseExecutionEntity newCaseExecution = new CaseExecutionEntity();

            Context.CommandContext.CaseExecutionManager.insertCaseExecution(newCaseExecution);

            return(newCaseExecution);
        }
예제 #9
0
        public override void setCaseInstance(CmmnExecution caseInstance)
        {
            this.caseInstance = (CaseExecutionEntity)caseInstance;

            if (caseInstance != null)
            {
                this.caseInstanceId = this.caseInstance.Id;
            }
        }
예제 #10
0
        public override void setParent(CmmnExecution parent)
        {
            this.parent = (CaseExecutionEntity)parent;

            if (parent != null)
            {
                this.parentId = parent.Id;
            }
            else
            {
                this.parentId = null;
            }
        }
예제 #11
0
        public override void setCaseExecution(CmmnExecution caseExecution)
        {
            this.caseExecution = (CaseExecutionEntity)caseExecution;

            if (caseExecution != null)
            {
                caseExecutionId = caseExecution.Id;
            }
            else
            {
                caseExecutionId = null;
            }
        }
예제 #12
0
 protected internal virtual void ensureParentInitialized()
 {
     if (parent == null && !string.ReferenceEquals(parentId, null))
     {
         if (ExecutionTreePrefetchEnabled)
         {
             ensureCaseExecutionTreeInitialized();
         }
         else
         {
             parent = Context.CommandContext.CaseExecutionManager.findCaseExecutionById(parentId);
         }
     }
 }
예제 #13
0
        public override IList <CaseExecution> executeList(CommandContext commandContext, Page page)
        {
            checkQueryOk();
            ensureVariablesInitialized();
            IList <CaseExecution> result = commandContext.CaseExecutionManager.findCaseExecutionsByQueryCriteria(this, page);

            foreach (CaseExecution caseExecution in result)
            {
                CaseExecutionEntity caseExecutionEntity = (CaseExecutionEntity)caseExecution;
                // initializes the name, type and description
                // of the activity on current case execution
                caseExecutionEntity.Activity;
            }

            return(result);
        }
예제 #14
0
        public virtual void deleteCaseInstance(string caseInstanceId, string deleteReason, bool cascade)
        {
            CaseExecutionEntity execution = findCaseExecutionById(caseInstanceId);

            if (execution == null)
            {
                throw new BadUserRequestException("No case instance found for id '" + caseInstanceId + "'");
            }

            CommandContext commandContext = Context.CommandContext;

            commandContext.TaskManager.deleteTasksByCaseInstanceId(caseInstanceId, deleteReason, cascade);

            execution.deleteCascade();

            if (cascade)
            {
                Context.CommandContext.HistoricCaseInstanceManager.deleteHistoricCaseInstancesByIds(Arrays.asList(caseInstanceId));
            }
        }
예제 #15
0
 public virtual void deleteCaseExecution(CaseExecutionEntity caseExecution)
 {
     DbEntityManager.delete(caseExecution);
 }
예제 #16
0
 public virtual void insertCaseExecution(CaseExecutionEntity caseExecution)
 {
     DbEntityManager.insert(caseExecution);
 }
예제 #17
0
 public override void setSubCaseInstance(CmmnExecution subCaseInstance)
 {
     this.subCaseInstance = (CaseExecutionEntity)subCaseInstance;
 }