Class FcVoidHandler
- java.lang.Object
-
- de.xima.fc.workflow.designer.registry.nodes.FcVoidHandler
-
- All Implemented Interfaces:
IResourceBundleLocator
,IWorkflowNodeFlowAnalyzer<com.alibaba.fastjson.JSONObject>
,IElementHandler<com.alibaba.fastjson.JSONObject,WorkflowNode>
,IExecutionResultDescriptor
,IRefinedExecutionResultDescriptor<com.alibaba.fastjson.JSONObject>
,ICustomParametersUpdateable
,IWorkflowElementTypeProviding
,IHierarchyValidatingNode<com.alibaba.fastjson.JSONObject>
,IOfficialHelpPageElement<com.alibaba.fastjson.JSONObject,WorkflowNode>
,IOfficialHelpPageNode<com.alibaba.fastjson.JSONObject>
,IResultlessNode<com.alibaba.fastjson.JSONObject>
,INodeHandler<com.alibaba.fastjson.JSONObject>
,IWorkflowNodeTypeProviding
,IListenerRegistrator
,IOrderable
,IBuiltinResourcesHandler<com.alibaba.fastjson.JSONObject,WorkflowNode>
,IBuiltinNodeType<com.alibaba.fastjson.JSONObject>
,Comparable<IOrderable>
@Immutable public final class FcVoidHandler extends Object implements INodeHandler<com.alibaba.fastjson.JSONObject>, IBuiltinNodeType<com.alibaba.fastjson.JSONObject>, IBuiltinResourcesHandler<com.alibaba.fastjson.JSONObject,WorkflowNode>, IHierarchyValidatingNode<com.alibaba.fastjson.JSONObject>, IResultlessNode<com.alibaba.fastjson.JSONObject>
TheINodeHandler
for nodes of typeVOID
. Does nothing upon execution.- Since:
- 8.4.0
- Author:
- XIMA MEDIA GmbH
-
-
Field Summary
-
Fields inherited from interface de.xima.fc.interfaces.workflow.elements.IElementHandler
CURRENT_HANDLER_VERSION
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <TElement extends IWorkflowNodeTypeProviding & IActiveFlagProviding>
IFlowGraphEndPointscreateFlowGraph(ICreateFlowGraphParams<com.alibaba.fastjson.JSONObject,TElement> params)
This method is used to create the flow graph that represents the control flow of a workflow task, and to determine the end points of the node when executed.boolean
equals(Object obj)
INormalCompletionResult
execute(INodeExecutionParams<com.alibaba.fastjson.JSONObject> params)
Executes the given workflow node.IWorkflowNodeBpmnModeler<com.alibaba.fastjson.JSONObject>
getBpmnModeler()
Gets the BPMN modeler to be used for creating a BPMN 2.0 diagram of the workflow.EWorkflowNodeType
getBuiltinType()
Class<com.alibaba.fastjson.JSONObject>
getDataModelClass()
Returns the class of the custom properties used by the elements handled by this element logic handler.static FcVoidHandler
getInstance()
List<INodePrototypeDescriptor<com.alibaba.fastjson.JSONObject>>
getNodePrototypes(IGetNodePrototypesParams params)
Returns a list of all node prototypes for this node type.URL
getPropertiesViewXhtml()
This method must return the path to the XHTML page for the custom user interface.int
hashCode()
boolean
isCreateProtocolEntryAfterExecution(ICreateProtocolEntryAfterExecutionParams params)
Controls whether a protocol entry is created after the node was executed.boolean
isValidChildCount(WorkflowNode node, int childCount)
Checks whether the givennumber of children
is allowed.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.xima.fc.workflow.mixin.IBuiltinNodeType
getOfficialHelpPagePath, getType, isAvailable, register
-
Methods inherited from interface de.xima.fc.workflow.designer.registry.IBuiltinResourcesHandler
getCascadingStyleSheet, getJavaScript
-
Methods inherited from interface de.xima.fc.interfaces.workflow.ICustomParametersUpdateable
updateCustomParams
-
Methods inherited from interface de.xima.fc.interfaces.workflow.elements.IElementHandler
extractDescription, extractName, extractSearchTerms, getCascadingStyleSheet, getDisplayLabel, getElementSummaryModel, getElementSummaryXhtml, getFastJsonConverter, getFilterCriteriaForEntities, getJavaScript, getResourceBundle, getVersion, isHasUserVisibleName, readEntityReferences, readPlaceholders, validateGlobal, writeEntityReferences, writePlaceholders
-
Methods inherited from interface de.xima.fc.interfaces.workflow.execution.IExecutionResultDescriptor
getAlwaysValueDescriptor, getAttachmentValueDescriptor, getCurrentAttachmentValueDescriptor, getCurrentFileValueDescriptor, getCurrentValueDescriptor, getFileValueDescriptor, getSoftErrorValueDescriptor
-
Methods inherited from interface de.xima.fc.interfaces.workflow.mixin.IHierarchyValidatingNode
isValidChildType, isValidParentType, validateLocal
-
Methods inherited from interface de.xima.fc.interfaces.workflow.nodes.INodeHandler
getLocalizedTypeName, getPropertiesBeanClass, getRelatedNodeTypes, getSupportedControlTransferTypes, isCreateProtocolEntryAfterExecution, isReplacePlaceholderBeforeExecution
-
Methods inherited from interface de.xima.fc.interfaces.workflow.mixin.IOfficialHelpPageElement
getHelpPageLocation
-
Methods inherited from interface de.xima.fc.listener.IOrderable
compareTo, shouldBeAfter
-
Methods inherited from interface de.xima.fc.interfaces.workflow.execution.IRefinedExecutionResultDescriptor
getAlwaysValueDescriptor, getAttachmentValueDescriptor, getCurrentAttachmentValueDescriptor, getCurrentFileValueDescriptor, getCurrentValueDescriptor, getErrorValueDescriptor, getFileValueDescriptor, getSoftErrorValueDescriptor, getSuccessValueDescriptor
-
Methods inherited from interface de.xima.fc.interfaces.workflow.mixin.IResultlessNode
getErrorValueDescriptor, getSuccessValueDescriptor
-
-
-
-
Method Detail
-
createFlowGraph
public <TElement extends IWorkflowNodeTypeProviding & IActiveFlagProviding> IFlowGraphEndPoints createFlowGraph(ICreateFlowGraphParams<com.alibaba.fastjson.JSONObject,TElement> params) throws WorkflowAnalysisException
Description copied from interface:IWorkflowNodeFlowAnalyzer
This method is used to create the flow graph that represents the control flow of a workflow task, and to determine the end points of the node when executed. A flow graph constructed by the workflow engine and used for the purpose of deriving statements about the runtime behavior of the program represented by a workflow task with a root node.See below for details on how to construct a flow graph. However, note that unless you are creating a new custom flow control node, you should use on of the existing mixins that matches the type of node you are creating:
IExecutingLikeActionNode
for normal business actions that execute some logic and have no children.IExecutingLikeBinarySelectionNode
for custom conditions that behave like an if-else statement.IExecutingLikeControlTransferNode
for custom control transfer actions such as break or continue statements (you will rarely need this).IExecutingLikeExceptionHandlerNode
for custom error handlers that behave like a try-catch-finally statement.IExecutingLikeMultiSwitchNode
for custom conditions that behave like switch-case-default statement.IExecutingLikePostTestLoopNode
for custom loops that behave like a do-while-loop.IExecutingLikePreTestLoopNode
for custom loops that behave like a while-loop.IExecutingLikeReturningActionNode
for custom end points that can both throw an exception and end a processing chain by returning.IExecutingLikeReturnNode
for custom end points that always return and never throw an exception.IExecutingLikeSequenceNode
for custom block statements that never throw and execute their children in order (you will rarely need this).IExecutingLikeThrowNode
for custom throw statements that can never complete normally and always throw an error.
The flow graph is a directed graph. Each node in the control flow graph is either
- a real node that corresponds to a
WorkflowNode
; or - a
virtual
nodeowned
and created by a real node
FlowGraphConnectionType
. Virtual nodes are often used to model complex control transfers involving conversion between completion types, such as try-finally blocks.Regarding end points, see the documentation of
Normal
,Throwing
, andControlTransfer
for more details.This method is not pure and must have side effects. It is responsible for
- calling
createFlowGraph
(or one of its variants) on all of its children (if applicable); - calling
connect
(or one of its variants); and - returning the set of normal and throwing end points of the node.
This method must return the set of all nodes (including the children, grand-children etc. of this node) that represent the normal and throwing end points when the node is executed. These throwing end points are used for connecting this node to other siblings and parents. See the documentation of the subclasses of
FlowGraphEndPoint
for more details.- Specified by:
createFlowGraph
in interfaceIWorkflowNodeFlowAnalyzer<com.alibaba.fastjson.JSONObject>
- Type Parameters:
TElement
- The type of the node elements on which the analysis is performed. This type may be different depending on whether the analysis is performed on the backend data modelWorkflowNode
or the frontend view model.- Parameters:
params
- The node to analyze and the current analysis context.- Returns:
- The set of all end points of the given node. Use
ICreateFlowGraphContext#endPoints
and its variants to create this return value. See the documentation ofgetNormalEndPoints
andgetThrowingEndPoints
for more details. - Throws:
WorkflowAnalysisException
- May be thrown when an unhandled exception occurred during the analysis. If this exception is thrown, the entire analysis is cancelled and the exception is propagated up. You should only throw this exception yourself if encountering an illegal state that would render the analysis invalid.
-
execute
public INormalCompletionResult execute(INodeExecutionParams<com.alibaba.fastjson.JSONObject> params) throws AbstractAbruptCompletionException
Description copied from interface:INodeHandler
Executes the given workflow node. You may perform any action required by this node type, such as creating files, sending HTTP requests etc.If this node has children that need to be executed (such as for control nodes like conditions or switches), you must use
IWorkflowExecutionContext.executor()
to execute the children instead of attempting to call their execute method directly. Note that a node must never attempt to execute any other node that is not in the subtree (= a child, a grand-child, a grand-grand-child etc.) of this node.In case you throw any other exceptions other than the exceptions mentioned in the throws clause, it will be wrapped in a
NodeThrewException
with a general error code.- Specified by:
execute
in interfaceINodeHandler<com.alibaba.fastjson.JSONObject>
- Parameters:
params
- The node that needs to be executed and the current workflow context.- Returns:
- The result value or values created by the executed node.
- Throws:
AbstractAbruptCompletionException
- When the node's execution did not finish normally, see below for subclasses.NodeThrewException
- If this exception was thrown by the execute method of the given node. Indicates that a node could not be completed successfully. This exception can be caught by control flow nodes with custom error handling, such as a try-catch node.NodeReturnedException
- If this exception was thrown by the execute method of the given node. Indicates that the node wishes to return, i.e. to stop the execution of the current processing chain (="function"). This exception can be caught by control flow nodes with custom finalization handling, such as a try-finally node (which should rethrow this exception afterwards).NodeTransferredControlException
- If this exception was thrown by the execute method of the given node. Indicates that a control transfer should take place. The matching node for thecontrol transfer target
should catch this exception and proceed according to thetype of the control transfer
. For example, loop nodes may catch break and continue control transfers and either stop the loop or skip to the next iteration of the loop.
-
getBpmnModeler
public IWorkflowNodeBpmnModeler<com.alibaba.fastjson.JSONObject> getBpmnModeler()
Description copied from interface:INodeHandler
Gets the BPMN modeler to be used for creating a BPMN 2.0 diagram of the workflow.The modeler should not have any state and be immutable. It must be thread-safe.
- Specified by:
getBpmnModeler
in interfaceINodeHandler<com.alibaba.fastjson.JSONObject>
- Returns:
- The BPMN modeler for this node.
-
getBuiltinType
public EWorkflowNodeType getBuiltinType()
- Specified by:
getBuiltinType
in interfaceIBuiltinNodeType<com.alibaba.fastjson.JSONObject>
- Returns:
- The built-in node type.
-
getDataModelClass
public Class<com.alibaba.fastjson.JSONObject> getDataModelClass()
Description copied from interface:IElementHandler
Returns the class of the custom properties used by the elements handled by this element logic handler.The custom properties of a workflow element are internally stored as JSON. To ease the development work, you can specify a model class, and the JSON is automatically converted to an instance of that model class. Please note that the model class must be compatible with serialization mechanism used by
JSON
.See
IElementHandler.getVersion()
for how custom properties are updated.If you need more control over serialization and deserialization, specify
JSONObject
as the type parameter and returnJSONObject.class
. You will then receive the raw JSON data and may perform the serialization in whatever way you like.- Specified by:
getDataModelClass
in interfaceIElementHandler<com.alibaba.fastjson.JSONObject,WorkflowNode>
- Returns:
- The class corresponding to the type parameter
TData
.
-
getNodePrototypes
public List<INodePrototypeDescriptor<com.alibaba.fastjson.JSONObject>> getNodePrototypes(IGetNodePrototypesParams params)
Description copied from interface:INodeHandler
Returns a list of all node prototypes for this node type. Each prototype appears in the drawer panel of the workflow designer. The user can move a node prototype via drag & drop into the design area in the center to add the node to the current flowchart.You should always return all prototypes, irrespective of whether they are allowed to the current user.
IElementHandler.isAvailable(IIsAvailableParams)
is checked by the engine, and unavailable node types are removed automatically.- Specified by:
getNodePrototypes
in interfaceINodeHandler<com.alibaba.fastjson.JSONObject>
- Parameters:
params
- Parameters for this method, such as the current locale for localizing the display name of the prototypes.- Returns:
- A list of all available prototypes.
null
is treated as an empty list.
-
getPropertiesViewXhtml
public URL getPropertiesViewXhtml() throws MalformedURLException
Description copied from interface:IElementHandler
This method must return the path to the XHTML page for the custom user interface. Usually the XHTML file is part of the JAR resources of the module or plugin. In this case, you should return an URL to a JAR file resource (jar:file:/...
) like so:@Override public URL getXhtmlView() { return getClass().getResource("/path/to/view.xhtml"); }
The contents of this XHTML page is included in the properties panel, without a fieldset or container around it, but already inside a form (i.e. do not use a
h:form
as that would result in an error). You should wrap your custom UI in a naming container to ensure unique IDs that do not clash with other plugins or actions. The following is a recommended template on which you may base your UI:<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:o="http://omnifaces.org/ui" xmlns:p="http://primefaces.org/ui" xmlns:xi="http://www.xima.de/taglib/xfc"> <!-- Enable bean validation (when #validateLocal is implemented via the bean validator)--> <o:validateBean value="#{model}" showMessageFor="@violating" method="validateActual" /> <xi:namingContainer id="myAwesomeWorkflowElement"> <!--Base info with name and description (when TData extends BaseActionProps) --> <xi:newWorkflowActionBase id="base" value="#{model}" legend="#{msg['wf.node.myawesomelememnt']}" /> <!-- Remove when TData does not have a
ISingleFileProviding
field --> <xi:singleFile id="resource" value="#{model.singleFile}" required="true" /> <!-- Remove when TData does not have aIMultiFileProviding
field --> <xi:multiFile id="resource" value="#{model.multiFile}" required="true" /> <!-- Remove when TData does not implement IProviding --> <xi:fileProvision id="providing" value="#{model.fileProvision}" /> <!-- Custom section with editors specific to your workflow element --> <p:fieldset legend="#{msg['MyAwesomeWorkflowElementProps.fieldset.base']}" styleClass="fc-fieldset"> <!-- A simple input field bound to the mail property of your properties model --> <xi:inputText id="mail" label="#{msg['MyAwesomeWorkflowElementProps.mail']}" formPlaceholder="true" value="#{model.mail}" forceIndicateRequired="true" > <p:ajax event="change" partialSubmit="true" listener="#{elementPropertiesBean.storeCurrent}" process="@this" update=":flowchartForm:flowchart" global="false" /> </xi:inputText> </p:fieldset> </xi:namingContainer> </ui:composition>The XHTML page may access the following expression language variables:
- model: The deserialized custom properties of the workflow element, of the type
TData
. - provider: An object that implements
IWorkflowProvider
, for accessing various data, such as a list of all users or text templates. - msg: The localized messages as returned by
IElementHandler.getResourceBundle(Locale)
. Empty when that method returnsnull
. For example, if the resource bundle contains the keymail.label
, you can access the localized message via the EL expression['mail.label']
To access the values of an enum or the constants defined by a class, consider using
<xi:importConstants type="my.fully.classified.path.MyEnum" var="MyEnum" loader="#{model}"/>
Theloader
argument is only required for plugins and ensures that the correct class loader is used that knows about the plugin class. Without the loader attribute, the above is equivalent to the PrimeFaces tag handler<p:importConstants />
.- Specified by:
getPropertiesViewXhtml
in interfaceIElementHandler<com.alibaba.fastjson.JSONObject,WorkflowNode>
- Returns:
- Path to the XHTML view. If the action can be configured, this must not return
null
. If you do returnnull
, it will be treated as an error and an appropriate message is displayed to the user informing them that the properties panel could not be loaded. If the action cannot be configured (i.e. when the action is not selectable), this should returnnull
. - Throws:
MalformedURLException
- This exception is declared for convenience - normally you would usenew URL(String)
with a constant URL string that should not throw. In case an exception is thrown, it is treated the same as if this returnednull
.
- model: The deserialized custom properties of the workflow element, of the type
-
isCreateProtocolEntryAfterExecution
public boolean isCreateProtocolEntryAfterExecution(ICreateProtocolEntryAfterExecutionParams params)
Description copied from interface:INodeHandler
Controls whether a protocol entry is created after the node was executed.The default implementation returns true iff result was created by the current node.
When some action throws an exception, all parent control flow node such as if-else statements also throw an exception. This would result in multiple protocol entries for a single error.
- Specified by:
isCreateProtocolEntryAfterExecution
in interfaceINodeHandler<com.alibaba.fastjson.JSONObject>
- Parameters:
params
- Parameters with the node that was executed and the result of the node's execution.- Returns:
true
to create a protocol entry, orfalse
otherwise.
-
isValidChildCount
public boolean isValidChildCount(WorkflowNode node, int childCount)
Description copied from interface:IHierarchyValidatingNode
Checks whether the givennumber of children
is allowed. The default implementation enforces no restriction on the number of children.- Specified by:
isValidChildCount
in interfaceIHierarchyValidatingNode<com.alibaba.fastjson.JSONObject>
- Parameters:
node
- The parent node with the children to check.childCount
- The number of children of the node node.- Returns:
true
if the number of children are allowed.
-
getInstance
public static FcVoidHandler getInstance()
- Returns:
- The immutable, stateless instance of this handler.
-
-