示例#1
0
        /// <summary>
        /// Get The Nodes in Sequence Order
        /// </summary>
        /// <param name="AD_Client_ID">client</param>
        /// <returns>Nodes in sequence</returns>
        private MWFNode[] GetNodesInOrder(int AD_Client_ID)
        {
            List <MWFNode> list = new List <MWFNode>();

            AddNodesSF(list, GetAD_WF_Node_ID(), AD_Client_ID); //	start with first
            //	Remaining Nodes
            if (_nodes.Count != list.Count)
            {
                //	Add Stand alone
                for (int n = 0; n < _nodes.Count; n++)
                {
                    MWFNode node = (MWFNode)_nodes[n];
                    if (!node.IsActive())
                    {
                        continue;
                    }
                    if (node.GetAD_Client_ID() == 0 || node.GetAD_Client_ID() == AD_Client_ID)
                    {
                        bool found = false;
                        for (int i = 0; i < list.Count; i++)
                        {
                            MWFNode existing = (MWFNode)list[i];
                            if (existing.GetAD_WF_Node_ID() == node.GetAD_WF_Node_ID())
                            {
                                found = true;
                                break;
                            }
                        }
                        if (!found)
                        {
                            log.Log(Level.WARNING, "Added Node w/o transition: " + node);
                            list.Add(node);
                        }
                    }
                }
            }
            //
            MWFNode[] nodeArray = new MWFNode[list.Count];
            nodeArray = list.ToArray();
            return(nodeArray);
        }
示例#2
0
        /// <summary>
        /// Add Nodes recursively (sibling first) to Ordered List
        /// </summary>
        /// <param name="list">list to add to</param>
        /// <param name="AD_WF_Node_ID">start node id</param>
        /// <param name="AD_Client_ID">for client</param>
        private void AddNodesSF(List <MWFNode> list, int AD_WF_Node_ID, int AD_Client_ID)
        {
            MWFNode node = GetNode(AD_WF_Node_ID);

            if (node != null &&
                (node.GetAD_Client_ID() == 0 || node.GetAD_Client_ID() == AD_Client_ID))
            {
                if (!list.Contains(node))
                {
                    list.Add(node);
                }
                MWFNodeNext[] nexts = node.GetTransitions(AD_Client_ID);
                for (int i = 0; i < nexts.Length; i++)
                {
                    MWFNode child = GetNode(nexts[i].GetAD_WF_Next_ID());
                    if (!child.IsActive())
                    {
                        continue;
                    }
                    if (child.GetAD_Client_ID() == 0 ||
                        child.GetAD_Client_ID() == AD_Client_ID)
                    {
                        if (!list.Contains(child))
                        {
                            list.Add(child);
                        }
                    }
                }
                //	Remainder Nodes not connected
                for (int i = 0; i < nexts.Length; i++)
                {
                    if (nexts[i].IsActive())
                    {
                        AddNodesSF(list, nexts[i].GetAD_WF_Next_ID(), AD_Client_ID);
                    }
                }
            }
        }
示例#3
0
        /// <summary>
        /// Get the active nodes
        /// </summary>
        /// <param name="ordered">ordered ordered array</param>
        /// <param name="AD_Client_ID">for client</param>
        /// <returns>array of nodes</returns>
        public MWFNode[] GetNodes(bool ordered, int AD_Client_ID)
        {
            if (ordered)
            {
                return(GetNodesInOrder(AD_Client_ID));
            }
            List <MWFNode> list = new List <MWFNode>();

            for (int i = 0; i < _nodes.Count; i++)
            {
                MWFNode node = _nodes[i];
                if (!node.IsActive())
                {
                    continue;
                }
                if (node.GetAD_Client_ID() == 0 || node.GetAD_Client_ID() == AD_Client_ID)
                {
                    list.Add(node);
                }
            }
            MWFNode[] retValue = new MWFNode[list.Count];
            retValue = list.ToArray();
            return(retValue);
        }