public void ProcessJoin(JoinImpl join, ExecutionContextImpl executionContext,DbSession dbSession)
        {
            // First set the state of the flow to finished
            FlowImpl joiningFlow = (FlowImpl) executionContext.GetFlow();
            joiningFlow.End = DateTime.Now;
            joiningFlow.ActorId = null;
            joiningFlow.Node = join; // setting the node is not necessary if this method is called
            // from processTransition, but it is necessary if this method is
            // called from cancelFlow in the component-impl.

            // if parent-reactivation of the flow is true, this means that the parent-flow
            // not yet has been reactivated.  In that case we have to see if it needs to be
            // reactivated.  In the other case (parent-reactivation is false) we don't
            // need to do anything because this means that the parent-flow was already
            // reactivated before.
            if (!false.Equals(joiningFlow.ParentReactivation))
            {
                // check if the parent needs to be reactivated
                bool parentReactivation = false;
                IList concurrentFlows = executionContext.GetOtherActiveConcurrentFlows();
                if (concurrentFlows.Count == 0)
                {
                    // if no concurrent flows are present any more, reactivation is forced
                    parentReactivation = true;
                }
                else
                {
                    // if other concurrent flows are present, the decision to reactivate is left
                    // to the join-delegation (if there is one specified)
                    DelegationImpl joinDelegation = join.JoinDelegation;
                    // if no joinDelegation was specified, parentReactivation remains false
                    // so the behaviour is like an and-join. (=sunchronizing merge)
                    if (joinDelegation != null)
                    {
                        parentReactivation = delegationHelper.DelegateJoin(join.JoinDelegation, executionContext);
                    }
                }

                if (parentReactivation)
                {
                    // make sure the other concurrent flows will not reactivate the
                    // parent again
                    IEnumerator iter = concurrentFlows.GetEnumerator();
                    while (iter.MoveNext())
                    {
                        //UPGRADE_TODO: Methode "java.util.Iterator.next" wurde in 'IEnumerator.Current' konvertiert und weist ein anderes Verhalten auf. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javautilIteratornext"'
                        FlowImpl concurrentFlow = (FlowImpl) iter.Current;
                        concurrentFlow.ParentReactivation = false;
                    }

                    // reactivate the parent by first setting the parentflow into the executionContext
                    FlowImpl parentFlow = (FlowImpl) joiningFlow.Parent;
                    executionContext.SetFlow(parentFlow);
                    // and then process the (single, checked at process-archive-parsing-time) leaving transition.
                    ISet leavingTransitions = join.LeavingTransitions;
                    iter = leavingTransitions.GetEnumerator();
                    if (iter.MoveNext())
                    {
                        TransitionImpl leavingTransition = (TransitionImpl) iter.Current;
                        ProcessTransition(leavingTransition, executionContext,dbSession);
                    } else {
                        // no transition throw exception?
                    }
                }
            }
        }
Exemple #2
0
        public void ProcessJoin(JoinImpl join, ExecutionContextImpl executionContext, DbSession dbSession)
        {
            // First set the state of the flow to finished
            FlowImpl joiningFlow = (FlowImpl)executionContext.GetFlow();

            joiningFlow.End     = DateTime.Now;
            joiningFlow.ActorId = null;
            joiningFlow.Node    = join;          // setting the node is not necessary if this method is called
            // from processTransition, but it is necessary if this method is
            // called from cancelFlow in the component-impl.

            // if parent-reactivation of the flow is true, this means that the parent-flow
            // not yet has been reactivated.  In that case we have to see if it needs to be
            // reactivated.  In the other case (parent-reactivation is false) we don't
            // need to do anything because this means that the parent-flow was already
            // reactivated before.
            if (!false.Equals(joiningFlow.ParentReactivation))
            {
                // check if the parent needs to be reactivated
                bool  parentReactivation = false;
                IList concurrentFlows    = executionContext.GetOtherActiveConcurrentFlows();
                if (concurrentFlows.Count == 0)
                {
                    // if no concurrent flows are present any more, reactivation is forced
                    parentReactivation = true;
                }
                else
                {
                    // if other concurrent flows are present, the decision to reactivate is left
                    // to the join-delegation (if there is one specified)
                    DelegationImpl joinDelegation = join.JoinDelegation;
                    // if no joinDelegation was specified, parentReactivation remains false
                    // so the behaviour is like an and-join. (=sunchronizing merge)
                    if (joinDelegation != null)
                    {
                        parentReactivation = delegationHelper.DelegateJoin(join.JoinDelegation, executionContext);
                    }
                }

                if (parentReactivation)
                {
                    // make sure the other concurrent flows will not reactivate the
                    // parent again
                    IEnumerator iter = concurrentFlows.GetEnumerator();
                    while (iter.MoveNext())
                    {
                        //UPGRADE_TODO: Methode "java.util.Iterator.next" wurde in 'IEnumerator.Current' konvertiert und weist ein anderes Verhalten auf. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javautilIteratornext"'
                        FlowImpl concurrentFlow = (FlowImpl)iter.Current;
                        concurrentFlow.ParentReactivation = false;
                    }

                    // reactivate the parent by first setting the parentflow into the executionContext
                    FlowImpl parentFlow = (FlowImpl)joiningFlow.Parent;
                    executionContext.SetFlow(parentFlow);
                    // and then process the (single, checked at process-archive-parsing-time) leaving transition.
                    ISet leavingTransitions = join.LeavingTransitions;
                    iter = leavingTransitions.GetEnumerator();
                    if (iter.MoveNext())
                    {
                        TransitionImpl leavingTransition = (TransitionImpl)iter.Current;
                        ProcessTransition(leavingTransition, executionContext, dbSession);
                    }
                    else
                    {
                        // no transition throw exception?
                    }
                }
            }
        }