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,FcProvideResourceBpmnModeler,FcQueueTaskBpmnModeler,FcRedirectBpmnModeler,FcRenewProcessIdBpmnModeler,FcReturnFileBpmnModeler,FcSaveToFileSystemBpmnModeler,FcSaveToWebDavBpmnModeler,FcSendFormRecordMessageBpmnModeler,FcSetSavedFlagBpmnModeler,FcShowTemplateBpmnModeler,FcSqlStatementBpmnModeler,FcWriteFormRecordAttrBpmnModeler
public abstract class AServiceTaskBpmnModeler<Model> extends Object implements IWorkflowNodeBpmnModeler<Model>
Base class forBPMN modelersfor modelingnodesthat represent simpleservice tasksin the BPMN model, usually business logic actions. Can be used as a base for implementing thegetBpmnModelermethod of anode handlerinterface.This modeler creates a
service taskin the BPMN model, visualized as a rectangle with a gear icon. If the node can return, also adds anEndEventafter the service task, and connects the service task with the end event via aflow.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 atext annotationby overridingcreateDetails.Optionally, implementations can override
createTaskLayoutPostProcessor. This allows you to enrich the service task with additional details, such as addingdata objectsthat 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, bythrowing an error, or byreturning. - 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 thestateof aform record, then stops theprocessing 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
errorend 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceAServiceTaskBpmnModeler.IStatefulTaskLayoutPostProcessorA post-processor for the service task layout, seecreateTaskLayoutPostProcessor.
-
Constructor Summary
Constructors Constructor Description AServiceTaskBpmnModeler()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected StringcreateDetails(IModelWorkflowNodeParams<Model> params, IWorkflowBpmnModelContext context, IBoundMessageLocalizer localizer)Creates additional details regarding the configuration of the service task.protected de.xima.bpmn_model.api.element.bpmn.data.InputOutputSpecificationcreateIoSpecification(IModelWorkflowNodeParams<Model> params, IWorkflowBpmnModelContext context)Creates theinput/output specificationfor the service task.protected abstract StringcreateName(IModelWorkflowNodeParams<Model> params, IWorkflowBpmnModelContext context, IBoundMessageLocalizer localizer)Creates the name of the service task in the BPMN model.protected AServiceTaskBpmnModeler.IStatefulTaskLayoutPostProcessorcreateTaskLayoutPostProcessor(IModelWorkflowNodeParams<Model> params, IWorkflowBpmnModelContext context)Creates a post-processor for the service task layout.voidmodelNode(IModelWorkflowNodeParams<Model> params, IWorkflowBpmnModelContext context)Models aWorkflowNodein the BPMN diagram.
-
-
-
Method Detail
-
modelNode
public final void modelNode(IModelWorkflowNodeParams<Model> params, IWorkflowBpmnModelContext context)
Description copied from interface:IWorkflowNodeBpmnModelerModels aWorkflowNodein the BPMN diagram. This method is called once for theroot nodeof eachWorkflowTaskin the workflow. Implementations for nodes that havechildrenshould callcontext.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 aIStructuredBpmnModelPartfor thenode, see the class-level documentation ofIStructuredBpmnModelPartfor more info.When modelling a workflow node as BPMN, the usual approach is to create a nested tree of
alignment items, making use of thelayouter. This tree then getsresolvedto a flat map. Finally, the various method onIFlattenedAlignmentItemMapcan be used to create theBPMN shapes,BPMN edgesandsequence flows.- Specified by:
modelNodein interfaceIWorkflowNodeBpmnModeler<Model>- Parameters:
params- The parameters for the modeler, containing theWorkflowNodeto 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 alltriggersandnodesin 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 thetext annotationof 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 theboundMessageLocalizerobtained from thecontext.- 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 theinput/output specificationfor 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) emptyInputSetand single (1) emptyOutputSet.When you override this method, you can either create your own IO specification from scratch, or call this super implementation and populate the returned
InputOutputSpecificationwith 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 thenameof theservice 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, seecreateDetails.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 theboundMessageLocalizerobtained from thecontext.- Returns:
- The name of the service task in the BPMN model.
-
createTaskLayoutPostProcessor
protected AServiceTaskBpmnModeler.IStatefulTaskLayoutPostProcessor createTaskLayoutPostProcessor(IModelWorkflowNodeParams<Model> params, IWorkflowBpmnModelContext context)
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 addingdata objectsthat 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.
-
-