Class AStartEventBpmnModeler<Model>
- java.lang.Object
-
- de.xima.fc.workflow.bpmn.AStartEventBpmnModeler<Model>
-
- Type Parameters:
Model
- Type of the trigger's custom parameters model.
- All Implemented Interfaces:
IWorkflowTriggerBpmnModeler<Model>
- Direct Known Subclasses:
AMessageStartEventBpmnModeler
,ATimerStartEventBpmnModeler
public abstract class AStartEventBpmnModeler<Model> extends Object implements IWorkflowTriggerBpmnModeler<Model>
Base class forBPMN modelers
for modelingtriggers
that represent simplestart events
in the BPMN model. Can be used as a base for implementing thegetBpmnModeler
method of atrigger handler
interface.This modeler creates a
start event
in the BPMN model, visualized as a circle.At minimum, implementations must provide the name of the service by overriding
createName
; and the type of event by overridingcreateEventDefinition
.The name should be a static, short, and concise description of the type of action, details about the action can be added as a
text annotation
by overridingcreateDetails
.Optionally, implementations can override
createStartEventPostProcessor
. This allows you to enrich the start event with additional details, such as adding aprecondition
etc.This abstract class uses the template method pattern. All non-final methods are either abstract or only have a default implementation, and can be overridden by subclasses independent of other methods to customize the behavior of the modeler.
- Since:
- 8.4.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
AStartEventBpmnModeler.IStatefulStartEventPostProcessor
A post-processor for the start event layout, seecreateStartEventLayoutPostProcessor
.
-
Constructor Summary
Constructors Constructor Description AStartEventBpmnModeler()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected String
createDetails(IModelWorkflowTriggerParams<Model> params, IWorkflowBpmnModelContext context, IBoundMessageLocalizer localizer)
Creates additional details regarding the configuration of the start event.protected abstract List<? extends de.xima.bpmn_model.api.element.bpmn.events.EventDefinition<?>>
createEventDefinition(IModelWorkflowTriggerParams<Model> params, IWorkflowBpmnModelContext context, IBoundMessageLocalizer localizer)
Creates theevent definitions
for the start event in the BPMN model.protected abstract String
createName(IModelWorkflowTriggerParams<Model> params, IWorkflowBpmnModelContext context, IBoundMessageLocalizer localizer)
Creates the name of the start event in the BPMN model.protected AStartEventBpmnModeler.IStatefulStartEventPostProcessor
createStartEventLayoutPostProcessor(IModelWorkflowTriggerParams<Model> params, IWorkflowBpmnModelContext context)
Creates a post-processor for the start event layout.void
modelTrigger(IModelWorkflowTriggerParams<Model> params, IWorkflowBpmnModelContext context)
Models aWorkflowTrigger
in the BPMN diagram.
-
-
-
Method Detail
-
modelTrigger
public final void modelTrigger(IModelWorkflowTriggerParams<Model> params, IWorkflowBpmnModelContext context)
Description copied from interface:IWorkflowTriggerBpmnModeler
Models aWorkflowTrigger
in the BPMN diagram. This method is called once for thetrigger
of eachWorkflowTask
in the workflow.The responsibility of each modeler is to access the provided
params.partBuilder()
and add the appropriate data to that builder. That data then gets used to create aIStructuredBpmnModelPart
for thetrigger
, see the class-level documentation ofIStructuredBpmnModelPart
for more info.When modelling a workflow trigger as BPMN, the usual approach is to create a nested tree of
alignment items
, making use of thelayouter
. This tree then getsresolved
to a flat map. Finally, the various method onIFlattenedAlignmentItemMap
can be used to create theBPMN shapes
,BPMN edges
andsequence flows
.- Specified by:
modelTrigger
in interfaceIWorkflowTriggerBpmnModeler<Model>
- Parameters:
params
- The parameters for the modeler, containing theWorkflowTrigger
to model and its deserialized custom properties model, as well as the part builder to fill with data.context
- The context for creating the BPMN diagram, its lifecycle starts when the conversion (of the workflow to a BPMN diagram) starts and ends when the conversion ends. The context lets you access various helper methods such as thelayouter()
orcolorizer
, and also provides access to all global data such as alltriggers
andnodes
in the workflow.
-
createDetails
protected String createDetails(IModelWorkflowTriggerParams<Model> params, IWorkflowBpmnModelContext context, IBoundMessageLocalizer localizer)
Creates additional details regarding the configuration of the start event. These details are included in thetext annotation
of the start event, usually placed above the rectangle that represents the task in the BPMN diagram.- Parameters:
params
- The parameters with the trigger to model, as provided by the workflow engine.context
- The BPMN model context, as provided by the workflow engine.localizer
- The localizer to use for localizing the name. This is the same as theboundMessageLocalizer
obtained from thecontext
.- Returns:
- The details of the start event in the BPMN model.
-
createEventDefinition
protected abstract List<? extends de.xima.bpmn_model.api.element.bpmn.events.EventDefinition<?>> createEventDefinition(IModelWorkflowTriggerParams<Model> params, IWorkflowBpmnModelContext context, IBoundMessageLocalizer localizer)
Creates theevent definitions
for the start event in the BPMN model. This is usually only a single event definition. If multiple definitions are returned, the BPMN standard considers this a Multiple event. If no definitions are returned, the BPMN standard considers this as a None event.- Parameters:
params
- The parameters with the trigger to model, as provided by the workflow engine.context
- The BPMN model context, as provided by the workflow engine.localizer
- The localizer to use for localizing the name. This is the same as theboundMessageLocalizer
obtained from thecontext
.- Returns:
- A list of event definitions for the start event in the BPMN model.
-
createName
protected abstract String createName(IModelWorkflowTriggerParams<Model> params, IWorkflowBpmnModelContext context, IBoundMessageLocalizer localizer)
Creates the name of the start event in the BPMN model. This is thename
of thestart event
, usually placed below the circle that represents the start event in the BPMN diagram.The circle always has a defined diameter, independent of the name's length, so the name should be short and concise. If the name is too long, it may be truncated in the BPMN diagram. As a best practice, try not to include any user-configurable details in the name, simply use a static name that describes the type of event. Details about the event should be included in the event's
annotation
, seecreateDetails
.By convention, name an event using an object and a verb reflecting a state. Always try to describe which state an object is in when the process is about to leave the event, e.g.:
- Draft reviewed
- Invoice checked
- Job announced
- Draft to be reviewed
- 15 minutes
- Job announcement ready to be published
- Parameters:
params
- The parameters with the trigger to model, as provided by the workflow engine.context
- The BPMN model context, as provided by the workflow engine.localizer
- The localizer to use for localizing the name. This is the same as theboundMessageLocalizer
obtained from thecontext
.- Returns:
- The name of the service task in the BPMN model.
-
createStartEventLayoutPostProcessor
protected AStartEventBpmnModeler.IStatefulStartEventPostProcessor createStartEventLayoutPostProcessor(IModelWorkflowTriggerParams<Model> params, IWorkflowBpmnModelContext context)
Creates a post-processor for the start event layout. This allows you to enrich the start event with additional data and BPMN elements, such as adding an additionalprecondition
for the start event. The default implementation returns a no-op post-processor that does enrich the task in any way.Usually you should create a new instance for each call to this method. This instance does not need to be thread-safe and is used only for the duration of a single
modeling operation
. The instance may store state that is accessed by its various methods.- Parameters:
params
- The parameters with the trigger to model, as provided by the workflow engine.context
- The BPMN model context, as provided by the workflow engine.- Returns:
- A post-processor for the start event layout, never
null
. The default implementation returns a no-op processor that does not enrich the start event in any way.
-
-