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);
            }
        }
Beispiel #2
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);
            }
        }