コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the OnMessageStep class
        /// </summary>
        /// <param name="attributes">Xml attributes from the BPEL file</param>
        public OnMessageStep(XmlAttributeCollection attributes)
        {
            // read attributes
            foreach (XmlAttribute attrib in attributes)
            {
                if (attrib.LocalName == "name")
                {
                    StepId = attrib.Value;
                    break;
                }
            }

            this.receiveStep = new ReceiveStep(attributes);
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the OnMessageStep class
        /// </summary>
        /// <param name="attributes">Xml attributes from the BPEL file</param>
        public OnMessageStep(XmlAttributeCollection attributes)
        {
            // read attributes
            foreach (XmlAttribute attrib in attributes)
            {
                if (attrib.LocalName == "name")
                {
                    StepId = attrib.Value;
                    break;
                }
            }

            this.receiveStep = new ReceiveStep(attributes);
        }
コード例 #3
0
        /// <summary>
        /// Fill the various structures with step data from the BPEL XML file
        /// </summary>
        /// <param name="workflowContext"> workflowcontextModel class</param>
        /// <param name="startElement">Integer value representing the starting element in the nodeList.</param>
        /// <param name="nodeList">XmlNodeList containing the BPEL data from the BPEL file</param>
        /// <param name="cancelEventHandlerName">cancelEventHandlerName</param>
        private void FillStepList(WorkflowContext workflowContext, List<IWorkflowStep> workflowStepList, int startElement, XmlNodeList nodeList, ref string cancelEventHandlerName)
        {
            for (int i = startElement; i < nodeList.Count; i++)
            {
                var currentStep = nodeList[i];

                if (!string.IsNullOrEmpty(currentStep.Prefix))
                {
                    currentStep.Prefix = "bpel";
                }

                if (currentStep is XmlComment)
                {
                    continue;
                }

                if (currentStep.LocalName == "invoke")
                {
                    var workflowStep = new InvokeStep(currentStep.Attributes);
                    workflowStepList.Add(workflowStep);
                }
                else if (currentStep.LocalName == "sequence")
                {
                    var sequenceStep = new SequenceStep(currentStep.Attributes);
                    workflowStepList.Add(sequenceStep);
                    FillStepList(workflowContext, sequenceStep.WorkflowSteps, 0, currentStep.ChildNodes, ref cancelEventHandlerName);
                }
                else if (currentStep.LocalName == "scope")
                {
                    // can't get tool to produce invoke without having it enclosed in a scope.
                    // just ignore scope for now but get the internals as if at the same level.
                    FillStepList(workflowContext, workflowStepList, 0, currentStep.ChildNodes, ref cancelEventHandlerName);
                }
                else if (currentStep.LocalName == "receive")
                {
                    var receiveStep = new ReceiveStep(currentStep.Attributes);
                    workflowStepList.Add(receiveStep);
                    string messageName = String.Empty;
                    string timesetTime = String.Empty;
                    if (currentStep.Attributes != null)
                        foreach (XmlAttribute attrib in currentStep.Attributes)
                        {
                            if (attrib.LocalName == "timeout")
                            {
                                timesetTime = attrib.Value;
                            }
                            if (attrib.LocalName == "variable")
                            {
                                messageName = attrib.Value;
                            }
                        }
                    if (!timeoutParameters.ContainsKey(messageName))
                    {
                        timeoutParameters.Add(messageName, timesetTime);
                    }
                }
                else if (currentStep.LocalName == "switch")
                {
                    var switchStep = new SwitchStep(currentStep.Attributes);
                    workflowStepList.Add(switchStep);

                    // Fill case/otherwise steps inside of switch step
                    FillStepList(workflowContext, switchStep.WorkflowSteps, 0, currentStep.ChildNodes, ref cancelEventHandlerName);
                }
                else if (currentStep.LocalName == "case")
                {
                    var caseStep = new CaseStep(currentStep.Attributes, false);
                    workflowStepList.Add(caseStep);
                    FillStepList(workflowContext, caseStep.WorkflowSteps, 0, currentStep.ChildNodes, ref cancelEventHandlerName);
                }
                else if (currentStep.LocalName == "otherwise")
                {
                    var caseStep = new CaseStep(currentStep.Attributes, true);
                    workflowStepList.Add(caseStep);
                    FillStepList(workflowContext, caseStep.WorkflowSteps, 0, currentStep.ChildNodes, ref cancelEventHandlerName);
                }
                else if (currentStep.LocalName == "while")
                {
                    var whileStep = new WhileStep(currentStep.Attributes);
                    workflowStepList.Add(whileStep);
                    FillStepList(workflowContext, whileStep.WorkflowSteps, 0, currentStep.ChildNodes, ref cancelEventHandlerName);
                }
                else if (currentStep.LocalName == "pick")
                {
                    var pickStep = new PickStep(currentStep.Attributes);
                    workflowStepList.Add(pickStep);
                    FillStepList(workflowContext, pickStep.WorkflowSteps, 0, currentStep.ChildNodes, ref cancelEventHandlerName);
                }
                else if (currentStep.LocalName == "eventHandlers")
                {
                    //we will handle this section as same as handl scope
                    FillStepList(workflowContext, workflowStepList, 0, currentStep.ChildNodes, ref cancelEventHandlerName);
                }
                else if (currentStep.LocalName == "onMessage")
                {
                    var messageStep = new OnMessageStep(currentStep.Attributes);
                    workflowStepList.Add(messageStep);

                    string messageName = String.Empty;
                    string timesetTime = String.Empty;
                    if (currentStep.Attributes != null)
                        foreach (XmlAttribute attrib in currentStep.Attributes)
                        {
                            if (attrib.LocalName == "timeout")
                            {
                                timesetTime = attrib.Value;
                            }
                            if (attrib.LocalName == "variable")
                            {
                                messageName = attrib.Value;
                            }
                        }
                    if (!timeoutParameters.ContainsKey(messageName))
                    {
                        timeoutParameters.Add(messageName, timesetTime);
                    }

                    FillStepList(workflowContext, messageStep.WorkflowSteps, 0, currentStep.ChildNodes, ref cancelEventHandlerName);
                }
                else if (currentStep.LocalName == "onEvent")
                {
                    var onEventStep = new OnEventStep(currentStep.Attributes);
                    workflowContext.MessageTimeoutEventHanlderDict.Add(onEventStep.EventKey, onEventStep.StepId);
                    workflowStepList.Add(onEventStep);
                    FillStepList(workflowContext, onEventStep.WorkflowSteps, 0, currentStep.ChildNodes, ref cancelEventHandlerName);
                }
                else if (currentStep.LocalName == "partnerLinks")
                {
                    FillPartnerLinkList(workflowContext, currentStep);
                }
                else if (currentStep.LocalName == "variables")
                {
                    FillVariableList(workflowContext, currentStep);
                }
                else if (currentStep.LocalName == "faultHandlers")
                {
                    foreach (XmlNode childNode in currentStep.ChildNodes)
                    {
                        var faultHandler = new FaultHandler(childNode);
                        workflowStepList.Add(faultHandler);
                        FillStepList(workflowContext, faultHandler.WorkflowSteps, 0, childNode.ChildNodes, ref cancelEventHandlerName);
                    }
                }
                else
                {
                    Debug.Fail("Unhandled " + currentStep.Name + " of " + currentStep.InnerText);
                }
            }
        }