-
Notifications
You must be signed in to change notification settings - Fork 48
Home
Welcome to BPMEngine a library designed to execute BPMN 2.0 compliant diagrams (XML Documents) and execute them in software. The execution of a business process can be extended by creating xml elements inside of the bpmn:extensionElements item inside BPMN (which is the compliant method). When executing a process and intercepting the tasks and elements, you can write code to access the elements inside of the item to perform appropriate steps based on the extension that has been written.
- ActiveStepsException
- BasicEvents
-
BusinessProcess
- #ctor(doc,constants,events,validations,tasks,logging)
- Document
- Item
- BeginProcess(pars,events,validations,tasks,logging,stateLogLevel)
- Diagram(type)
- Dispose()
- Equals(obj)
- ExtractProcessLog(doc)
- ExtractProcessLog(reader)
- ExtractProcessSteps(doc)
- ExtractProcessSteps(reader)
- ExtractProcessVariablesFromStateDocument(doc)
- ExtractProcessVariablesFromStateDocument(doc,stepIndex)
- ExtractProcessVariablesFromStateDocument(reader)
- ExtractProcessVariablesFromStateDocument(reader,stepIndex)
- GetHashCode()
- LoadState(doc,autoResume,events,validations,tasks,logging,stateLogLevel)
- LoadState(reader,autoResume,events,validations,tasks,logging,stateLogLevel)
- DateString
- DiagramException
- ElementProcessEvents
- FlowEvents
- IElement
- IFlowElement
- IManualTask
- IParentElement
-
IProcessInstance
- CurrentState
- CurrentVariables
- Document
- Item
- Keys
- StateLogLevel
- Animate(outputVariables)
- Diagram(outputVariables,type)
- GetManualTask(taskID)
- GetUserTask(taskID)
- Resume()
- Suspend()
- WaitForCompletion()
- WaitForCompletion(millisecondsTimeout)
- WaitForCompletion(timeout)
- WaitForManualTask(taskID,task)
- WaitForManualTask(millisecondsTimeout,taskID,task)
- WaitForManualTask(timeout,taskID,task)
- WaitForUserTask(taskID,task)
- WaitForUserTask(millisecondsTimeout,taskID,task)
- WaitForUserTask(timeout,taskID,task)
- IReadonlyVariables
- ISequenceFlow
- IState
- IStateStep
- IStepElement
- ITask
- IUserTask
- IVariables
- IVariablesContainer
- IntermediateProcessExcepion
- InvalidAttributeValueException
- InvalidElementException
- InvalidProcessDefinitionException
- IsEventStartValid
- IsFlowValid
- IsProcessStartValid
- JintAssemblyMissingException
- LogException
- LogLine
- MissingAttributeException
- MultipleOutgoingPathsException
- NotSuspendedException
- OnElementAborted
- OnElementEvent
- OnFlowComplete
- OnProcessErrorEvent
- OnProcessEvent
- OnStateChange
- ProcessEvents
- ProcessLogging
- ProcessTask
- ProcessTasks
- SFile
- SProcessRuntimeConstant
- StartManualTask
- StartUserTask
- StepStatuses
- StepValidations
BPMNEngine
This Exception is thrown when a Process Instance is being disposed but still has active steps
BPMNEngine.DelegateContainers.Events
Base class used to define the properties (event types) for a given element types events
This delegate is called when a particular element completes
public void OnEventCompleted(IStepElement Event, IReadonlyVariables variables){
Console.WriteLine("Event {0} inside process {1} has completed with the following variables:",Event.id,Event.Process.id);
foreach (string key in variables.FullKeys){
Console.WriteLine("\t{0}:{1}",key,variables[key]);
}
}
This delegate is called when a particular element has an error
public void OnEventError(IStepElement Event, IReadonlyVariables variables){
Console.WriteLine("Event {0} inside process {1} had the error {2} occur with the following variables:",new object[]{Event.id,Event.Process.id,variables.Error.Message});
foreach (string key in variables.FullKeys){
Console.WriteLine("\t{0}:{1}",key,variables[key]);
}
}
This is the delegate called when a particular element starts
public void OnEventStarted(IStepElement Event, IReadonlyVariables variables);{
Console.WriteLine("Event {0} inside process {1} has been started with the following variables:",Event.id,Event.Process.id);
foreach (string key in variables.FullKeys){
Console.WriteLine("\t{0}:{1}",key,variables[key]);
}
}
BPMNEngine
This class is the primary class for the library. It implements a Business Process by constructing the object using a BPMN 2.0 compliant definition. This is followed by assigning delegates for handling the specific process events and then starting the process. A process can also be suspended and the suspended state loaded and resumed. It can also be cloned, including the current state and delegates in order to have more than once instance of the given process executing.
Creates a new instance of the BusinessProcess passing it the definition, StateLogLevel, runtime constants and LogLine delegate
Name | Type | Description |
---|---|---|
doc | System.Xml.XmlDocument | The Xml Document containing the BPMN 2.0 definition |
constants | System.Collections.Generic.IEnumerable{BPMNEngine.SProcessRuntimeConstant} | An array of runtime constants that are set for this particular instance of the process |
events | BPMNEngine.DelegateContainers.ProcessEvents | The Process Events delegates container |
validations | BPMNEngine.DelegateContainers.StepValidations | The Process Validations delegates container |
tasks | BPMNEngine.DelegateContainers.ProcessTasks | The Process Tasks delegates container |
logging | BPMNEngine.DelegateContainers.ProcessLogging | The Process Logging delegates container |
The XML Document that was supplied to the constructor containing the BPMN 2.0 definition
This is used to access the values of the process runtime and definition constants
The value of the variable
Name | Type | Description |
---|---|---|
name | System.String | The name of the variable |
Called to start and instance of the defined BusinessProcess
a process instance if the process was successfully started
Name | Type | Description |
---|---|---|
pars | System.Collections.Generic.Dictionary{System.String,System.Object} | The variables to start the process with |
events | BPMNEngine.DelegateContainers.ProcessEvents | The Process Events delegates container |
validations | BPMNEngine.DelegateContainers.StepValidations | The Process Validations delegates container |
tasks | BPMNEngine.DelegateContainers.ProcessTasks | The Process Tasks delegates container |
logging | BPMNEngine.DelegateContainers.ProcessLogging | The Process Logging delegates container |
stateLogLevel | Microsoft.Extensions.Logging.LogLevel | Used to set the logging level for the process state document |
Called to render a PNG image of the process
A Bitmap containing a rendered image of the process
Name | Type | Description |
---|---|---|
type | Microsoft.Maui.Graphics.ImageFormat | The output image format to generate, this being jpeg,png or bmp |
Called to Dispose of the given process instance.
This method has no parameters.
Compares a given process instance to this instance to see if they are the same.
true if they are the same, false if they are not.
Name | Type | Description |
---|---|---|
obj | System.Object | The Business Process instance to compare this one to. |
A Utility call used to extract the log from a Business Process State Document
The log from the Process State Document
Name | Type | Description |
---|---|---|
doc | System.Xml.XmlDocument | The State XML Document file to extract the values from |
A Utility call used to extract the log from a Business Process State Document
The log from the Process State Document
Name | Type | Description |
---|---|---|
reader | System.Text.Json.Utf8JsonReader | The State Json Document file to extract the values from |
A Utility call used to extract the steps from a Business Process State Document
The steps from the Process State Document
Name | Type | Description |
---|---|---|
doc | System.Xml.XmlDocument | The State XML Document file to extract the values from |
A Utility call used to extract the steps from a Business Process State Document
The steps from the Process State Document
Name | Type | Description |
---|---|---|
reader | System.Text.Json.Utf8JsonReader | The State Json Document file to extract the values from |
A Utility call used to extract the variable values from a Business Process State Document.
The variables extracted from the Process State Document
Name | Type | Description |
---|---|---|
doc | System.Xml.XmlDocument | The State XML Document file to extract the values from |
A Utility call used to extract the variable values from a Business Process State Document at a given step index.
The variables extracted from the Process State Document
Name | Type | Description |
---|---|---|
doc | System.Xml.XmlDocument | The State XML Document file to extract the values from |
stepIndex | System.Int32 | The step index to extract the values at |
A Utility call used to extract the variable values from a Business Process State Document.
The variables extracted from the Process State Document
Name | Type | Description |
---|---|---|
reader | System.Text.Json.Utf8JsonReader | The State Json Document file to extract the values from |
A Utility call used to extract the variable values from a Business Process State Document at a given step index.
The variables extracted from the Process State Document
Name | Type | Description |
---|---|---|
reader | System.Text.Json.Utf8JsonReader | The State Json Document file to extract the values from |
stepIndex | System.Int32 | The step index to extract the values at |
Returns the HashCode of the Business Process instance.
This method has no parameters.
Called to load a Process Instance from a stored State Document
an instance of IProcessInstance if successful or null it failed
Name | Type | Description |
---|---|---|
doc | System.Xml.XmlDocument | The process state document |
autoResume | System.Boolean | set true if the process was suspended and needs to resume once loaded |
events | BPMNEngine.DelegateContainers.ProcessEvents | The Process Events delegates container |
validations | BPMNEngine.DelegateContainers.StepValidations | The Process Validations delegates container |
tasks | BPMNEngine.DelegateContainers.ProcessTasks | The Process Tasks delegates container |
logging | BPMNEngine.DelegateContainers.ProcessLogging | The Process Logging delegates container |
stateLogLevel | Microsoft.Extensions.Logging.LogLevel | Used to set the logging level for the process state document |
Called to load a Process Instance from a stored State Document
an instance of IProcessInstance if successful or null it failed
Name | Type | Description |
---|---|---|
reader | System.Text.Json.Utf8JsonReader | The json based process state |
autoResume | System.Boolean | set true if the process was suspended and needs to resume once loaded |
events | BPMNEngine.DelegateContainers.ProcessEvents | The Process Events delegates container |
validations | BPMNEngine.DelegateContainers.StepValidations | The Process Validations delegates container |
tasks | BPMNEngine.DelegateContainers.ProcessTasks | The Process Tasks delegates container |
logging | BPMNEngine.DelegateContainers.ProcessLogging | The Process Logging delegates container |
stateLogLevel | Microsoft.Extensions.Logging.LogLevel | Used to set the logging level for the process state document |
BPMNEngine
This class is used to convert a date string into a datetime value, uses the similar concepts as the strtotime found in php
creates an instance
Name | Type | Description |
---|---|---|
value | System.String | the date string that is meant to be converted |
Converts the date string into an actual datetime object
A DateTime build from the string
Name | Type | Description |
---|---|---|
variables | BPMNEngine.Interfaces.Variables.IReadonlyVariables | The process variables currently avaialbe (this is used when variables exist in the string e.g. ${variablename}) |
Name | Description |
---|---|
System.Exception | Occurs when the string is determined unparsable |
BPMNEngine
This Exception is thrown when an error occurs generating a Process Diagram Image
BPMNEngine.DelegateContainers.Events
Class used to define the properties (event types) for a Process
This delegate is called when a particular element completes
public void OnEventCompleted(IStepElement Event, IReadonlyVariables variables){
Console.WriteLine("Event {0} inside process {1} has completed with the following variables:",Event.id,Event.Process.id);
foreach (string key in variables.FullKeys){
Console.WriteLine("\t{0}:{1}",key,variables[key]);
}
}
This delegate is called when a particular element has an error
public void OnEventError(IStepElement process,IStepElement Event, IReadonlyVariables variables){
Console.WriteLine("Event {0} inside process {1} had the error {2} occur with the following variables:",new object[]{Event.id,Event.Process.id,variables.Error.Message});
foreach (string key in variables.FullKeys){
Console.WriteLine("\t{0}:{1}",key,variables[key]);
}
}
This is the delegate called when a particular element starts
public void OnEventStarted(IStepElement Event, IReadonlyVariables variables);{
Console.WriteLine("Event {0} inside process {1} has been started with the following variables:",Event.id,Event.Process.id);
foreach (string key in variables.FullKeys){
Console.WriteLine("\t{0}:{1}",key,variables[key]);
}
}
BPMNEngine.DelegateContainers.Events
Class used to define all Flow Events that can complete
Called when an Association Flow completes
public void onAssociationFlowCompleted(IFlowElement flow, IReadonlyVariables variables){
Console.WriteLine("Association Flow {0} has been completed with the following variables:",flow.id);
foreach (string key in variables.FullKeys){
Console.WriteLine("\t{0}:{1}",key,variables[key]);
}
}
Called when a Message Flow completes
Called when a Sequence Flow completes
public void OnSequenceFlowCompleted(IFlowElement flow, IReadonlyVariables variables){
Console.WriteLine("Sequence Flow {0} has been completed with the following variables:",flow.id);
foreach (string key in variables.FullKeys){
Console.WriteLine("\t{0}:{1}",key,variables[key]);
}
}
BPMNEngine.Interfaces.Elements
This interface is the parent interface for ALL process elements (which are XML nodes)
The extensions element if it exists. This element is what is used in BPMN 2.0 to house additional components outside of the definition that woudl allow you to extend the definition beyond the business process diagraming and into more of a realm for building it. Such as Script and Condition elements that this library implements.
The unique ID of the element from the process
This is called to get an attribute value from the process element
Name | Type | Description |
---|---|---|
attributeName | System.String | The name of the attribute |
The child XMLNodes from the process element
BPMNEngine.Interfaces.Elements
An interface for a flow element which can be message, sequence, or in some cases association
The id for the source element
the id for the destination element
BPMNEngine.Interfaces.Tasks
This interface is used to define an externally accessible manual task
Called to mark that the manual task has been completed
This method has no parameters.
BPMNEngine.Interfaces.Elements
This interface is the interface for all process elements with children
The child elements of the given process element
BPMNEngine.Interfaces
This interface defines a running instance of a Business Process and will have its own Unique ID. It contains its own state defining the state of this instance.
The Process State of this instance
Used to get the current variable values for this process instance
The XML Document that was supplied to the constructor containing the BPMN 2.0 definition
This is used to access the values of the process runtime and definition constants
The value of the variable
Name | Type | Description |
---|---|---|
name | System.String | The name of the variable |
Called to obtain the names of all process runtime and definition constants
The log level to use inside the state document for logging
Called to render an animated version of the process (output in GIF format). This will animate each step of the process using the current state.
a binary array of data containing the animated GIF
Name | Type | Description |
---|---|---|
outputVariables | System.Boolean | Set true to output the variables into the diagram |
Called to render a PNG image of the process at its current state
A Bitmap containing a rendered image of the process at its current state
Name | Type | Description |
---|---|---|
outputVariables | System.Boolean | Set true to include outputting variables into the image |
type | Microsoft.Maui.Graphics.ImageFormat | The image format to encode the diagram in |
Used to get an Active Manual Task by supplying the task ID
The User task specified from the business process. If it cannot be found or the Task is not waiting it will return null.
Name | Type | Description |
---|---|---|
taskID | System.String | The id of the task to load |
Used to get an Active User Task by supplying the task ID
The User task specified from the business process. If it cannot be found or the Task is not waiting it will return null.
Name | Type | Description |
---|---|---|
taskID | System.String | The id of the task to load |
Called to Resume a suspended process. Will fail if the process is not currently suspended.
This method has no parameters.
Called to suspend this instance
This method has no parameters.
Used to lock a Thread into waiting for the process to complete
the result of calling WaitOne on the Process Complete manual reset event
This method has no parameters.
Used to lock a Thread into waiting for the process to complete including a timeout
the result of calling WaitOne(millisecondsTimeout) on the Process Complete manual reset event
Name | Type | Description |
---|---|---|
millisecondsTimeout | System.Int32 | The timeout for the process to complete |
Used to lock a Thread into waiting for the process to complete including a timeout
the result of calling WaitOne(timeout) on the Process Complete manual reset event
Name | Type | Description |
---|---|---|
timeout | System.TimeSpan | The timeout for the process to complete |
Used to lock a Thread into waiting for a Manual task to be ready
the result of calling WaitOne on the Manual Task manual reset event
Name | Type | Description |
---|---|---|
taskID | System.String | The id of the task to wait for |
task | BPMNEngine.Interfaces.Tasks.IManualTask@ | The Manual task specified if the task was successfully started |
Used to lock a Thread into waiting for a Manual task to be ready
the result of calling WaitOne(millisecondsTimeout) on the Manual Task manual reset event
Name | Type | Description |
---|---|---|
millisecondsTimeout | System.Int32 | The timeout for the Manual task to start |
taskID | System.String | The id of the task to wait for |
task | BPMNEngine.Interfaces.Tasks.IManualTask@ | The Manual task specified if the task was successfully started |
Used to lock a Thread into waiting for a Manual task to be ready
the result of calling WaitOne(timeout) on the Manual Task manual reset event
Name | Type | Description |
---|---|---|
timeout | System.TimeSpan | The timeout for the Manual task to start |
taskID | System.String | The id of the task to wait for |
task | BPMNEngine.Interfaces.Tasks.IManualTask@ | The Manual task specified if the task was successfully started |
Used to lock a Thread into waiting for a user task to be ready
the result of calling WaitOne on the User Task manual reset event
Name | Type | Description |
---|---|---|
taskID | System.String | The id of the task to wait for |
task | BPMNEngine.Interfaces.Tasks.IUserTask@ | The User task specified if the task was successfully started |
Used to lock a Thread into waiting for a user task to be ready
the result of calling WaitOne(millisecondsTimeout) on the User Task manual reset event
Name | Type | Description |
---|---|---|
millisecondsTimeout | System.Int32 | The timeout for the user task to start |
taskID | System.String | The id of the task to wait for |
task | BPMNEngine.Interfaces.Tasks.IUserTask@ | The User task specified if the task was successfully started |
Used to lock a Thread into waiting for a user task to be ready
the result of calling WaitOne(timeout) on the User Task manual reset event
Name | Type | Description |
---|---|---|
timeout | System.TimeSpan | The timeout for the user task to start |
taskID | System.String | The id of the task to wait for |
task | BPMNEngine.Interfaces.Tasks.IUserTask@ | The User task specified if the task was successfully started |
BPMNEngine.Interfaces.Variables
This interface defines a Read Only version of the process variables container. These are using in event delegates as the process variables cannot be changed by events.
The error that occured, assuming this was passed to an error event delgate this will have a value
BPMNEngine.Interfaces.Elements
This interface is the extended interface for a sequence flow to provide additional properties that are beyond an IElement
The Condition Expression that was attached to the sequence flow, this may be an attribute or a sub element
BPMNEngine.Interfaces.State
Houses the current state of a process, this will have current variables (including the Keys to know all variables contained) as well as the ability to output a string version (XML/JSON) of the state
Called to obtain a list of all elements that are active (Started or Waiting)
Called to convert the state into a loadable json document
Called to convert the state into a loadable xml document
Called to get the value of a process variable
The value of the variable or null if not found
Name | Type | Description |
---|---|---|
name | System.String | The name of the process variable |
Called to get a list of all process variable names available
Called to obtain a copy of the current log content found within the state
Called to obtain a readonly list of the step state information
Called to obtain a readonly dictionary of the current variables in the state
BPMNEngine.Interfaces.State
Houses the step information from a state to indicate statuses and timestamps for given elements during the execution of the procesas
When a user task is completed and the CompletedBy is set, it is housed here
The ID of the element for this step
When the element is completed this will had a value or used to house the suspension timestamp
The ID of the element that led to this step
The list of outgoing elements to be executed next from the completion of this element
The timestamp for the start of the step
The status at the point of logging
BPMNEngine.Interfaces.Elements
This interface implements Step Elements in a process. These are elements that are containg both within a Process and a Lane and have properties to access those objects.
The Lane within the process containing this element
The process containing this element
The SubProcess containing this element, if the element is within a subprocess
BPMNEngine.Interfaces.Tasks
This interface is used to define an externall accessible task that can have extension items to allow for processing beyond the basic BPMN notation.
All emissions from this Task if caught by a brounday event that is flagged to cancelActivity will cause this task to abort and no longer be usable.
In doing so it will not submit the variable changes into the process.
The variables container for this task which allows you to both obtain and modify process variables.
Called to log a debug level message
Name | Type | Description |
---|---|---|
message | System.String | The string message |
Called to log a debug level message
Name | Type | Description |
---|---|---|
message | System.String | The string formatted message |
pars | System.Object[] | The arguments to be fed into a string format call agains the message |
Called to issue an exception fromn the task (this should be caught somewhere within the process by an Exception Recieving Element with a matching exception definition)
Name | Type | Description |
---|---|---|
error | System.Exception | |
isAborted | System.Boolean@ | returns true if emitting this signal causes the task to abort |
Called to issue a message from the task (this should be caught somewhere within the process by a Message Recieving Element with a matching message defined)
Name | Type | Description |
---|---|---|
message | System.String | The message to emit into the process |
isAborted | System.Boolean@ | returns true if emitting this signal causes the task to abort |
Called to log an error level message
Name | Type | Description |
---|---|---|
message | System.String | The string message |
Called to log an error level message
Name | Type | Description |
---|---|---|
message | System.String | The string formatted message |
pars | System.Object[] | The arguments to be fed into a string format call agains the message |
Called to issue an escalation from the task (this should be caught somewhere within the process by an Escalation Reciving Element)
Name | Type | Description |
---|---|---|
isAborted | System.Boolean@ | returns true if emitting this signal causes the task to abort |
Called to log an exception
The exception that was passed as an arguement to allow for throwing
Name | Type | Description |
---|---|---|
exception | System.Exception | The Exception that occured |
Called to log a fatal level message
Name | Type | Description |
---|---|---|
message | System.String | The string message |
Called to log a fatal level message
Name | Type | Description |
---|---|---|
message | System.String | The string formatted message |
pars | System.Object[] | The arguments to be fed into a string format call agains the message |
Called to log an info level message
Name | Type | Description |
---|---|---|
message | System.String | The string message |
Called to log an info level message
Name | Type | Description |
---|---|---|
message | System.String | The string formatted message |
pars | System.Object[] | The arguments to be fed into a string format call agains the message |
Called to issue a signal from the task (this should be caught somewhere within the process by a Signal Recieving Element with a matching signal defined)
Name | Type | Description |
---|---|---|
signal | System.String | The signal to emit into the process |
isAborted | System.Boolean@ | returns true if emitting this signal causes the task to abort |
BPMNEngine.Interfaces.Tasks
This interface is used to define an externally accessible User Task.
The User ID of the user that completed the task. This should be set before calling MarkComplete() if there is a desire to log the user id of the individual completing the task.
BPMNEngine.Interfaces.Variables
This interface defines a container to house the process variables and allows for editing of those variables.
Called to get or set the value of a process variable
The value of the process variable or null if not found
Name | Type | Description |
---|---|---|
name | System.String | The name of the process variable |
BPMNEngine.Interfaces.Variables
This interface defines the base container to house the process variables
Called to get a list of all process variable names available, including process definition constants and runtime constants
Called to get the value of a process variable
The value of the variable or null if not found
Name | Type | Description |
---|---|---|
name | System.String | The name of the process variable |
Called to get a list of all process variable names available
BPMNEngine
This Exception is thrown by an Intermediate Throw Event when an Error Message is defined
Houses the error message string defined inside the ErrorMessage definition from within the process document
BPMNEngine
This Exception is thrown when an attribute value is not valid on an Element found within the definition
BPMNEngine
This Exception is thrown when an Element found within the definition is not valid
BPMNEngine
This Exception gets thrown on the loading of a Process Definition inside a BusinessProcess class when the definition is found to be invalid.
The Exception(s) thrown during the validation process.
BPMNEngine
This delegate is implemented to get triggered when determining if an Event Start is valid (i.e. can this event start)
Name | Type | Description |
---|---|---|
Event | T:BPMNEngine.IsEventStartValid | The Start Event that is being checked |
XML: <bpmn:startEvent id="StartEvent_0ikjhwl"> bpmn:extensionElements </bpmn:extensionElements> bpmn:outgoingSequenceFlow_1kh3jxa</bpmn:outgoing> </bpmn:startEvent>
public bool _EventStartValid(IStepElement Event, IVariables variables){
if (Event.ExtensionElement != null){
foreach (XmlNode xn in Event.ExtensionElement.SubNodes){
if (xn.NodeType == XmlNodeType.Element)
{
if (xn.Name=="DateRange"){
return DateTime.Now.Ticks >= DateTime.Parse(xn.Attributes["start"].Value) && DateTime.Now.Ticks <= DateTime.Parse(xn.Attributes["end"].Value);
}
}
}
}
return true;
}
This delegate is useful when adding additional elements through the extension element that are custom to your code. It will be called with the given starting element that can be checked against additional components to decide if the start event is valid for a process. If valid, return true to initiate the containing process.
BPMNEngine
This delegate is implemented to get triggered when determining if a Flow is a valid path
Name | Type | Description |
---|---|---|
flow | T:BPMNEngine.IsFlowValid | The process Flow that is being checked |
XML: bpmn:outgoingSequenceFlow_1jma3bu bpmn:extensionElements </bpmn:extensionElements> </bpmn:outgoing>
public bool _FlowValid(ISequenceFlow flow, IVariables variables){
if (flow.ExtensionElement != null){
foreach (XmlNode xn in flow.ExtensionElement.SubNodes){
if (xn.NodeType == XmlNodeType.Element)
{
if (xn.Name=="DateRange"){
return DateTime.Now.Ticks >= DateTime.Parse(xn.Attributes["start"].Value) && DateTime.Now.Ticks <= DateTime.Parse(xn.Attributes["end"].Value);
}
}
}
}
return true;
}
This delegate is useful when adding additional elements through the extension element that are custom to your code.It will be called with the given flow element that can be checked against additional components to decide if the flow is a valid next step in the process. If valid, return true to allow the system to continue along the supplied flow.
BPMNEngine
This delegate is implemented to get triggered when determining if a Process is valid to Start
Name | Type | Description |
---|---|---|
process | T:BPMNEngine.IsProcessStartValid | The Process that is being checked |
XML: <bpmn:process id="Process_1" isExecutable="false"> ... bpmn:extensionElements </bpmn:extensionElements> </bpmn:process>
public bool _ProcessStartValid(IElement process, IVariables variables){
if (process.ExtensionElement != null){
foreach (XmlNode xn in process.ExtensionElement.SubNodes){
if (xn.NodeType == XmlNodeType.Element)
{
if (xn.Name=="DateRange"){
return DateTime.Now.Ticks >= DateTime.Parse(xn.Attributes["start"].Value) && DateTime.Now.Ticks <= DateTime.Parse(xn.Attributes["end"].Value);
}
}
}
}
return true;
}
This delegate is useful when adding additional elements through the extension element that are custom to your code.It will be called with the given process element that can be checked against additional components to decide if the start is valid for a process. If valid, return true to allow the system to continue to locate a valid start event within that process.
BPMNEngine
Thrown when attempting to use Javascript without the Jint Assembly
Thrown when attempting to use Javascript without the Jint Assembly
This constructor has no parameters.
BPMNEngine
This delegate is implemented to be called when a Log Exception is made by a process. This can be used to log exceptions externally, to a file, database, or logging engine implemented outside of the library.
Name | Type | Description |
---|---|---|
callingElement | T:BPMNEngine.LogException | The Process Element Calling the Log Exception (may be null) |
BPMNEngine
This delegate is implemented to be called when a Log Line Entry is made by a process. This can be used to log items externally, to a file, database, or logging engine implemented outside of the library.
Name | Type | Description |
---|---|---|
callingElement | T:BPMNEngine.LogLine | The Process Element Calling the Log Line (may be null) |
BPMNEngine
This Exception is thrown when a required attribute is missing from an Element found within the definition
BPMNEngine
This Exception is thrown when an Exclusive Gateway evalutes to more than 1 outgoing path
BPMNEngine
This Exception is thrown when a Business Process is told to Resume but is not Suspended
BPMNEngine
This delegate is implemented to get triggered when a process element has been aborted.
Name | Type | Description |
---|---|---|
element | T:BPMNEngine.OnElementAborted | The process element that is being aborted. |
public void _OnElementAborted(IElement element,IElement source,IReadonlyVariables variables){
Console.WriteLine("Element {0} inside process {1} has been aborted by {2} with the following variables:",element.id,element.Process.id,source.id);
foreach (string key in variables.FullKeys){
Console.WriteLine("\t{0}:{1}",key,variables[key]);
}
}
As it is an event driven delegate, the process will continue on without waiting for the delegate to finish.
BPMNEngine
This delegate is implemented to get triggered when a process element has been started, completed or errored.
Name | Type | Description |
---|---|---|
element | T:BPMNEngine.OnElementEvent | The process element that is starting, has completed or has errored. |
public void _OnElementStarted(IStepElement element,IReadonlyVariables variables){
Console.WriteLine("Element {0} inside process {1} has been started with the following variables:",element.id,element.Process.id);
foreach (string key in variables.FullKeys){
Console.WriteLine("\t{0}:{1}",key,variables[key]);
}
}
As it is an event driven delegate, the process will continue on without waiting for the delegate to finish.
BPMNEngine
This delegate is implemented to get triggered when a process flow has been completed.
Name | Type | Description |
---|---|---|
element | T:BPMNEngine.OnFlowComplete | The process flow that has been completed. |
public void _OnFlowCompleted(IElement element,IReadonlyVariables variables){
Console.WriteLine("Flow {0} inside process {1} has been started with the following variables:",element.id,element.Process.id);
foreach (string key in variables.FullKeys){
Console.WriteLine("\t{0}:{1}",key,variables[key]);
}
}
As it is an event driven delegate, the process will continue on without waiting for the delegate to finish.
BPMNEngine
This delegate is implemented to get triggered when a Process has an Error
Name | Type | Description |
---|---|---|
process | T:BPMNEngine.OnProcessErrorEvent | The process that the error is contained in |
public void _ProcessError(IElement process,IElement sourceElement, IReadonlyVariables variables){
Console.WriteLine("Element {0} inside process {1} had the error {2} occur with the following variables:",new object[]{sourceElement.id,process.id,variables.Error.Message});
foreach (string key in variables.FullKeys){
Console.WriteLine("\t{0}:{1}",key,variables[key]);
}
}
As it is an event driven delegate, the process will continue on without waiting for the delegate to finish. As well as the variables container will have Error set to the Exception that occured.
BPMNEngine
This delegate is implemented to get triggered when a Process has been started or completed.
Name | Type | Description |
---|---|---|
process | T:BPMNEngine.OnProcessEvent | The Process being started or completed |
public void _ProcessStarted(IElement process,IReadonlyVariables variables){
Console.WriteLine("Process {0} has been started with the following variables:",process.id);
foreach (string key in variables.FullKeys){
Console.WriteLine("\t{0}:{1}",key,variables[key]);
}
}
As it is an event driven delegate, the process will continue on without waiting for the delegate to finish.
BPMNEngine
This delegate is implemented to get triggered when the Process State changes. The state may not be usable externally without understanding its structure, however, capturing these events allows for the storage of a process state externally to be brought back in on a process restart.
Name | Type | Description |
---|---|---|
currentState | T:BPMNEngine.OnStateChange | The current state of the process |
public void _StateChange(XmlDocument stateDocument){
Console.WriteLine("Current Process State: \n{0}",stateDocument.OuterXML);
}
BPMNEngine.DelegateContainers
This class is used to house all the event based delegates for a business process. This can be defined at either the BusinessProcess constructor level for defining it against all instances or at the BeginProcess level to defining it against a specific instance
Houses the delegates for Events related to a Business Process Event item
Houses the delegates for Events related to a Business Process flow item
Houses the delegates for Events related to a Business Process Gateway item
A delegate called when the Business Process Instance state document has changed
public void OnStateChange(XmlDocument stateDocument){
Console.WriteLine("Current Process State: \n{0}",stateDocument.OuterXML);
}
A delegate called when an element is aborted within the Business Process
public void OnStepAborted(IElement element, IElement source, IReadonlyVariables variables){
Console.WriteLine("Element {0} inside process {1} has been aborted by {2} with the following variables:",element.id,element.Process.id,source.id);
foreach (string key in variables.FullKeys){
Console.WriteLine("\t{0}:{1}",key,variables[key]);
}
}
Houses the delegates for Events related to a Business Process Process item
Houses the delegates for Events related to a Business Process SubProcess item
Houses the delegates for Events related to a Business Process Task item
BPMNEngine.DelegateContainers
This class is used to house all the Logging delegates for a business process. This can be defined at either the BusinessProcess constructor level for defining it against all instances or at the BeginProcess level to defining it against a specific instance
A delegate called to append a logged exception from the process
A delegate called to append a log line entry from the process
BPMNEngine
This delegate is implemented to process a Process Task (This can be a Business Rule, Script, Send, Service and Task)
Name | Type | Description |
---|---|---|
task | T:BPMNEngine.ProcessTask | The Task being processed |
XML: <bpmn:businessRuleTask id="BusinessRule_0ikjhwl"> bpmn:extensionElements </bpmn:extensionElements> bpmn:outgoingSequenceFlow_1kh3jxa</bpmn:outgoing> </bpmn:startEvent>
public void _ProcessBusinessRuleTask(ITask task)
if (task.ExtensionElement != null){
foreach (XmlNode xn in task.ExtensionElement.SubNodes){
if (xn.NodeType == XmlNodeType.Element)
{
if (xn.Name=="Analysis"){
switch(xn.Attributes["formula"].Value){
case "Average":
decimal avgSum=0;
decimal avgCount=0;
foreach (Hashtable item in task.Variables["Items"]){
if (item.ContainsKey(xn.Attributes["inputs"].Value)){
avgSum+=(decimal)item[xn.Attributes["inputs"].Value];
avgCount++;
}
}
task.Variables[xn.Attriubtes["outputVariable"].Value] = avgSum/avgCount;
break;
case "Sum":
decimal sum=0;
foreach (Hashtable item in task.Variables["Items"]){
if (item.ContainsKey(xn.Attributes["inputs"].Value)){
sum+=(decimal)item[xn.Attributes["inputs"].Value];
}
}
task.Variables[xn.Attriubtes["outputVariable"].Value] = sum;
break;
}
}
}
}
}
}
Use of the bpmn:extension element to add additional components to the Task is recommended in order to implement your own piece of functionality used in handling of a Task.
BPMNEngine.DelegateContainers
This class is used to house all the Tasks delegates for a business process. This can be defined at either the BusinessProcess constructor level for defining it against all instances or at the BeginProcess level to defining it against a specific instance
A delegate called to start a Manual Task
<![CDATA[
XML:
<bpmn:manualTask id="ManualTask_0ikjhwl">
<bpmn:extensionElements>
<Question prompt="What is the answer to the life, universe and everything" answer_property="answer"/>
</bpmn:extensionElements>
<bpmn:outgoing>SequenceFlow_1kh3jxa</bpmn:outgoing>
</bpmn:startEvent>
]]>
A delegate called to start a User Task
<![CDATA[
XML:
<bpmn:userTask id="UserTask_0ikjhwl">
<bpmn:extensionElements>
<Question prompt="What is the answer to the life, universe and everything" answer_property="answer"/>
</bpmn:extensionElements>
<bpmn:outgoing>SequenceFlow_1kh3jxa</bpmn:outgoing>
</bpmn:startEvent>
]]>
A delegate called to execute a CallActivity
A delegate called to execute a Business Rule Task
<![CDATA[
XML:
<bpmn:businessRuleTask id="BusinessRule_0ikjhwl">
<bpmn:extensionElements>
<Analysis outputVariable="averageCost" inputs="Cost" formula="Average"/>
<Analysis outputVariable="totalQuantity" inputs="Quantity" formula="Sum"/>
</bpmn:extensionElements>
<bpmn:outgoing>SequenceFlow_1kh3jxa</bpmn:outgoing>
</bpmn:startEvent>
]]>
A delegate called to execute a Receive Task
A delegate called to execute a Script Task. This is called after any internal script extension elements have been processed.
A delegate called to exeucte a Send Task.
A delegate called to execute a Service Task
A delegate called to execute a Task
BPMNEngine
This structure is used to house a File associated within a process instance. It is used to both store, encode, decode and retreive File variables inside the process state.
The binary content of the File.
The content type tag for the File. e.g. text/html
The extension of the File.
The name of the File.
Compares the object to this
true if obj is an sFile and is equal
Name | Type | Description |
---|---|---|
obj | System.Object | the object to compare |
Compares left and right files
true if are equal
Name | Type | Description |
---|---|---|
left | BPMNEngine.SFile | left file for comparison |
right | BPMNEngine.SFile | right file for comparison |
Compares left and right files
true if are not equal
Name | Type | Description |
---|---|---|
left | BPMNEngine.SFile | left file for comparison |
right | BPMNEngine.SFile | right file for comparison |
BPMNEngine
This structure is used to specify a Process Runtime Constant. These Constants are used as a Dynamic Constant, so a read only variable within the process that can be unique to the instance running, only a constant to that specific process instance.
The Name of the variable.
The Value of the variable.
BPMNEngine
This delegate is implemented to start a Manual Task
Name | Type | Description |
---|---|---|
task | T:BPMNEngine.StartManualTask | The Task being started |
XML: <bpmn:manualTask id="ManualTask_0ikjhwl"> bpmn:extensionElements </bpmn:extensionElements> bpmn:outgoingSequenceFlow_1kh3jxa</bpmn:outgoing> </bpmn:startEvent>
public void _ProcessManualTask(IManualTask task)
if (task.ExtensionElement != null){
foreach (XmlNode xn in task.ExtensionElement.SubNodes){
if (xn.NodeType == XmlNodeType.Element)
{
if (xn.Name=="Question"){
Console.WriteLine(string.format("{0}?",xn.Attributes["prompt"].Value));
task.Variables[xn.Attributes["answer_property"].Value] = Console.ReadLine();
}
}
}
}
task.MarkComplete();
}
Use of the bpmn:extension element to add additional components to the Task is recommended in order to implement your own piece of functionality used in handling of a Task.
BPMNEngine
This delegate is implemented to start a User Task
Name | Type | Description |
---|---|---|
task | T:BPMNEngine.StartUserTask | The Task being started |
XML: <bpmn:userTask id="UserTask_0ikjhwl"> bpmn:extensionElements </bpmn:extensionElements> bpmn:outgoingSequenceFlow_1kh3jxa</bpmn:outgoing> </bpmn:startEvent>
public void _ProcessUserTask(IUserTask task)
if (task.ExtensionElement != null){
foreach (XmlNode xn in task.ExtensionElement.SubNodes){
if (xn.NodeType == XmlNodeType.Element)
{
if (xn.Name=="Question"){
Console.WriteLine(string.format("{0}?",xn.Attributes["prompt"].Value));
task.Variables[xn.Attributes["answer_property"].Value] = Console.ReadLine();
Console.WriteLine("Who Are You?");
task.UserID = Console.ReadLine();
}
}
}
}
task.MarkComplete();
}
Use of the bpmn:extension element to add additional components to the Task is recommended in order to implement your own piece of functionality used in handling of a Task.
BPMNEngine
Enumeration of the statuses used for each step of a process
Aborted after being started or Suspended or Waiting on Start
Failed during execution
Step not run (typically used for drawing only and not stored in the state)
Started the satep
Completed successfully
Suspended until a timeout has passed
Waiting for input to complete execution
Delayed start until a timeout has passed
BPMNEngine.DelegateContainers
This class is used to house all the validation delegates for a business process. This can be defined at either the BusinessProcess constructor level for defining it against all instances or at the BeginProcess level to defining it against a specific instance
A delegate called to validate if an event can start
<![CDATA[
XML:
<bpmn:startEvent id="StartEvent_0ikjhwl">
<bpmn:extensionElements>
<DateRange start="2020-01-01 00:00:00" end="2020-12-31 11:59:59"/>
</bpmn:extensionElements>
<bpmn:outgoing>SequenceFlow_1kh3jxa</bpmn:outgoing>
</bpmn:startEvent>
]]>
A delegate called to validate if a flow is valid to run
<![CDATA[
XML:
<bpmn:outgoing>SequenceFlow_1jma3bu
<bpmn:extensionElements>
<DateRange start="2020-01-01 00:00:00" end="2020-12-31 11:59:59"/>
</bpmn:extensionElements>
</bpmn:outgoing>
]]>
A delegate called to validate if a process is valid to start
<![CDATA[
XML:
<bpmn:process id="Process_1" isExecutable="false">
...
<bpmn:extensionElements>
<DateRange start="2020-01-01 00:00:00" end="2020-12-31 11:59:59"/>
</bpmn:extensionElements>
</bpmn:process>
]]>