Exemple #1
0
        public List <T> GetElementList <T>(Stream processXml, string xmlTag)
        {
            List <T> elements = new List <T>();
            bool     skip     = false;

            StreamUtil.Restore(ref processXml);
            using (XmlReader reader = XmlReader.Create(processXml))
            {
                reader.ReadToFollowing(xmlTag + "s");
                while (reader.Read() && !skip)
                {
                    if (reader.MoveToContent() == XmlNodeType.Element)
                    {
                        if (String.Equals(reader.Name, xmlTag, StringComparison.CurrentCultureIgnoreCase))
                        {
                            elements.Add(XmlUtil.Deserialize <T>(reader.ReadOuterXml()));
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            return(elements);
        }
Exemple #2
0
        /// <summary>
        /// 在流程定义图中,获取节点的 输入 和 输出 连线
        /// </summary>
        /// <param name="processXml"></param>
        /// <param name="sequenceID">连接线的ID</param>
        /// <param name="side">想要获取流出连线: false进入连线,true流出连线</param>
        /// <returns></returns>
        public List <ZSequence> FindAllSidesLines(Stream processXml, string stepID)
        {
            string           rightLine = string.Empty;
            List <ZSequence> lines     = new List <ZSequence>();
            bool             skip      = false;

            StreamUtil.Restore(ref processXml);
            string known = string.Empty;

            using (XmlReader reader = XmlReader.Create(processXml))
            {
                reader.ReadToFollowing("Sequences");
                while (reader.Read() && !skip)
                {
                    if (reader.MoveToContent() == XmlNodeType.Element)
                    {
                        if (String.Equals(reader.Name, "SEQUENCE", StringComparison.CurrentCultureIgnoreCase))
                        {
                            if (reader.GetAttribute("Source") == stepID || reader.GetAttribute("Target") == stepID)
                            {
                                lines.Add(XmlUtil.Deserialize <ZSequence>(reader.ReadOuterXml()));
                            }
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }

            return(lines);
        }
Exemple #3
0
        /// <summary>
        /// 在流程定义图中,连线的Target节点
        /// </summary>
        /// <param name="processXml"></param>
        /// <param name="sequenceID">连接线的ID</param>
        /// <returns></returns>
        public object FindRightNode(Stream processXml, string sequenceID)
        {
            string nextObjStr    = string.Empty;    // 下一步Block字符串
            string nextStepID    = string.Empty;    // 下一步节点ID
            string nextBlockType = null;
            bool   skip          = false;

            StreamUtil.Restore(ref processXml);
            using (XmlReader reader = XmlReader.Create(processXml))
            {
                reader.ReadToFollowing("Sequences");
                while (reader.Read() && !skip)
                {
                    if (reader.MoveToContent() == XmlNodeType.Element)
                    {
                        if (String.Equals(reader.Name, "SEQUENCE", StringComparison.CurrentCultureIgnoreCase))
                        {
                            if (reader.GetAttribute("ID") == sequenceID)
                            {
                                nextStepID = reader.GetAttribute("Target");
                                break;
                            }
                        }
                    }
                }

                reader.ReadToFollowing("Steps");
                while (reader.Read())
                {
                    if (reader.MoveToContent() == XmlNodeType.Element && reader.GetAttribute("ID") == nextStepID)
                    {
                        nextBlockType = reader.Name;
                        nextObjStr    = reader.ReadOuterXml();
                        break;
                    }
                    reader.Skip();
                }
            }

            Type type = Type.GetType("Ant.Entity.Bpmx.Z" + nextBlockType);

            return(XmlUtil.Deserialize(type, nextObjStr));
        }
Exemple #4
0
        public List <ZParam> FindAllParams(Stream processXml)
        {
            List <ZParam> paramList = new List <ZParam>();

            StreamUtil.Restore(ref processXml);
            using (XmlReader reader = XmlReader.Create(processXml))
            {
                reader.ReadToFollowing("Params");
                while (reader.Read())
                {
                    if (reader.MoveToContent() == XmlNodeType.Element)
                    {
                        if (String.Equals(reader.Name, "PARAM", StringComparison.CurrentCultureIgnoreCase))
                        {
                            paramList.Add(XmlUtil.Deserialize(typeof(ZParam), reader.ReadOuterXml()) as ZParam);
                        }
                    }
                }
            }
            return(paramList);
        }
Exemple #5
0
        /// <summary>
        /// 获取流程定义中的所有开始节点
        /// </summary>
        /// <param name="processXml"></param>
        /// <returns></returns>
        public List <ZStartEvent> FindStartNode(Stream processXml)
        {
            List <ZStartEvent> starters = new List <ZStartEvent>();

            StreamUtil.Restore(ref processXml);
            using (XmlReader reader = XmlReader.Create(processXml))
            {
                reader.ReadToFollowing("Steps");
                while (reader.Read())
                {
                    if (reader.MoveToContent() == XmlNodeType.Element && String.Equals(reader.Name, "STARTEVENT", StringComparison.CurrentCultureIgnoreCase))
                    {
                        starters.Add(XmlUtil.Deserialize(typeof(ZStartEvent), reader.ReadOuterXml()) as ZStartEvent);
                    }
                    else
                    {
                        reader.Skip();
                    }
                }
            }
            return(starters);
        }