Example #1
0
        internal void SetOutputParameters(ProcessNode node)
        {
            if (OutputParameters == null)
            {
                OutputParameters = ImmutableDictionary.Create <string, IImmutableDictionary <string, object> >();
            }

            OutputParameters.Add(node.NodeName, node.OutputParameters);
        }
Example #2
0
 public void Execute(ProcessNode processNode, ProcessNode previousNode)
 {
     NodeHandler = ProcessInstance.NodeHandlers[NodeType];
     if (processNode.InputParameters == null)
     {
         processNode.InputParameters = ProcessInstance.InputParameters;
     }
     Task = new Task(() => NodeHandler.Execute(processNode, previousNode));
     Task.Start();
 }
Example #3
0
        public ProcessInstance NewProcessInstance()
        {
            var current         = ProcessXML.Element(NS + "startEvent");
            var node            = new ProcessNode(current.Attribute("id").Value, current.Name.LocalName);
            var nodes           = BuildNodes(ProcessXML);
            var processInstance = new ProcessInstance(this);

            BuildLinkedNodes(current, ref node, nodes, processInstance);
            processInstance.Id        = Guid.NewGuid().ToString();
            processInstance.StartNode = node;
            processInstance.Nodes     = nodes.ToImmutableDictionary();

            return(processInstance);
        }
Example #4
0
        private void BuildLinkedNodes(XElement current, ref ProcessNode node, IDictionary <string, ProcessNode> nodes, ProcessInstance processInstance)
        {
            node.ProcessInstance = processInstance;
            var seq  = NextSequences(current, ProcessXML, NS);
            var next = (seq.Any() ? seq : NextElement(current, ProcessXML));

            node.NextNodes = new List <ProcessNode>();

            foreach (var n in next)
            {
                var nextNode = nodes[n.Attribute("id").Value];
                if (nextNode.PreviousNodes == null)
                {
                    nextNode.PreviousNodes = new List <ProcessNode>();
                }
                if (!nextNode.PreviousNodes.Contains(node))
                {
                    nextNode.PreviousNodes.Add(node);
                }
                node.NextNodes.Add(nextNode);
                BuildLinkedNodes(n, ref nextNode, nodes, processInstance);
            }
        }