This project is read-only.

Getting and Setting Multiple Workflow Object Propertiies

Note: This example (GetSetTest.cs) can be found in 'JetfireCoreExampleTests' project, which is part of the release download (V1.0.18 or higher).

The application interface primary access mechanism to Jetfire data is via properties. Therefore it is desirable to be able to set or get all, or a subset of properities, in a single operation from .net code. This is possible with the 'Set' and 'Get' methods using a Jetfire class or workflow object.

The following example demonstrates the use the overloaded 'Get' and 'Set' methods. The example uses a workflow class called "Machine" that has a number of properties called "MachineName", "Location", "Condition", "InstalledDate" and "Weight".

string jetfireCode =
            namespace test
               public workflow Machine
                  // Constructor
                  public Machine(string machineName)
                    this.MachineName = machineName;
                    this.Condition = ConditionType.Working;
                    this.InstalledDate = DateTime.Now;
                  public string MachineName {get; private set;}
                  public DateTime InstalledDate{get; set;}
                  public string Location{get; set;}
                  public ConditionType Condition{get; set;}
                  public int Weight{get; set;}
               public enum ConditionType

        public void SetProperties()

            using (LinqStartObjects start = JetfireTest.NewNexusServer(
                JetfireTest.CDRIVE_JETFIRETEST,     // directory name - where the objects are stored
                TjStorageCommand.ClearStorage       // deletes any existing files in the directory
                TjNexus nexus = start.ClientNexus;
                //  Parse source code and create the Jetfire executable code expressions, 
                //  get the workflow class 'Machine',
                //  then instantiate a new workflow object.
                TjWorkflowClass machineClass = nexus.FindClass<TjWorkflowClass>("test", "Machine");
                string time = DateTime.Now.ToString(TjDateTime.DateTimeFormat);
                TjWorkflow machine = machineClass.New("Printing Press");
                // Set the properties
                machine.Set(new TjItem[]{
                    new TjItem("Back Office", machineClass, "Location"),
                    new TjItem("235", machineClass, "Weight"),
                    new TjItem("Broken", machineClass, "Condition")});
                // Get the properties
                TjItemResult[] items = machine.Get(new string[] { "MachineName", "InstalledDate", "Location", "Condition", "Weight" });

                Assert.AreEqual(5, items.Length);
                Assert.AreEqual("Printing Press", items[0].ToString());
                Assert.AreEqual(time, items[1].ToString());
                Assert.AreEqual("Back Office", items[2].ToString());
                Assert.AreEqual("Broken", items[3].ToString());
                Assert.AreEqual("235", items[4].ToString());


Last edited Apr 4, 2009 at 1:18 PM by JohnHansen, version 6


No comments yet.