示例#1
0
        public void ProcessActivityState(ActivityStateImpl activityState, ExecutionContextImpl executionContext, DbSession dbSession)
        {
            // first set the flow-state to the activity-state
            FlowImpl flow = (FlowImpl)executionContext.GetFlow();

            log.Debug("processing activity-state '" + activityState + "' for flow '" + executionContext.GetFlow() + "'");

            // execute the actions scheduled for this assignment
            delegationService.RunActionsForEvent(EventType.BEFORE_ACTIVITYSTATE_ASSIGNMENT, activityState.Id, executionContext, dbSession);

            String         actorId = null;
            String         role    = activityState.ActorRoleName;
            DelegationImpl assignmentDelegation = activityState.AssignmentDelegation;

            if (assignmentDelegation != null)
            {
                // delegate the assignment of the activity-state
                actorId = delegationHelper.DelegateAssignment(activityState.AssignmentDelegation, executionContext);
                if ((Object)actorId == null)
                {
                    throw new SystemException("invalid process definition : assigner of activity-state '" + activityState.Name + "' returned null instead of a valid actorId");
                }
                log.Debug("setting actor of flow " + flow + " to " + actorId);
            }
            else
            {
                // get the assigned actor from the specified attribute instance
                if ((Object)role != null)
                {
                    IActor actor = (IActor)executionContext.GetAttribute(role);
                    if (actor == null)
                    {
                        throw new SystemException("invalid process definition : activity-state must be assigned to role '" + role + "' but that attribute instance is null");
                    }
                    actorId = actor.Id;
                }
                else
                {
                    throw new SystemException("invalid process definition : activity-state '" + activityState.Name + "' does not have an assigner or a role");
                }
            }

            flow.ActorId = actorId;

            // If necessary, store the actor in the role
            if ((string.IsNullOrEmpty(role) == false) && (assignmentDelegation != null))
            {
                executionContext.StoreRole(actorId, activityState);
            }

            // the client of performActivity wants to be Informed of the people in charge of the process
            executionContext.AssignedFlows.Add(flow);

            // log the assignment
            executionContext.CreateLog(actorId, EventType.AFTER_ACTIVITYSTATE_ASSIGNMENT);
            executionContext.AddLogDetail(new ObjectReferenceImpl(activityState));

            // execute the actions scheduled for this assignment
            delegationService.RunActionsForEvent(EventType.AFTER_ACTIVITYSTATE_ASSIGNMENT, activityState.Id, executionContext, dbSession);
        }
示例#2
0
		public void DelegateAction(DelegationImpl delegation, ExecutionContextImpl executionContext)
		{
			try
			{
				executionContext.CreateLog(EventType.ACTION);
				executionContext.AddLogDetail(new DelegateCallImpl(delegation, typeof (IAction)));
				IActionHandler actionHandler = (IActionHandler) GetDelegate(delegation);
				executionContext.SetConfiguration(ParseConfiguration(delegation));
				actionHandler.Run(executionContext);
			}
			catch (Exception t)
			{
				HandleException(delegation, executionContext, t);
			}
		}
示例#3
0
		public void DelegateScheduledAction(DelegationImpl delegation, ExecutionContextImpl executionContext)
		{
			try
			{
				/* can't add logs because of a integritiy constraint violation... 
				* can you find why ?
				*/
				if (executionContext.GetFlow() != null)
				{
					executionContext.CreateLog(EventType.ACTION);
					executionContext.AddLogDetail(new DelegateCallImpl(delegation, typeof (IAction)));
				}
				IActionHandler actionHandler = (IActionHandler) GetDelegate(delegation);
				executionContext.SetConfiguration(ParseConfiguration(delegation));
				actionHandler.Run(executionContext);
			}
			catch (Exception t)
			{
				HandleException(delegation, executionContext, t);
			}
		}
示例#4
0
        public IList PerformActivity(String authenticatedActorId, Int64 flowId, IDictionary attributeValues, String transitionName, Relations relations, DbSession dbSession, IOrganisationService organisationComponent)
        {
            IList assignedFlows = null;
            // get the flow
            FlowImpl flow = (FlowImpl) dbSession.Load(typeof (FlowImpl), flowId);
            dbSession.Lock(flow.ProcessInstance, LockMode.Upgrade);
            ActivityStateImpl activityState = (ActivityStateImpl) flow.Node;

            // TODO : check which part can move to the DefaultAuthorizationHandler
            if ((Object) flow.ActorId == null)
            {
                throw new SystemException("the flow on which you try to perform an activity is not assigned to an actor");
            }
            else
            {
                if ((Object) authenticatedActorId == null)
                {
                    throw new AuthorizationException("you can't perform an activity because you are not authenticated");
                }
                //		else if ( ! authenticatedActorId.equals( flow.getActorId() ) ) {
                //        throw new AuthorizationException( "activity '" + activityState.getName() + "' in flow " + flow.getId() + " is not assigned to the authenticated actor (" + authenticatedActorId + ") but to " + flow.getActorId() );
                //      }
            }

            // first check if the actor is allowed to perform this activity
            authorizationHelper.CheckPerformActivity(authenticatedActorId, flowId, attributeValues, transitionName, dbSession);

            log.Info("actor '" + authenticatedActorId + "' performs activity '" + activityState.Name + "'...");

            // create the execution-context
            ExecutionContextImpl executionContext = new ExecutionContextImpl(authenticatedActorId, flow, dbSession, organisationComponent);

            // if this activity has a role-name, save the actor in the corresponding attribute
            // attributeValues = state.addRoleAttributeValue( attributeValues, authenticatedActorId, organisationComponent );

            // log event & trigger actions
            delegationService.RunActionsForEvent(EventType.BEFORE_PERFORM_OF_ACTIVITY, activityState.Id, executionContext,dbSession);

            // store the supplied attribute values
            executionContext.CreateLog(authenticatedActorId, EventType.PERFORM_OF_ACTIVITY);
            executionContext.AddLogDetail(new ObjectReferenceImpl(activityState));
            executionContext.CheckAccess(attributeValues, activityState);
            executionContext.StoreAttributeValues(attributeValues);

            // log event & trigger actions
            delegationService.RunActionsForEvent(EventType.PERFORM_OF_ACTIVITY, activityState.Id, executionContext,dbSession);

            // from here on, we consider the actor as being the previous actor
            executionContext.SetActorAsPrevious();

            // select and process the transition
            TransitionImpl startTransition = transitionRepository.GetTransition(transitionName, activityState, dbSession);
            engine.ProcessTransition(startTransition, executionContext, dbSession);

            // log event & trigger actions
            delegationService.RunActionsForEvent(EventType.AFTER_PERFORM_OF_ACTIVITY, activityState.Id, executionContext,dbSession);

            assignedFlows = executionContext.AssignedFlows;

            // flush the updates to the db
            dbSession.Update(flow.ProcessInstance);
            dbSession.Flush();

            if (relations != null)
            {
                relations.Resolve(assignedFlows);
            }
            dbSession.Update(flow.ProcessInstance);
            return assignedFlows;
        }
示例#5
0
		private void HandleException(DelegationImpl delegation, ExecutionContextImpl executionContext, Exception exception)
		{
			log.Debug("handling delegation exception :", exception);

			String exceptionClassName = exception.GetType().FullName;
			String delegationClassName = delegation.ClassName;

			ExceptionHandlingType exceptionHandlingType = delegation.ExceptionHandlingType;

			if (exceptionHandlingType != 0)
			{
				if (exceptionHandlingType == ExceptionHandlingType.IGNORE)
				{
					log.Debug("ignoring '" + exceptionClassName + "' in delegation '" + delegationClassName + "' : " + exception.Message);
				}
				else if (exceptionHandlingType == ExceptionHandlingType.LOG)
				{
					log.Debug("logging '" + exceptionClassName + "' in delegation '" + delegationClassName + "' : " + exception.Message);
					executionContext.AddLogDetail(new ExceptionReportImpl(exception));
				}
				else if (exceptionHandlingType == ExceptionHandlingType.ROLLBACK)
				{
					log.Debug("rolling back for '" + exceptionClassName + "' in delegation '" + delegationClassName + "' : " + exception.Message);
					throw new SystemException("rolling back for '" + exceptionClassName + "' in delegation '" + delegationClassName + "' : " + exception.Message);
				}
				else
				{
					throw new SystemException("unknown exception handler '" + exceptionHandlingType + "' : " + exception.Message);
				}
			}
			else
			{
				log.Debug("'" + exceptionClassName + "' in delegation '" + delegationClassName + "' : " + exception.Message);
				executionContext.AddLogDetail(new ExceptionReportImpl(exception));
			}
		}
示例#6
0
        public IList PerformActivity(String authenticatedActorId, Int64 flowId, IDictionary attributeValues, String transitionName, Relations relations, DbSession dbSession, IOrganisationService organisationComponent)
        {
            IList assignedFlows = null;
            // get the flow
            FlowImpl flow = (FlowImpl)dbSession.Load(typeof(FlowImpl), flowId);

            dbSession.Lock(flow.ProcessInstance, LockMode.Upgrade);
            ActivityStateImpl activityState = (ActivityStateImpl)flow.Node;

            // TODO : check which part can move to the DefaultAuthorizationHandler
            if ((Object)flow.ActorId == null)
            {
                throw new SystemException("the flow on which you try to perform an activity is not assigned to an actor");
            }
            else
            {
                if ((Object)authenticatedActorId == null)
                {
                    throw new AuthorizationException("you can't perform an activity because you are not authenticated");
                }
                //		else if ( ! authenticatedActorId.equals( flow.getActorId() ) ) {
                //        throw new AuthorizationException( "activity '" + activityState.getName() + "' in flow " + flow.getId() + " is not assigned to the authenticated actor (" + authenticatedActorId + ") but to " + flow.getActorId() );
                //      }
            }

            // first check if the actor is allowed to perform this activity
            authorizationHelper.CheckPerformActivity(authenticatedActorId, flowId, attributeValues, transitionName, dbSession);

            log.Info("actor '" + authenticatedActorId + "' performs activity '" + activityState.Name + "'...");

            // create the execution-context
            ExecutionContextImpl executionContext = new ExecutionContextImpl(authenticatedActorId, flow, dbSession, organisationComponent);

            // if this activity has a role-name, save the actor in the corresponding attribute
            // attributeValues = state.addRoleAttributeValue( attributeValues, authenticatedActorId, organisationComponent );

            // log event & trigger actions
            delegationService.RunActionsForEvent(EventType.BEFORE_PERFORM_OF_ACTIVITY, activityState.Id, executionContext, dbSession);

            // store the supplied attribute values
            executionContext.CreateLog(authenticatedActorId, EventType.PERFORM_OF_ACTIVITY);
            executionContext.AddLogDetail(new ObjectReferenceImpl(activityState));
            executionContext.CheckAccess(attributeValues, activityState);
            executionContext.StoreAttributeValues(attributeValues);

            // log event & trigger actions
            delegationService.RunActionsForEvent(EventType.PERFORM_OF_ACTIVITY, activityState.Id, executionContext, dbSession);

            // from here on, we consider the actor as being the previous actor
            //因為繼續往下跑,ActorId就有可能轉換成下一關卡的處理人員
            //所以previousActorId就是現在的登入人員
            executionContext.SetActorAsPrevious();

            // select and process the transition
            TransitionImpl startTransition = transitionRepository.GetTransition(transitionName, activityState, dbSession);

            engine.ProcessTransition(startTransition, executionContext, dbSession);

            // log event & trigger actions
            delegationService.RunActionsForEvent(EventType.AFTER_PERFORM_OF_ACTIVITY, activityState.Id, executionContext, dbSession);

            assignedFlows = executionContext.AssignedFlows;

            // flush the updates to the db
            dbSession.Update(flow.ProcessInstance);
            dbSession.Flush();

            if (relations != null)
            {
                relations.Resolve(assignedFlows);
            }
            dbSession.Update(flow.ProcessInstance);
            return(assignedFlows);
        }
        public void ProcessActivityState(ActivityStateImpl activityState, ExecutionContextImpl executionContext,DbSession dbSession)
        {
            // first set the flow-state to the activity-state
            FlowImpl flow = (FlowImpl) executionContext.GetFlow();

            log.Debug("processing activity-state '" + activityState + "' for flow '" + executionContext.GetFlow() + "'");

            // execute the actions scheduled for this assignment
            delegationService.RunActionsForEvent(EventType.BEFORE_ACTIVITYSTATE_ASSIGNMENT, activityState.Id, executionContext,dbSession);

            String actorId = null;
            String role = activityState.ActorRoleName;
            DelegationImpl assignmentDelegation = activityState.AssignmentDelegation;

            if (assignmentDelegation != null)
            {
                // delegate the assignment of the activity-state
                actorId = delegationHelper.DelegateAssignment(activityState.AssignmentDelegation, executionContext);
                if ((Object) actorId == null)
                {
                    throw new SystemException("invalid process definition : assigner of activity-state '" + activityState.Name + "' returned null instead of a valid actorId");
                }
                log.Debug("setting actor of flow " + flow + " to " + actorId);
            }
            else
            {
                // get the assigned actor from the specified attribute instance
                if ((Object) role != null)
                {
                    IActor actor = (IActor) executionContext.GetAttribute(role);
                    if (actor == null)
                    {
                        throw new SystemException("invalid process definition : activity-state must be assigned to role '" + role + "' but that attribute instance is null");
                    }
                    actorId = actor.Id;
                }
                else
                {
                    throw new SystemException("invalid process definition : activity-state '" + activityState.Name + "' does not have an assigner or a role");
                }
            }

            flow.ActorId = actorId;

            // If necessary, store the actor in the role
            if ((string.IsNullOrEmpty(role) == false) && (assignmentDelegation != null))
            {
                executionContext.StoreRole(actorId, activityState);
            }

            // the client of performActivity wants to be Informed of the people in charge of the process
            executionContext.AssignedFlows.Add(flow);

            // log the assignment
            executionContext.CreateLog(actorId, EventType.AFTER_ACTIVITYSTATE_ASSIGNMENT);
            executionContext.AddLogDetail(new ObjectReferenceImpl(activityState));

            // execute the actions scheduled for this assignment
            delegationService.RunActionsForEvent(EventType.AFTER_ACTIVITYSTATE_ASSIGNMENT, activityState.Id, executionContext,dbSession);
        }
        public void ProcessProcessState(ProcessStateImpl processState, ExecutionContextImpl executionContext,DbSession dbSession)
        {
            // TODO : try to group similarities between this method and ExecutionComponentImpl.startProcessInstance and
            //        group them in a common method

            // provide a convenient local var for the database session
            //DbSession dbSession = executionContext.DbSession;

            // get the sub-process-definition and its start-state
            ProcessDefinitionImpl subProcessDefinition = (ProcessDefinitionImpl) processState.SubProcess;
            StartStateImpl startState = (StartStateImpl) subProcessDefinition.StartState;

            log.Info("processState '" + processState.Name + "' starts an instance of process '" + subProcessDefinition.Name + "'...");

            // get the actor that is supposed to start this process instance
            IActor subProcessStarter = actorExpressionResolver.ResolveArgument(processState.ActorExpression, executionContext);
            String subProcessStarterId = subProcessStarter.Id;

            // create the process-instance
            ProcessInstanceImpl subProcessInstance = new ProcessInstanceImpl(subProcessStarterId, subProcessDefinition);
            FlowImpl rootFlow = (FlowImpl) subProcessInstance.RootFlow;

            // attach the subProcesInstance to the parentFlow
            FlowImpl superProcessFlow = (FlowImpl) executionContext.GetFlow();
            superProcessFlow.SetSubProcessInstance(subProcessInstance);
            subProcessInstance.SuperProcessFlow = superProcessFlow;

            // create the execution context for the sub-process
            ExecutionContextImpl subExecutionContext = new ExecutionContextImpl(subProcessStarterId, rootFlow, dbSession, executionContext.GetOrganisationComponent());

            // save the process instance to allow hibernate queries
            dbSession.Save(subProcessInstance);

            // add the log
            executionContext.CreateLog(EventType.SUB_PROCESS_INSTANCE_START);
            executionContext.AddLogDetail(new ObjectReferenceImpl(subProcessInstance));

            // delegate the attributeValues
            Object[] processInvocationData = delegationHelper.DelegateProcessInvocation(processState.ProcessInvokerDelegation, subExecutionContext);
            String transitionName = (String) processInvocationData[0];
            IDictionary attributeValues = (IDictionary) processInvocationData[1];

            // store the attributes
            subExecutionContext.CreateLog(subProcessStarterId, EventType.PROCESS_INSTANCE_START);
            subExecutionContext.StoreAttributeValues(attributeValues);
            subExecutionContext.StoreRole(subProcessStarterId, startState);

            // log event & trigger actions
            delegationService.RunActionsForEvent(EventType.SUB_PROCESS_INSTANCE_START, processState.Id, subExecutionContext,dbSession);
            delegationService.RunActionsForEvent(EventType.PROCESS_INSTANCE_START, subProcessDefinition.Id, subExecutionContext,dbSession);

            // from here on, we consider the actor as being the previous actor
            subExecutionContext.SetActorAsPrevious();

            // process the start-transition
            TransitionImpl startTransition = transitionRepository.GetTransition(transitionName, startState, dbSession);
            ProcessTransition(startTransition, subExecutionContext,dbSession);

            // add the assigned flows of the subContext to the parentContext
            executionContext.AssignedFlows.AddRange(subExecutionContext.AssignedFlows);

            // flush the updates to the db
            dbSession.Update(subProcessInstance);
            dbSession.Flush();
        }
        public void ProcessFork(ForkImpl fork, ExecutionContextImpl executionContext,DbSession dbSession)
        {
            log.Debug("forking flow " + executionContext.GetFlow());

            // First initialize the children of the flow to be forked
            FlowImpl flow = (FlowImpl) executionContext.GetFlow();
            flow.Children = new ListSet();

            // Then initialise the forked flows in the execution context
            executionContext.ForkedFlows = new ArrayList();

            DelegationImpl delegation = fork.ForkDelegation;
            if (delegation != null)
            {
                delegationHelper.DelegateFork(fork.ForkDelegation, executionContext);
            }
            else
            {
                // execute the default fork behaviour
                IEnumerator iter = fork.LeavingTransitions.GetEnumerator();
                while (iter.MoveNext())
                {
                    TransitionImpl transition = (TransitionImpl) iter.Current;
                    executionContext.ForkFlow(transition, null);
                }
            }

            // create the fork event & remember the parent flow
            FlowImpl parentFlow = (FlowImpl) executionContext.GetFlow();
            executionContext.CreateLog(EventType.FORK);

            // log the event
            executionContext.SetFlow(parentFlow);
            IList forkedFlows = executionContext.ForkedFlows;
            IEnumerator iter2 = forkedFlows.GetEnumerator();
            while (iter2.MoveNext())
            {
                ForkedFlow forkedFlow = (ForkedFlow) iter2.Current;
                log.Debug("adding object reference [" + forkedFlow.Flow + "] to flow [" + parentFlow + "]");
                executionContext.AddLogDetail(new ObjectReferenceImpl(forkedFlow.Flow));
            }

            // loop over all flows that were forked in the ForkHandler implementation
            iter2 = forkedFlows.GetEnumerator();
            while (iter2.MoveNext())
            {
                ForkedFlow forkedFlow = (ForkedFlow) iter2.Current;

                // trigger actions, scheduled after the creation and setting of the attributeValues
                // but before the fork is being processed
                delegationService.RunActionsForEvent(EventType.FORK, fork.Id, executionContext,dbSession);

                // then process the forked flow transition
                executionContext.SetFlow(forkedFlow.Flow);
                ProcessTransition(forkedFlow.Transition, executionContext,dbSession);
            }
        }
示例#10
0
        public void ProcessFork(ForkImpl fork, ExecutionContextImpl executionContext, DbSession dbSession)
        {
            log.Debug("forking flow " + executionContext.GetFlow());

            // First initialize the children of the flow to be forked
            FlowImpl flow = (FlowImpl)executionContext.GetFlow();

            flow.Children = new ListSet();

            // Then initialise the forked flows in the execution context
            executionContext.ForkedFlows = new ArrayList();

            DelegationImpl delegation = fork.ForkDelegation;

            if (delegation != null)
            {
                delegationHelper.DelegateFork(fork.ForkDelegation, executionContext);
            }
            else
            {
                // execute the default fork behaviour
                IEnumerator iter = fork.LeavingTransitions.GetEnumerator();
                while (iter.MoveNext())
                {
                    TransitionImpl transition = (TransitionImpl)iter.Current;
                    executionContext.ForkFlow(transition, null);
                }
            }

            // create the fork event & remember the parent flow
            FlowImpl parentFlow = (FlowImpl)executionContext.GetFlow();

            executionContext.CreateLog(EventType.FORK);

            // log the event
            executionContext.SetFlow(parentFlow);
            IList       forkedFlows = executionContext.ForkedFlows;
            IEnumerator iter2       = forkedFlows.GetEnumerator();

            while (iter2.MoveNext())
            {
                ForkedFlow forkedFlow = (ForkedFlow)iter2.Current;
                log.Debug("adding object reference [" + forkedFlow.Flow + "] to flow [" + parentFlow + "]");
                executionContext.AddLogDetail(new ObjectReferenceImpl(forkedFlow.Flow));
            }

            // loop over all flows that were forked in the ForkHandler implementation
            iter2 = forkedFlows.GetEnumerator();
            while (iter2.MoveNext())
            {
                ForkedFlow forkedFlow = (ForkedFlow)iter2.Current;

                // trigger actions, scheduled after the creation and setting of the attributeValues
                // but before the fork is being processed
                delegationService.RunActionsForEvent(EventType.FORK, fork.Id, executionContext, dbSession);

                // then process the forked flow transition
                executionContext.SetFlow(forkedFlow.Flow);
                ProcessTransition(forkedFlow.Transition, executionContext, dbSession);
            }
        }
示例#11
0
        public void ProcessProcessState(ProcessStateImpl processState, ExecutionContextImpl executionContext, DbSession dbSession)
        {
            // TODO : try to group similarities between this method and ExecutionComponentImpl.startProcessInstance and
            //        group them in a common method

            // provide a convenient local var for the database session
            //DbSession dbSession = executionContext.DbSession;

            // get the sub-process-definition and its start-state
            ProcessDefinitionImpl subProcessDefinition = (ProcessDefinitionImpl)processState.SubProcess;
            StartStateImpl        startState           = (StartStateImpl)subProcessDefinition.StartState;

            log.Info("processState '" + processState.Name + "' starts an instance of process '" + subProcessDefinition.Name + "'...");

            // get the actor that is supposed to start this process instance
            IActor subProcessStarter   = actorExpressionResolver.ResolveArgument(processState.ActorExpression, executionContext);
            String subProcessStarterId = subProcessStarter.Id;

            // create the process-instance
            ProcessInstanceImpl subProcessInstance = new ProcessInstanceImpl(subProcessStarterId, subProcessDefinition);
            FlowImpl            rootFlow           = (FlowImpl)subProcessInstance.RootFlow;

            // attach the subProcesInstance to the parentFlow
            FlowImpl superProcessFlow = (FlowImpl)executionContext.GetFlow();

            superProcessFlow.SetSubProcessInstance(subProcessInstance);
            subProcessInstance.SuperProcessFlow = superProcessFlow;

            // create the execution context for the sub-process
            ExecutionContextImpl subExecutionContext = new ExecutionContextImpl(subProcessStarterId, rootFlow, dbSession, executionContext.GetOrganisationComponent());

            // save the process instance to allow hibernate queries
            dbSession.Save(subProcessInstance);

            // add the log
            executionContext.CreateLog(EventType.SUB_PROCESS_INSTANCE_START);
            executionContext.AddLogDetail(new ObjectReferenceImpl(subProcessInstance));

            // delegate the attributeValues
            Object[]    processInvocationData = delegationHelper.DelegateProcessInvocation(processState.ProcessInvokerDelegation, subExecutionContext);
            String      transitionName        = (String)processInvocationData[0];
            IDictionary attributeValues       = (IDictionary)processInvocationData[1];

            // store the attributes
            subExecutionContext.CreateLog(subProcessStarterId, EventType.PROCESS_INSTANCE_START);
            subExecutionContext.StoreAttributeValues(attributeValues);
            subExecutionContext.StoreRole(subProcessStarterId, startState);

            // log event & trigger actions
            delegationService.RunActionsForEvent(EventType.SUB_PROCESS_INSTANCE_START, processState.Id, subExecutionContext, dbSession);
            delegationService.RunActionsForEvent(EventType.PROCESS_INSTANCE_START, subProcessDefinition.Id, subExecutionContext, dbSession);

            // from here on, we consider the actor as being the previous actor
            subExecutionContext.SetActorAsPrevious();

            // process the start-transition
            TransitionImpl startTransition = transitionRepository.GetTransition(transitionName, startState, dbSession);

            ProcessTransition(startTransition, subExecutionContext, dbSession);

            // add the assigned flows of the subContext to the parentContext
            executionContext.AssignedFlows.AddRange(subExecutionContext.AssignedFlows);

            // flush the updates to the db
            dbSession.Update(subProcessInstance);
            dbSession.Flush();
        }