Transition is the second key object a scheme comprises. Transition always connects two Activities together, and controls the sequence of execution of your processes. With its help, you may create transitions triggered by commands or timers, as well as conditional and parallel branches. If you open the Transition parameters window in Designer, the following properties are available for modification:
Name - a unique name of Transition. It is rarely used, and is automatically filled in by Designer. Transition name becomes quite important if Transition is initial for a subprocess;
From activity - the name of the initial Activity for Transition;
To activity - the name of the final Activity for Transition;
Classifier - Transition's classifier. It can have three states: Not Specified, Direct - marks the direct movement of the document, for example, from the Created state to the Approved state, and Reverse - marks the reversal movement of the document, for example, from the Approving state to the Rejected state or back to the Created state. This parameter is optional. All your Transitions may have Classifier = Not Specified, and it does not imply that the processes will be executed in some other way. However, this attribute is often used in the following Workflow Engine features: in the Pre-Execution mode for automatic control of the existence of a subprocess (see Subprocesses), or, for example, to highlight command buttons, just like we do it in the demo.
Trigger - sets the Transition's trigger type. Its detailed description is given in the introductory part of the Main Terms section. There are the following Trigger types:
WorkflowInit.Runtime.ExecuteCommand
method; Restrictions - used to restrict access to a command. It contains a list of restrictions with Allow or Restrict types and the name of the Actor entity. Allow enables a specified Actor to execute a command specified in Transition. Restrict, in turn, forbids it;
Concat allow as - determines the type of concatenation of Restrictions with type Allow. It may be And or Or;
Concat restrict as - determines the type of concatenation of Restrictions with type Restrict. It may be And or Or.
For a more detailed description of how Restrictions are used, how Actors are connected with Rule, and Rule with your security system, refer to the Rules section.
Condition - conditions checked before a Transition is executed. They come in the following types:
There can be as many conditions with type Action as you need. Conditions with Always and Otherwise types can be used just once. All three types are mutually exclusive. For more details about Action, refer to the Actions section.
Conditions concatenation type - determines the type of concatenation of Conditions with the Action type. It may be And or Or;
Is Fork - determines whether a Transition is an input to a subprocess or an output from it. Refer to the Subprocesses section for more details;
Merge subprocess via set state - determines the type of merger of a subprocess with the main process;
Disable parent process control - determines the type of control (manual or automatic) over the existence of a subprocess.
A direct access to Transitions is rarely required. However, here are the major methods in case you need them:
List<TransitionDefinition> transitions = processInstance.ProcessScheme.Transitions;
TransitionDefinition someTransition = processInstance.ProcessScheme.FindTransition("TransitionName");
List<TransitionDefinition> transitions = processInstance.ProcessScheme.FindTransitions(activityFrom,activityTo);
IEnumerable<TransitionDefinition> transitions = processInstance.ProcessScheme.GetPossibleTransitionsForActivity(activity);