コード例 #1
0
ファイル: Device.cs プロジェクト: radtek/rrcomssys-team-5
 private void CreateAttachmentTo(Workflow instance)
 {
     TransformationEngine.IsAttached attached =
         instance.IsAttached[WorkflowFactory.IndexOfActivity(device.fromIsAttached)];
      //   instance.IsAttached.Find(x => (x.toDevice.Equals(device.DeviceID)));
     AttachedTo = new IsAttached(attached,instance);
 }
コード例 #2
0
        /// <summary>
        /// Builds the next element.
        /// </summary>
        /// <param name="runner">The runner.</param>
        /// <param name="currentElement">The current element.</param>
        /// <param name="endElement">The end element.</param>
        /// <param name="wfInstance">The wf instance.</param>
        private void BuildNextElement(WFRunner runner, WFElement currentElement,WFElement endElement, Workflow wfInstance)
        {
            WFElement outElement = null;

              if (currentElement.GetType() == typeof (Boundary))
              {
              // This should only be entered into during the top level invocation
              // i.e. for the "Start" boundary itself.

              string nextActivity = currentElement.NextActivityID();
              //TransformationEngine.Call aCall =
              // wfInstance.Call.Find(x => x.activityID.Equals(nextActivity));
              TransformationEngine.Call aCall = wfInstance.Call.Find(x=>x.activityID.Equals(nextActivity));//[WorkflowFactory.IndexOfActivity(nextActivity)];
              if ( null != aCall )
              {
                // Create and add the new call...set this boundary as one of it's predecessors
                outElement = new Call(aCall, wfInstance);
                outElement.PreviousElements.Add(currentElement);
                runner.WorkflowElements.Add(outElement);
                BuildNextElement(runner, outElement, endElement, wfInstance);
              }
              else
              {
                if (currentElement.NextActivityID().Equals(endElement.GetActivityID()))
                {
                  // Empty workflow...just add the start as a previous element to the end.
                  endElement.PreviousElements.Add(currentElement);
                }
              }
              }
              else if (currentElement.GetType() == typeof(Call))
              {
             ConstructCall(runner, currentElement, endElement, wfInstance);
              }
              else if (currentElement.GetType() == typeof(Decision))
              {
            TransformationEngine.Decision decision = ((Decision) currentElement).DecisionModel;
            string successID = decision.successPathID;
            string failID = decision.failPathID;

            currentElement.DefaultNextActivityID = successID;

            if (null == runner.WorkflowElements.Find(x => (x.GetActivityID().Equals(successID))))
            {
              // Find the item that this is
              // Construct the Success Branch
              ConstructDecisionBranch(runner,currentElement,successID,endElement,wfInstance);
            }
            if (null == runner.WorkflowElements.Find(x => x.GetActivityID().Equals(failID)))
            {
              // Find the item that this is
              // Construct the Fail Branch
              ConstructDecisionBranch(runner, currentElement, failID, endElement, wfInstance);
            }
              }
        }
コード例 #3
0
ファイル: Boundary.cs プロジェクト: radtek/rrcomssys-team-5
        private void ConnectToNextActivity(Workflow wfInstance)
        {
            if (myActivity.ToActivity != null)
            {
                if (myActivity.Type.Equals(BoundaryType.Start))
                {
                    string activityID =
                        wfInstance.Call[WorkflowFactory.IndexOfActivity(myActivity.ToActivity)].activityID;
                    DefaultNextActivityID = activityID;
                }

            }
        }
コード例 #4
0
ファイル: Connection.cs プロジェクト: radtek/rrcomssys-team-5
        /// <summary>
        /// Builds the connection.
        /// </summary>
        /// <param name="instance">The instance.</param>
        private void BuildConnection(Workflow instance)
        {
            int key = 1;

            foreach (string deviceID in myConnection.fromDevice)
            {
                TransformationEngine.Device aDevice = instance.Device[WorkflowFactory.IndexOfActivity(deviceID)];//.//Find(x => (x.DeviceID.Equals(deviceID)));
                if (aDevice.isLocal)
                    deviceDictionary.Add(0, new Device(aDevice,instance));
                else
                {
                    deviceDictionary.Add(key, new Device(aDevice, instance));
                    key++;
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// Creates the workflow runtime.
        /// </summary>
        /// <param name="wfObj">The wf obj.</param>
        /// <returns></returns>
        public WFRunner CreateWorkflowRuntime(Workflow wfObj)
        {
            WFRunner runner = null;
            Exception except;

            try
            {
                TransformationEngine.Boundary start =
                    wfObj.Boundary.Find(x => x.Type.Equals(BoundaryType.Start));

                TransformationEngine.Boundary end =
                    wfObj.Boundary.Find(x => x.Type.Equals(BoundaryType.End));

                ConnectTheLines(wfObj, start, end, out runner);

            }
            catch(Exception innerExcept)
            {
                throw innerExcept;
            }
            return runner;
        }
コード例 #6
0
        private void ConnectTheLines(Workflow wfObj, TransformationEngine.Boundary start, TransformationEngine.Boundary end, out WFRunner runner)
        {
            runner = new WFRunner();
            WFElement currentElement = new Boundary(start,wfObj);
            WFElement endElement = new Boundary(end,wfObj);

            runner.WorkflowElements.Add(currentElement);
            // Recurse into the edges between the nodes....
            BuildNextElement(runner, currentElement, endElement, wfObj);
            //
            runner.WorkflowElements.Add(endElement);
        }
コード例 #7
0
 public void SetUp()
 {
     _doc = SchemaTransformer.GetObjectModel(@"C:\Documents and Settings\jeanr\Desktop\RRComSSysTeam5\RRComSSys\RRComSSys.WorkflowEngine.Tests\TestResources\AlternateWithWorkflow2.gcml");
 }
コード例 #8
0
ファイル: Decision.cs プロジェクト: radtek/rrcomssys-team-5
 public Decision( TransformationEngine.Decision aDecision, Workflow wfInstance)
 {
     decision = aDecision;
 }
コード例 #9
0
ファイル: Connection.cs プロジェクト: radtek/rrcomssys-team-5
 /// <summary>
 /// Initializes a new instance of the <see cref="Connection"/> class.
 /// </summary>
 /// <param name="connection">The connection.</param>
 /// <param name="wfInstance">The wf instance.</param>
 public Connection( TransformationEngine.Connection connection, Workflow wfInstance)
 {
     ConnectionType = connection;
     BuildConnection(wfInstance);
 }
コード例 #10
0
ファイル: Call.cs プロジェクト: radtek/rrcomssys-team-5
 /// <summary>
 /// Builds the connection.
 /// </summary>
 /// <param name="instance">The instance.</param>
 private void BuildConnection(Workflow instance)
 {
     try
     {
         TransformationEngine.Connection aConnection =
             instance.Connection[WorkflowFactory.IndexOfActivity(myActivity.CallToConnection)];
             //.Find(x => (x.ConnectionID == myActivity.CallToConnection));
         CallConnection = new Connection(aConnection, instance);
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #11
0
ファイル: IsAttached.cs プロジェクト: radtek/rrcomssys-team-5
 /// <summary>
 /// Attaches to person.
 /// </summary>
 /// <param name="wfInstance">The wf instance.</param>
 private void AttachToPerson(Workflow wfInstance)
 {
     TransformationEngine.Person aPerson = wfInstance.Person.Find(x => x.personID.Equals(isAttached.fromPerson));//[WorkflowFactory.IndexOfActivity(isAttached.fromPerson)];//.Find(x => (x.personID.Equals(isAttached.fromPerson)));
     person = new WorkflowEngine.Person(aPerson);
 }
コード例 #12
0
ファイル: IsAttached.cs プロジェクト: radtek/rrcomssys-team-5
 /// <summary>
 /// Initializes a new instance of the <see cref="IsAttached"/> class.
 /// </summary>
 /// <param name="anIsAttached">An is attached.</param>
 /// <param name="wfInstance">The wf instance.</param>
 public IsAttached(TransformationEngine.IsAttached anIsAttached, Workflow wfInstance)
 {
     isAttached = anIsAttached;
     AttachToPerson(wfInstance);
 }
コード例 #13
0
ファイル: WXCML.cs プロジェクト: radtek/rrcomssys-team-5
 /// <summary>
 /// Deserializes workflow markup from file into an Workflow object
 /// </summary>
 // <param name="xml">string workflow markup to deserialize</param>
 // <param name="obj">Output Workflow object</param>
 // <param name="exception">output Exception value if deserialize failed</param>
 // <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out Workflow obj, out System.Exception exception)
 {
     exception = null;
     obj = null;
     try
     {
         System.IO.FileStream file = new System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read);
         System.IO.StreamReader sr = new System.IO.StreamReader(file);
         string xmlString = sr.ReadToEnd();
         sr.Close();
         file.Close();
         return Deserialize(xmlString, out obj, out exception);
     }
     catch (System.Exception e)
     {
         exception = e;
         return false;
     }
 }
コード例 #14
0
ファイル: WXCML.cs プロジェクト: radtek/rrcomssys-team-5
 /// <summary>
 /// Deserializes workflow markup into an Workflow object
 /// </summary>
 // <param name="xml">string workflow markup to deserialize</param>
 // <param name="obj">Output Workflow object</param>
 // <param name="exception">output Exception value if deserialize failed</param>
 // <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out Workflow obj, out System.Exception exception)
 {
     exception = null;
     obj = null;
     try
     {
         System.IO.StringReader stringReader = new System.IO.StringReader(xml);
         System.Xml.XmlTextReader xmlTextReader = new System.Xml.XmlTextReader(stringReader);
         System.Xml.Serialization.XmlSerializer xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(Workflow));
         obj = ((Workflow)(xmlSerializer.Deserialize(xmlTextReader)));
         return true;
     }
     catch (System.Exception e)
     {
         exception = e;
         return false;
     }
 }
コード例 #15
0
ファイル: Boundary.cs プロジェクト: radtek/rrcomssys-team-5
 public Boundary( TransformationEngine.Boundary obj, Workflow wfInstance)
 {
     myActivity = obj;
     ConnectToNextActivity(wfInstance);
 }
コード例 #16
0
        /// <summary>
        /// Constructs the call.
        /// </summary>
        /// <param name="runner">The runner.</param>
        /// <param name="currentElement">The current element.</param>
        /// <param name="endElement">The end element.</param>
        /// <param name="wfInstance">The wf instance.</param>
        private void ConstructCall(WFRunner runner, WFElement currentElement, WFElement endElement, Workflow wfInstance)
        {
            WFElement outElement = null;
              Call theCall = (Call) currentElement;
              string callToDecision = theCall.CallModel().CallToDecision;
              string callToBoundary = theCall.CallModel().CallToBoundary;

              TransformationEngine.Boundary calledBoundary = (!string.IsNullOrEmpty(callToBoundary)) ? wfInstance.Boundary[WorkflowFactory.IndexOfActivity(callToBoundary)]
                                                                                                : null;

              TransformationEngine.Decision calledDecision = (!string.IsNullOrEmpty(callToDecision)) ? wfInstance.Decision[WorkflowFactory.IndexOfActivity(callToDecision)]
                                                                                                : null;

              if (null != calledBoundary )
              {
              if (calledBoundary.Type.Equals(TransformationEngine.BoundaryType.End))
              {
                  if( (null != calledDecision ) && (null == currentElement.PreviousElements.Find(x=>x.GetActivityID().Equals(calledDecision.activityID))))
                  {
                      throw new Exception(
                          "Call Cannot be Connected to a Decision and End Elements without having parsed the Decision");
                  }
                  currentElement.DefaultNextActivityID = endElement.GetActivityID();
                  endElement.PreviousElements.Add(currentElement);
                  return; // If I've hit an END Boundary node, no need to look at the Decision node
              }
              }

              if (null != calledDecision)
              {
              if (null !=
                  currentElement.PreviousElements.Find(x => x.GetActivityID().Equals(calledDecision.activityID)))
              {
                  throw new Exception("Decision was already connected to this Call");

              }
              else
              {
                    outElement = new Decision(calledDecision, wfInstance);

                    // Add the Call to the Decision's PreviousElements
                    outElement.PreviousElements.Add(currentElement);
                    // Set Default Next Activity ID
                    currentElement.DefaultNextActivityID = outElement.GetActivityID();
                    // Add the Decision to the Workflow
                    runner.WorkflowElements.Add(outElement);

                    // Try to build next Element
                    BuildNextElement(runner, outElement, endElement, wfInstance);
              }
              }
        }
コード例 #17
0
        /// <summary>
        /// Constructs the decision branch.
        /// </summary>
        /// <param name="runner">The runner.</param>
        /// <param name="currentElement">The current element.</param>
        /// <param name="elementActivityID">The element activity ID.</param>
        /// <param name="endElement">The end element.</param>
        /// <param name="wfInstance">The wf instance.</param>
        private void ConstructDecisionBranch(WFRunner runner, WFElement currentElement, string elementActivityID, WFElement endElement, Workflow wfInstance)
        {
            TransformationEngine.Call possibleCall = wfInstance.Call.Find(x => x.activityID.Equals(elementActivityID));
            if (null != possibleCall)
            {
              // We know it's a call
              // See if it's already within the workflow
              WFElement possibleElement = ElementExistsInWorkflow(runner,possibleCall.activityID);
              if (null == possibleElement)
              {
                // If it isn't, add it, and keep recursing.
                WFElement outElement = new Call(possibleCall, wfInstance);
                outElement.PreviousElements.Add(currentElement);
                currentElement.DefaultNextActivityID = outElement.GetActivityID();
                runner.WorkflowElements.Add(outElement);
                BuildNextElement(runner, outElement, endElement, wfInstance);
              }
            }
            else
            {
              // MUST be the "End" boundary
              // Add this Decision to the "End" boundaries previousElements

              endElement.PreviousElements.Add(currentElement);
              // return
            }
        }
コード例 #18
0
ファイル: Call.cs プロジェクト: radtek/rrcomssys-team-5
 /// <summary>
 /// Initializes a new instance of the <see cref="Call"/> class.
 /// </summary>
 /// <param name="aCall">A call.</param>
 /// <param name="wfInstance">The wf instance.</param>
 public Call( TransformationEngine.Call aCall, Workflow wfInstance )
 {
     myActivity = aCall;
     BuildConnection(wfInstance);
 }
コード例 #19
0
 public SchemaInstantiator(Workflow doc, IMissingAttributeHandler handler)
 {
     Document = doc;
     MissingAttributeEvt = handler.GetMissingAttribute;
 }
コード例 #20
0
ファイル: Device.cs プロジェクト: radtek/rrcomssys-team-5
 public Device( TransformationEngine.Device aDevice, Workflow wfInstance)
 {
     device = aDevice;
     CreateAttachmentTo(wfInstance);
 }