Class AServiceTaskBpmnModeler<Model>

java.lang.Object
de.xima.fc.workflow.bpmn.AServiceTaskBpmnModeler<Model>
Type Parameters:
Model - Type of the node's custom parameters model.
All Implemented Interfaces:
IWorkflowNodeBpmnModeler<Model>
Direct Known Subclasses:
FcChangeFormAvailabilityBpmnModeler, FcChangeFormRecordChatActivenessBpmnModeler, FcChangeFormValueBpmnModeler, FcChangeStateBpmnModeler, FcCompressAsZipBpmnModeler, FcCopyFormRecordBpmnModeler, FcCounterBpmnModeler, FcCreateTextFileBpmnModeler, FcDecodeBase64BpmnModeler, FcDeleteAttachmentBpmnModeler, FcDeleteFormRecordBpmnModeler, FcDoiInitBpmnModeler, FcEmailBpmnModeler, FcEncodeBase64BpmnModeler, FcExportFormRecordChatsBpmnModeler, FcExportToPersistenceBpmnModeler, FcExportToXmlBpmnModeler, FcFillPdfBpmnModeler, FcFillWordBpmnModeler, FcHttpRequestBpmnModeler, FcImportFormValueFromXmlBpmnModeler, FcLdapQueryBpmnModeler, FcLogEntryBpmnModeler, FcMoveFormRecordToInboxBpmnModeler, FcProcessLogPdfBpmnModeler, FcPromptQueryBpmnModeler, FcProvideResourceBpmnModeler, FcQueueTaskBpmnModeler, FcRedirectBpmnModeler, FcRenewProcessIdBpmnModeler, FcReturnFileBpmnModeler, FcSaveToFileSystemBpmnModeler, FcSaveToWebDavBpmnModeler, FcSendFormRecordMessageBpmnModeler, FcSetSavedFlagBpmnModeler, FcShowTemplateBpmnModeler, FcSqlStatementBpmnModeler, FcWriteFormRecordAttrBpmnModeler, SetFormRecordPasswordBpmnModeler

public abstract class AServiceTaskBpmnModeler<Model> extends Object implements IWorkflowNodeBpmnModeler<Model>
Base class for BPMN modelers for modeling nodes that represent simple service tasks in the BPMN model, usually business logic actions. Can be used as a base for implementing the getBpmnModeler method of a node handler interface.

This modeler creates a service task in the BPMN model, visualized as a rectangle with a gear icon. If the node can return, also adds an EndEvent after the service task, and connects the service task with the end event via a flow.

At minimum, implementations must provide the name of the service by overriding createName. 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 createTaskLayoutPostProcessor. This allows you to enrich the service task with additional details, such as adding data objects that represent the input or output of the service task.

Nodes that wish to use this modeler must fulfill the following requirements:

  • The node must not have any children.
  • The node must not issue any control transfer statements.
  • The node must complete in some fashion, either normally, by throwing an error, or by returning.
  • If the node can return, it must always return unconditionally upon completion and must never complete normally. These are end point actions such as a change state action that changes the state of a form record, then stops the processing chain.
  • The node must be able to complete either normally or by returning. The node may throw as part of the business logic, but nodes that only throw and never complete normally or return are not supported. These should probably be modeled as a BPMN error end event, not as a service task.

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

    • AServiceTaskBpmnModeler

      public AServiceTaskBpmnModeler()
  • Method Details

    • modelNode

      public final void modelNode(IModelWorkflowNodeParams<Model> params, IWorkflowBpmnModelContext context)
      Description copied from interface: IWorkflowNodeBpmnModeler
      Models a WorkflowNode in the BPMN diagram. This method is called once for the root node of each WorkflowTask in the workflow. Implementations for nodes that have children should call context.modelNode(node) on their child nodes if needed.

      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 node, see the class-level documentation of IStructuredBpmnModelPart for more info.

      When modelling a workflow node 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:
      modelNode in interface IWorkflowNodeBpmnModeler<Model>
      Parameters:
      params - The parameters for the modeler, containing the WorkflowNode 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(IModelWorkflowNodeParams<Model> params, IWorkflowBpmnModelContext context, IBoundMessageLocalizer localizer)
      Creates additional details regarding the configuration of the service task. These details are included in the text annotation of the service task, usually placed above the rectangle that represents the task in the BPMN diagram.
      Parameters:
      params - The parameters with the node 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 service task in the BPMN model.
    • createIoSpecification

      protected de.xima.bpmn_model.api.element.bpmn.data.InputOutputSpecification createIoSpecification(IModelWorkflowNodeParams<Model> params, IWorkflowBpmnModelContext context)
      Creates the input/output specification for the service task. This is used to define the input and output data of the service task, such as data objects that are read or written by the task. The default implementation creates an empty specification with a single (1) empty InputSet and single (1) empty OutputSet.

      When you override this method, you can either create your own IO specification from scratch, or call this super implementation and populate the returned InputOutputSpecification with your data.

      Parameters:
      params - The parameters with the node to model, as provided by the workflow engine.
      context - The BPMN model context, as provided by the workflow engine.
      Returns:
      The input/output specification for the service task, never null.
    • createName

      protected abstract String createName(IModelWorkflowNodeParams<Model> params, IWorkflowBpmnModelContext context, IBoundMessageLocalizer localizer)
      Creates the name of the service task in the BPMN model. This is the name of the service task, usually placed inside the rectangle that represents the task in the BPMN diagram.

      The rectangle always has a defined width and height, 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 action. Details about the action should be included in the task's annotation, see createDetails.

      By convention, name a task using an object and a verb in the infinitive. By doing this, you consistently describe what you do with an object. For example:

      • Review draft
      • Check invoice
      • Announce job
      Parameters:
      params - The parameters with the node 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.
    • createTaskLayoutPostProcessor

      Creates a post-processor for the service task layout. This allows you to enrich the service task with additional data and BPMN elements, such as adding data objects that represent the input or output of the service task. 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 node 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 service task layout, never null. The default implementation returns a no-op that does not enrich the service task in any way.