Esempio n. 1
0
		public TransitionImpl CreateLeavingTransition()
		{
			TransitionImpl transition = new TransitionImpl(_processDefinition);
			transition.From = this;
			_leavingTransitions.Add(transition);
			return transition;
		}
Esempio n. 2
0
        public virtual TransitionImpl CreateLeavingTransition()
        {
            TransitionImpl transition = new TransitionImpl(_processDefinition);

            transition.From = this;
            _leavingTransitions.Add(transition);
            return(transition);
        }
Esempio n. 3
0
        public ForkedFlow ForkFlow(TransitionImpl transition, FlowImpl parentFlow, IDictionary attributeValues)
        {
            // create the subflow
            FlowImpl subFlow = new FlowImpl(transition.Name, parentFlow, (ProcessBlockImpl)transition.From.ProcessBlock);
            parentFlow.Children.Add(subFlow);

            // save it
            //_dbSession.SaveOrUpdate(subFlow);

            // add the transition and the flow to the set of created sub-flows
            return new ForkedFlow(transition, subFlow);
        }
Esempio n. 4
0
        public override void Validate(ValidationContext validationContext)
        {
            base.Validate(validationContext);

            // verify that all transitions leaving a fork have a name
            // this is required because this name is assigned to the flow and
            // it serves as an id for the ForkHandler's
            IEnumerator iter = _leavingTransitions.GetEnumerator();

            while (iter.MoveNext())
            {
                TransitionImpl transition = (TransitionImpl)iter.Current;
                validationContext.Check(((Object)transition.Name != null), "one of the transitions leaving the fork does not have a name");
            }
        }
Esempio n. 5
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("");
			}
		}
Esempio n. 6
0
        public void ResolveReferences()
        {
            IEnumerator iter = _unresolvedReferences.GetEnumerator();

            while (iter.MoveNext())
            {
                UnresolvedReference unresolvedReference = (UnresolvedReference)iter.Current;

                Object           referencingObject        = unresolvedReference.ReferencingObject;
                String           referenceDestinationName = unresolvedReference.DestinationName;
                ProcessBlockImpl scope    = unresolvedReference.DestinationScope;
                String           property = unresolvedReference.Property;

                Object referencedObject = FindInScope(unresolvedReference, unresolvedReference.DestinationScope);
                if (referencedObject == null)
                {
                    AddError("failed to deploy process archive : couldn't resolve " + property + "=\"" + referenceDestinationName + "\" from " + referencingObject + " in scope " + scope);
                }
                else
                {
                    if (referencingObject is TransitionImpl)
                    {
                        if (property.Equals("to"))
                        {
                            TransitionImpl transition = (TransitionImpl)referencingObject;
                            transition.To = (NodeImpl)referencedObject;
                        }
                    }
                    if (referencingObject is FieldImpl)
                    {
                        if (property.Equals("attribute"))
                        {
                            FieldImpl field = (FieldImpl)referencingObject;
                            field.Attribute = (AttributeImpl)referencedObject;
                        }
                    }
                }
            }
        }
Esempio n. 7
0
		public override void ReadProcessData(XmlElement xmlElement, CreationContext creationContext)
		{
			base.ReadProcessData(xmlElement, creationContext);

			this._arrivingTransitions = new ListSet();
			this._leavingTransitions = new ListSet();
			this._processBlock = creationContext.ProcessBlock;

			creationContext.Node = this;
			this.TransitionDestinationScope = creationContext;
			IEnumerator iter = xmlElement.GetChildElements("transition").GetEnumerator();
			while (iter.MoveNext())
			{
				XmlElement transitionElement = (XmlElement) iter.Current;
				TransitionImpl transition = new TransitionImpl();
				transition.ReadProcessData(transitionElement, creationContext);
				_leavingTransitions.Add(transition);
			}
			creationContext.TransitionDestinationScope = null;
			creationContext.Node = null;
			creationContext.AddReferencableObject(_name, (ProcessBlockImpl) this._processBlock, typeof (INode), this);
		}
Esempio n. 8
0
        public override void ReadProcessData(XmlElement xmlElement, ProcessDefinitionBuildContext creationContext)
        {
            base.ReadProcessData(xmlElement, creationContext);

            this._arrivingTransitions = new ListSet();
            this._leavingTransitions  = new ListSet();
            this._processBlock        = creationContext.ProcessBlock;

            creationContext.Node            = this;
            this.TransitionDestinationScope = creationContext;
            IEnumerator iter = xmlElement.GetChildElements("transition").GetEnumerator();

            while (iter.MoveNext())
            {
                XmlElement     transitionElement = (XmlElement)iter.Current;
                TransitionImpl transition        = new TransitionImpl();
                transition.ReadProcessData(transitionElement, creationContext);
                _leavingTransitions.Add(transition);
            }
            creationContext.TransitionDestinationScope = null;
            creationContext.Node = null;
            creationContext.AddReferencableObject(_name, (ProcessBlockImpl)this._processBlock, typeof(INode), this);
        }
        public void ForkFlow(TransitionImpl transition, IDictionary attributeValues)
        {
            // create the subflow
            FlowImpl subFlow = new FlowImpl(transition.Name, _flow, (ProcessBlockImpl) _node.ProcessBlock);
            _flow.Children.Add(subFlow);

            // save it
            _dbSession.Save(subFlow);

            // store the attributeValues
            this._flow = subFlow;
            StoreAttributeValues(attributeValues);
            this._flow = (FlowImpl) this._flow.Parent;

            // add the transition and the flow to the set of created sub-flows
            this._forkedFlows.Add(new ForkedFlow(transition, subFlow));
        }
Esempio n. 10
0
        public void ProcessTransition(TransitionImpl transition, FlowImpl flow, DbSession dbSession)
        {
            NodeImpl destination = (NodeImpl)transition.To;
            flow.Node = destination;

            if (destination is ActivityStateImpl)
            {
                ProcessActivityState((ActivityStateImpl)destination, flow, dbSession);
            }
            else if (destination is ProcessStateImpl)
            {
                //ProcessProcessState((ProcessStateImpl)destination, executionContext, dbSession);
            }
            else if (destination is DecisionImpl)
            {
                ProcessDecision((DecisionImpl)destination, flow, dbSession);
            }
            else if (destination is ForkImpl)
            {
                ProcessFork((ForkImpl)destination, flow, dbSession);
            }
            else if (destination is JoinImpl)
            {
                ProcessJoin((JoinImpl)destination, flow, dbSession);
            }
            else if (destination is EndStateImpl)
            {
                ProcessEndState((EndStateImpl)destination, flow,dbSession);
            }
            else
            {
                throw new SystemException("");
            }
        }
Esempio n. 11
0
		public ForkedFlow(TransitionImpl transition, FlowImpl flow)
		{
			this._transition = transition;
			this._flow = flow;
		}