Class FcForEachLoopHandler
- All Implemented Interfaces:
IResourceBundleLocator, IWorkflowNodeFlowAnalyzer<FcForEachLoopProps>, IElementHandler<FcForEachLoopProps, WorkflowNode>, IExecutionResultDescriptor, IRefinedExecutionResultDescriptor<FcForEachLoopProps>, ICustomParametersUpdateable, IWorkflowElementTypeProviding, IBeanValidatingElement<FcForEachLoopProps, WorkflowNode>, IBeanValidatingNode<FcForEachLoopProps>, IExecutingLikePreTestLoopNode<FcForEachLoopProps>, IHierarchyValidatingNode<FcForEachLoopProps>, IKeyValueSummarizableElement<FcForEachLoopProps, WorkflowNode>, IKeyValueSummarizableNode<FcForEachLoopProps>, ILoopStatementMustLoopValidating<FcForEachLoopProps>, IOfficialHelpPageElement<FcForEachLoopProps, WorkflowNode>, IOfficialHelpPageNode<FcForEachLoopProps>, ISingleElementPrototype<FcForEachLoopProps, WorkflowNode>, ISingleNodePrototype<FcForEachLoopProps>, INodeHandler<FcForEachLoopProps>, IWorkflowNodeTypeProviding, IListenerRegistrator, IOrderable, ISingleBuiltinNodePrototype<FcForEachLoopProps>, IBuiltinResourcesHandler<FcForEachLoopProps, WorkflowNode>, IBuiltinNodeType<FcForEachLoopProps>, IFcForEachLoopDescriptors, Comparable<IOrderable>
INodeHandler for nodes of type EWorkflowNodeType.FC_FOR_EACH_LOOP.- Since:
- 8.2.0
- Author:
- XIMA MEDIA GmbH
-
Nested Class Summary
Nested classes/interfaces inherited from interface IListenerRegistrator
IListenerRegistrator.DeprecatedRegistrator -
Field Summary
Fields inherited from interface IElementHandler
CURRENT_HANDLER_VERSIONFields inherited from interface IFcForEachLoopDescriptors
CURRENT_ATTR_INDEX, CURRENT_ATTR_ITEM, CURRENT_ATTR_KEY, SUCCESS_ATTR_COUNT -
Method Summary
Modifier and TypeMethodDescriptionbooleanExecutes the given workflow node.Gets the BPMN modeler to be used for creating a BPMN 2.0 diagram of the workflow.Returns the class of the custom properties used by the elements handled by this element logic handler.static FcForEachLoopHandlerintClass<? extends INodePropertiesBean<FcForEachLoopProps>> Returns the class of the bean that should be used when editing the properties of a workflow element.This method must return the path to the XHTML page for the custom user interface.getPrototypeModelData(String label, IGuiIcon icon, IGetElementPrototypesParams params) getPrototypeSortKey(String label, IGetElementPrototypesParams params) Optional sub category.Returns the set of control transfer types that this node can handle.inthashCode()booleanControls whether a protocol entry is created after the node was executed.booleanisValidChildCount(WorkflowNode node, int childCount) Checks whether the givennumber of childrenis allowed.booleanisValidChildType(WorkflowNode node, int childIndex, String nodeType) Checks whether thetypeof a certainworkflow node childis allowed for that node.booleanisValidParentType(WorkflowNode node, String nodeType) Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IBeanValidatingElement
getValidationGroupsMethods inherited from interface IBeanValidatingNode
validateLocalMethods inherited from interface IBuiltinNodeType
getOfficialHelpPagePath, getType, isAvailable, registerMethods inherited from interface IBuiltinResourcesHandler
getCascadingStyleSheet, getJavaScriptMethods inherited from interface ICustomParametersUpdateable
updateCustomParamsMethods inherited from interface IElementHandler
extractDescription, extractName, extractSearchTerms, getCascadingStyleSheet, getDisplayLabel, getFastJsonConverter, getFilterCriteriaForEntities, getFilterCriteriaForObjects, getJavaScript, getResourceBundle, getVersion, isHasUserVisibleName, readEntityReferences, readObjectReferences, readPlaceholders, writeEntityReferences, writeObjectReferences, writePlaceholdersMethods inherited from interface IExecutingLikePreTestLoopNode
createFlowGraphMethods inherited from interface IExecutionResultDescriptor
getAlwaysValueDescriptor, getAttachmentValueDescriptor, getErrorValueDescriptor, getFileValueDescriptor, getSoftErrorValueDescriptorMethods inherited from interface IFcForEachLoopDescriptors
getCurrentAttachmentValueDescriptor, getCurrentAttachmentValueDescriptor, getCurrentFileValueDescriptor, getCurrentFileValueDescriptor, getCurrentValueDescriptor, getCurrentValueDescriptor, getErrorValueDescriptors, getErrorValueDescriptors, getSoftErrorValueDescriptors, getSoftErrorValueDescriptors, getSuccessValueDescriptorMethods inherited from interface IKeyValueSummarizableElement
getElementSummaryModel, getElementSummaryXhtmlMethods inherited from interface ILoopStatementMustLoopValidating
validateGlobalMethods inherited from interface INodeHandler
getLocalizedTypeName, getRelatedNodeTypes, isCreateProtocolEntryAfterExecution, isReplacePlaceholderBeforeExecutionMethods inherited from interface IOfficialHelpPageElement
getHelpPageLocationMethods inherited from interface IOrderable
compareTo, shouldBeAfterMethods inherited from interface IRefinedExecutionResultDescriptor
getAlwaysValueDescriptor, getAlwaysValueDescriptor, getAttachmentValueDescriptor, getAttachmentValueDescriptor, getCurrentAttachmentValueDescriptor, getCurrentFileValueDescriptor, getCurrentValueDescriptor, getErrorValueDescriptor, getFileValueDescriptor, getFileValueDescriptor, getSoftErrorValueDescriptor, getSuccessValueDescriptor, getSuccessValueDescriptorMethods inherited from interface ISingleBuiltinNodePrototype
getPrototypeIcon, getPrototypeLabel, getPrototypeSearchText, getPrototypeSubLabel, getPrototypeTitleMethods inherited from interface ISingleElementPrototype
getPrototypeTagsMethods inherited from interface ISingleNodePrototype
getNodePrototypes, getPrototypeElementChildren
-
Method Details
-
equals
-
execute
public INormalCompletionResult execute(INodeExecutionParams<FcForEachLoopProps> params) throws AbstractAbruptCompletionException Description copied from interface:INodeHandlerExecutes 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
NodeThrewExceptionwith a general error code.- Specified by:
executein interfaceINodeHandler<FcForEachLoopProps>- 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.
-
getBpmnModeler
Description copied from interface:INodeHandlerGets 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:
getBpmnModelerin interfaceINodeHandler<FcForEachLoopProps>- Returns:
- The BPMN modeler for this node.
-
getBuiltinType
- Specified by:
getBuiltinTypein interfaceIBuiltinNodeType<FcForEachLoopProps>- Returns:
- The built-in node type.
-
getDataModelClass
Description copied from interface:IElementHandlerReturns 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
JSONObjectas 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:
getDataModelClassin interfaceIElementHandler<FcForEachLoopProps, WorkflowNode>- Returns:
- The class corresponding to the type parameter
TData.
-
getElementSummaryKeyValueModel
public ISummaryKeyValueModel getElementSummaryKeyValueModel(IGetElementSummaryParams<FcForEachLoopProps> params) - Specified by:
getElementSummaryKeyValueModelin interfaceIKeyValueSummarizableElement<FcForEachLoopProps, WorkflowNode>- Parameters:
params- The custom properties of the node or trigger.- Returns:
- A list of key value pairs to display in a table in the overview panel.
-
getLoopBodyChildIndex
public int getLoopBodyChildIndex()- Specified by:
getLoopBodyChildIndexin interfaceIExecutingLikePreTestLoopNode<FcForEachLoopProps>- Specified by:
getLoopBodyChildIndexin interfaceILoopStatementMustLoopValidating<FcForEachLoopProps>- Returns:
- Index of the child representing the loop body.
-
getMainCategory
- Specified by:
getMainCategoryin interfaceISingleElementPrototype<FcForEachLoopProps, WorkflowNode>- Parameters:
params- Parameters with the current client, locale, entity context etc.- Returns:
IElementCategoryelement's main category, which is used for grouping the elements.
-
getPropertiesBeanClass
Description copied from interface:IElementHandlerReturns the class of the bean that should be used when editing the properties of a workflow element. May benullif you do not require any bean or custom logic. When you only wish to access the properties of yourIElementHandler.getDataModelClass(), you do have to use a custom bean - the model is available via the expression language variablemodel. SeeIElementHandler.getPropertiesViewXhtml()for further details.The default returns
null, which uses no extra bean. An extra bean may not be required for simple UIs if you only need to access the properties model of the workflow element - seeIElementHandler.getPropertiesViewXhtml().- Specified by:
getPropertiesBeanClassin interfaceIElementHandler<FcForEachLoopProps, WorkflowNode>- Specified by:
getPropertiesBeanClassin interfaceINodeHandler<FcForEachLoopProps>- Returns:
- The class of the bean to use for editing a workflow node's properties.
- See Also:
-
getPropertiesViewXhtml
Description copied from interface:IElementHandlerThis 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 a 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:formas 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 aISingleFileProvidingfield --> <xi:singleFile id="resource" value="#{model.singleFile}" required="true" /> <!-- Remove when TData does not have aIMultiFileProvidingfield --> <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 expressionmsg['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}"/>Theloaderargument 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:
getPropertiesViewXhtmlin interfaceIElementHandler<FcForEachLoopProps, 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
-
getPrototypeElement
- Specified by:
getPrototypeElementin interfaceISingleElementPrototype<FcForEachLoopProps, WorkflowNode>- Specified by:
getPrototypeElementin interfaceISingleNodePrototype<FcForEachLoopProps>- Parameters:
params- Parameters with the current client, locale, entity context etc.- Returns:
- The workflow element that is used as a prototype. The default implementation simply creates a new
workflow element with the
IWorkflowElementTypeProviding.getType(). Usually there is no reason to override this method.
-
getPrototypeModelData
public FcForEachLoopProps getPrototypeModelData(String label, IGuiIcon icon, IGetElementPrototypesParams params) - Specified by:
getPrototypeModelDatain interfaceISingleElementPrototype<FcForEachLoopProps, WorkflowNode>- Parameters:
label- Label of the prototype, as returned byISingleElementPrototype.getPrototypeLabel(IGetElementPrototypesParams). Can be used to prefill the properties model with the label.icon- Icon of the prototype, as returned byISingleElementPrototype.getPrototypeIcon(IGetElementPrototypesParams). Can be used to prefill the properties model with the icon.params- Parameters with the current client, locale, entity context etc.- Returns:
- The properties model for the element prototype. This is the initial configuration when the user adds the prototype to the flowchart (via drag & drop).
-
getPrototypeSortKey
- Specified by:
getPrototypeSortKeyin interfaceISingleBuiltinNodePrototype<FcForEachLoopProps>- Specified by:
getPrototypeSortKeyin interfaceISingleElementPrototype<FcForEachLoopProps, WorkflowNode>- Parameters:
label- The label, as returned byISingleElementPrototype.getPrototypeLabel(IGetElementPrototypesParams). Can be used to sort the prototype alphabetically by its name.params- Parameters with the current client, locale, entity context etc.- Returns:
- The sort key for the prototype, used when there are multiple prototypes within the same category. See
IElementPrototypeDescriptor.getSortKey().
-
getSubCategory
Description copied from interface:ISingleElementPrototypeOptional sub category. When not set or this returnsnull, the element is shown under the categorymiscellaneous.- Specified by:
getSubCategoryin interfaceISingleElementPrototype<FcForEachLoopProps, WorkflowNode>- Parameters:
params- Parameters with the current client, locale, entity context etc.- Returns:
IElementCategoryelement's sub category, which is used for grouping the element within the given main group.
-
getSupportedControlTransferTypes
Description copied from interface:INodeHandlerReturns the set of control transfer types that this node can handle. SeeEStandardControlTransferTypefor a list of built-in transfer types.If this method returns a non-empty set, the
executemethod should catchNodeTransferredControlException. If itscontrol transfer typeis one of the supported types, it should handle that control transfer accordingly. Otherwise, it should propagate the exception upwards by rethrowing it.This method is also used by control transfer nodes (e.g. the built-in
FC_BREAKorFC_CONTINUE) to decide which nodes are valid targets.See
EStandardControlTransferTypefor a list of built-in control transfer types.- Specified by:
getSupportedControlTransferTypesin interfaceINodeHandler<FcForEachLoopProps>- Returns:
- The control transfer types that this node can handle.
- See Also:
-
hashCode
-
isCreateProtocolEntryAfterExecution
Description copied from interface:INodeHandlerControls 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:
isCreateProtocolEntryAfterExecutionin interfaceINodeHandler<FcForEachLoopProps>- Parameters:
params- Parameters with the node that was executed and the result of the node's execution.- Returns:
trueto create a protocol entry, orfalseotherwise.
-
isValidChildCount
Description copied from interface:IHierarchyValidatingNodeChecks whether the givennumber of childrenis allowed. The default implementation enforces no restriction on the number of children.- Specified by:
isValidChildCountin interfaceIHierarchyValidatingNode<FcForEachLoopProps>- Parameters:
node- The parent node with the children to check.childCount- The number of children of the node node.- Returns:
trueif the number of children are allowed.
-
isValidChildType
Description copied from interface:IHierarchyValidatingNodeChecks whether thetypeof a certainworkflow node childis allowed for that node. The default implementation enforces no restriction on the child type.- Specified by:
isValidChildTypein interfaceIHierarchyValidatingNode<FcForEachLoopProps>- Parameters:
node- The parent node with the children to check.childIndex- 0-based index of the child to check.nodeType- Node type of the child to check.- Returns:
trueif the child type is allowed.
-
isValidParentType
Description copied from interface:IHierarchyValidatingNodeChecks whether thetypeof a certainparentis allowed for that node. The default implementation enforces no restriction on the parent type.- Specified by:
isValidParentTypein interfaceIHierarchyValidatingNode<FcForEachLoopProps>- Parameters:
node- The node with the parent to check.nodeType- Node type of the parent to check. Empty string when the node does not have a parent.- Returns:
trueif the parent type is allowed.
-
getInstance
- Returns:
- The immutable, stateless instance of this handler.
-