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 for BPMN modelers for modeling triggers that represent simple start events in the BPMN model. Can be used as a base for implementing the getBpmnModeler method of a trigger 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 overriding createEventDefinition.

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 overriding createDetails.

Optionally, implementations can override createStartEventPostProcessor. This allows you to enrich the start event with additional details, such as adding a precondition 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
  • Constructor Details

    • AStartEventBpmnModeler

      public AStartEventBpmnModeler()
  • Method Details

    • modelTrigger

      public final void modelTrigger(IModelWorkflowTriggerParams<Model> params, IWorkflowBpmnModelContext context)
      Description copied from interface: IWorkflowTriggerBpmnModeler
      Models a WorkflowTrigger in the BPMN diagram. This method is called once for the trigger of each WorkflowTask 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 a IStructuredBpmnModelPart for the trigger, see the class-level documentation of IStructuredBpmnModelPart 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 the layouter. This tree then gets resolved to a flat map. Finally, the various method on IFlattenedAlignmentItemMap can be used to create the BPMN shapes, BPMN edges and sequence flows.

      Specified by:
      modelTrigger in interface IWorkflowTriggerBpmnModeler<Model>
      Parameters:
      params - The parameters for the modeler, containing the WorkflowTrigger 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 the layouter() or colorizer, and also provides access to all global data such as all triggers and nodes 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 the text 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 the boundMessageLocalizer obtained from the context.
      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 the event 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 the boundMessageLocalizer obtained from the context.
      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 the name of the start 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, see createDetails.

      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
      This naming approach does not always work perfectly. In those cases, precisely describe the business semantics when the process is about to leave the event. The following names are also valid:
      • 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 the boundMessageLocalizer obtained from the context.
      Returns:
      The name of the service task in the BPMN model.
    • createStartEventLayoutPostProcessor

      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 additional precondition 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.