/// <summary> /// Adds an edge between two nodes, saving its information in Page's Session /// </summary> /// <param name="wfID">The WF's ID</param> /// <param name="fromNodeID">The edge's head</param> /// <param name="toNodeID">The edge's tail</param> /// <param name="edgeXML">The edge's XML value</param> private void AddEdge(string wfID, string fromNodeID, string toNodeID, string edgeXML) { WFnode from = (WFnode)Page.Session[fromNodeID]; WFnode to = (WFnode)Page.Session[toNodeID]; if (from == null || to == null || from == to) { return; } XmlDocument edgeDocument = new XmlDocument(); edgeDocument.InnerXml = edgeXML; //TOCHANGE Workflow wf = (Workflow)Page.Session[wfID]; WFedgeLabel edge = wf.GetEdgeBetween(from, to); if (edge != null) { try { edge.ModifyPrecondition(edgeDocument); } catch (Exception e) { callbackResult = e.Message; } } else { edge = new WFedgeLabel(edgeDocument, null); wf.AddEdge(edge, from, to); } }
/// <summary> /// Receives client's call and adds an edge between 'Node id from' and 'Node id to' /// </summary> /// <param name="eventArgument">WorkflowId from client & Node id from & Node id to & Xml predicate</param> public void RaiseCallbackEvent(string eventArgument) { string[] args = eventArgument.Split('&'); string workflowId = args[0]; string fromNodeNameCodified = args[1]; string toNodeNameCodified = args[2]; callbackResult = "OK"; Workflow wf = (Workflow)Page.Session[workflowId]; wf.WorkflowInvalidationEvent += new EventHandler <WorkflowValidationEventArgs>(wf_WorkflowInvalidationEvent); WFedgeLabel edge = wf.GetEdgeBetween((WFnode)Page.Session[fromNodeNameCodified], (WFnode)Page.Session[toNodeNameCodified]); wf.RemoveEdge(edge); }
public IComputableWorkflow testValidationGUI() { WFnode nd1 = testNode1(); WFnode nd2 = testNode2(); WFedgeLabel edge = new WFedgeLabel(); XmlDocument d = new XmlDocument(); d.LoadXml("<PRECONDITIONS></PRECONDITIONS>"); edge.ModifyPrecondition(d); Workflow wf = new Workflow("PIPPO"); wf.AddNode(nd1); wf.AddNode(nd2); wf.AddEdge(edge, nd1, nd2); return(wf.Save()); }