|
|
Getting Started with Jetfire Workflows If you are a first time user of Jetfire Workflows, then this document helps get you started. What is a workflow? Terminology is explained in the Jetfire Terminology document.
The structure of the Jetfire Workflow The Jetfire Workflow is defined in a text file. Figure 1 contains an example of a Sample Workflow. The file contains:
- Namespace: this file contains one or more workflows
- Workflow (Class): this is a class. In Jetfire, the workflow has a set of special attributes
- A method to create the workflow (Constructor)
- (Transition) States
- Commands (Methods) to transition between states
- Properties
// A name where the workflows in this file are defined. namespace JetfireWorkflowNamespace { // Definition of a Workflow public workflow ThisWorkflow { string nameOfSomething; // A method that runs when the workflow is created public ThisWorkflow() { // enter a state when the workflow is created enterstate FirstState(); // Add initialization } // Define States for the workflow public FirstState() { } public SecondState() { } public ThirdState() { } // Add commands that determine transitions between states // This method is only valid when the workflow is in the FirstState public void GoToSecondState() : states(FirstState) { enterstate SecondState(); } // This method is only valid when the workflow is in the SecondState or ThirdState public void GoToThirdState() : states(SecondState, ThirdState) { enterstate ThirdState(); } // Properties public string NameOfSomething { get { return this.nameOfSomething; } } } }
| Figure 1: Structure of a Sample Workflow
The Constructor of the Workflow Constructor: This is the method that is called when the workflow is created. The name of the constructor is the same as the workflow (class). Use the keyword “enterstate” to start at a state. Add any other code that needs to be done when the workflow is initialized. Methods are used as commands that may be called from the GUI.
Adding States to a Workflow States: Note that the structure of a state method is “public StateName()”. The syntax is the same as a constructor. The state method is called when the workflow enters the state.
- “public ~StateName()” is the state method called when the workflow exits the workflow. Note the “~” preceding the state name.
- The command method is called when the workflow transitions between states.
Adding Methods to a Workflow Methods: “public void DoSomething()” is the structure of a method. Methods may return data to the calling location. (Constructors and State procedures are also a subset of Methods.) Command methods may be restricted to specific states,
- “public void CommandName : states(StateName1, StateName2)” shows a command method that is only valid when the workflow is in states StateName1 and StateName2.
Command methods may have restricted access for specific roles.
- Public void CommandName : roles(Admin) shows a command method that is only valid when the role of the logged in user is Admin.
When states and roles are used, the workflow provides a customized view of what commands are seen when and by whom.
Adding Properties to a Workflow Properties: Workflows are containers for information. E.g. a list of notes, workers, dates, and more. Properties have getters (get the value of the property) and setters (set the value of a property). Getters and setters can also call methods. This following property shows that the setter sets the value of the property and calls a method.
public string SomeProperty { set { this.someproperty = value; this.DoSomething(); } }
| Figure 2: Property example
|
|
|
|
|