Beispiel #1
0
        public void AddFlow(FlowDef t)
        {
            if (string.IsNullOrEmpty(t.From) || string.IsNullOrEmpty(t.To))
            {
                throw new Exception("Flow must have start and target node");
            }
            NodeDef p = GetNode(t.From);

            if (p == null)
            {
                throw new Exception("Node not defined: " + t.From);
            }
            NodeDef q = GetNode(t.To);

            if (q == null)
            {
                throw new Exception("Node not defined: " + t.To);
            }
            t.Parent = this;

            if (t.IsCancelling || t.SourcePortType != TaskOutPortType.Out)
            {
                if (t.InputCondition != null && t.InputCondition.Length > 0)
                {
                    throw new NGinnBPM.ProcessModel.Exceptions.ProcessDefinitionException(this.ParentProcess.DefinitionId, t.From, "InputCondition not allowed");
                }
            }

            if (p is PlaceDef && q is PlaceDef)
            {
                throw new Exception("Flow cannot connect two places");
            }
            if (p is TaskDef && q is TaskDef)
            {
                //adding implicit place between p and q
                TaskDef  tq    = q as TaskDef;
                TaskDef  tp    = p as TaskDef;
                PlaceDef ptran = new PlaceDef {
                    Id        = string.Format("{0}.-.{1}", tp.Id, tq.Id),
                    PlaceType = PlaceTypes.Intermediate,
                    Implicit  = true
                };
                AddPlace(ptran);
                t.To = ptran.Id;
                FlowDef f2 = new FlowDef();
                f2.From = ptran.Id;
                f2.To   = tq.Id;
                AddFlow(t);
                AddFlow(f2);
            }
            else
            {
                Flows.Add(t);
            }
        }
Beispiel #2
0
        public void AddFlow(FlowDef t)
        {
            if (string.IsNullOrEmpty(t.From) || string.IsNullOrEmpty(t.To)) throw new Exception("Flow must have start and target node");
            NodeDef p = GetNode(t.From);
            if (p == null) throw new Exception("Node not defined: " + t.From);
            NodeDef q = GetNode(t.To);
            if (q == null) throw new Exception("Node not defined: " + t.To);
            t.Parent = this;
            
            if (t.IsCancelling || t.SourcePortType != TaskOutPortType.Out)
            {
                if (t.InputCondition != null && t.InputCondition.Length > 0)
                    throw new NGinnBPM.ProcessModel.Exceptions.ProcessDefinitionException(this.ParentProcess.DefinitionId, t.From, "InputCondition not allowed");
            }

            if (p is PlaceDef && q is PlaceDef) throw new Exception("Flow cannot connect two places");
            if (p is TaskDef && q is TaskDef)
            {
                //adding implicit place between p and q
                TaskDef tq = q as TaskDef;
                TaskDef tp = p as TaskDef;
                PlaceDef ptran = new PlaceDef {Id = string.Format("{0}.-.{1}", tp.Id, tq.Id),
                    PlaceType = PlaceTypes.Intermediate,
                    Implicit = true
                };
                AddPlace(ptran);
                t.To = ptran.Id;
                FlowDef f2 = new FlowDef();
                f2.From = ptran.Id;
                f2.To = tq.Id;
                AddFlow(t);
                AddFlow(f2);
            }
            else
            {
                Flows.Add(t);
            }
        }
Beispiel #3
0
 public void AddPlace(PlaceDef pd)
 {
     pd.Parent = this;
     Places.Add(pd);
 }
Beispiel #4
0
 public void AddPlace(PlaceDef pd)
 {
     pd.Parent = this;
     Places.Add(pd);
 }