示例#1
0
        //private const String queryFindActionsByEventType = "select a from a in class NetBpm.Workflow.Definition.Impl.ActionImpl " +
        //    "where a.EventType = ? " +
        //    "  and a.DefinitionObjectId = ? ";

        //public void RunActionsForEvent(EventType eventType, Int64 definitionObjectId, ExecutionContextImpl executionContext)
        //{
        //    log.Debug("processing '" + eventType + "' events for executionContext " + executionContext);

        //    DbSession dbSession = executionContext.DbSession;

        //    // find all actions for definitionObject on the given eventType
        //    Object[] values = new Object[] {eventType, definitionObjectId};
        //    IType[] types = new IType[] {DbType.INTEGER, DbType.LONG};

        //    IList actions = dbSession.Find(queryFindActionsByEventType, values, types);
        //    IEnumerator iter = actions.GetEnumerator();
        //    log.Debug("list" + actions);
        //    while (iter.MoveNext())
        //    {
        //        ActionImpl action = (ActionImpl) iter.Current;
        //        log.Debug("action: " + action);
        //        delegationHelper.DelegateAction(action.ActionDelegation, executionContext);
        //    }
        //    log.Debug("ende runActionsForEvent!");
        //}

        public void ProcessTransition(TransitionImpl transition, ExecutionContextImpl executionContext, DbSession dbSession)
        {
            log.Debug("processing transition '" + transition + "' for flow '" + executionContext.GetFlow() + "'");

            // trigger all the actions scheduled for this transition
            delegationService.RunActionsForEvent(EventType.TRANSITION, transition.Id, executionContext, dbSession);

            // first set the state of the execution context and the flow
            // to the node that is going to be processed
            FlowImpl flow        = (FlowImpl)executionContext.GetFlow();
            NodeImpl destination = (NodeImpl)transition.To;

            flow.Node = destination;
            executionContext.SetNode(destination);

            // note : I want to keep the engine methods grouped in this class, that is why I
            // didn't use inheritance but used an instanceof-switch instead.

            if (destination is ActivityStateImpl)
            {
                ProcessActivityState((ActivityStateImpl)destination, executionContext, dbSession);
            }
            else if (destination is ProcessStateImpl)
            {
                ProcessProcessState((ProcessStateImpl)destination, executionContext, dbSession);
            }
            else if (destination is DecisionImpl)
            {
                ProcessDecision((DecisionImpl)destination, executionContext, dbSession);
            }
            else if (destination is ForkImpl)
            {
                ProcessFork((ForkImpl)destination, executionContext, dbSession);
            }
            else if (destination is JoinImpl)
            {
                ProcessJoin((JoinImpl)destination, executionContext, dbSession);
            }
            else if (destination is EndStateImpl)
            {
                ProcessEndState((EndStateImpl)destination, executionContext, dbSession);
            }
            else
            {
                throw new SystemException("");
            }
        }
示例#2
0
		public void ProcessTransition(TransitionImpl transition, ExecutionContextImpl executionContext)
		{
			log.Debug("processing transition '" + transition + "' for flow '" + executionContext.GetFlow() + "'");

			// trigger all the actions scheduled for this transition
			RunActionsForEvent(EventType.TRANSITION, transition.Id, executionContext);

			// first set the state of the execution context and the flow
			// to the node that is going to be processed 
			FlowImpl flow = (FlowImpl) executionContext.GetFlow();
			NodeImpl destination = (NodeImpl) transition.To;
			flow.Node = destination;
			executionContext.SetNode(destination);

			// note : I want to keep the engine methods grouped in this class, that is why I
			// didn't use inheritance but used an instanceof-switch instead.
			if (destination is ActivityStateImpl)
			{
				ProcessActivityState((ActivityStateImpl) destination, executionContext);
			}
			else if (destination is ProcessStateImpl)
			{
				ProcessProcessState((ProcessStateImpl) destination, executionContext);
			}
			else if (destination is DecisionImpl)
			{
				ProcessDecision((DecisionImpl) destination, executionContext);
			}
			else if (destination is ForkImpl)
			{
				ProcessFork((ForkImpl) destination, executionContext);
			}
			else if (destination is JoinImpl)
			{
				ProcessJoin((JoinImpl) destination, executionContext);
			}
			else if (destination is EndStateImpl)
			{
				ProcessEndState((EndStateImpl) destination, executionContext);
			}
			else
			{
				throw new SystemException("");
			}
		}