Interface IPluginWhileLoopNodeHandler<TData extends BaseWhileLoopProps, TState extends IWorkflowLoopDataProviding>

Type Parameters:
TData - Type of the node's properties model, which must extend BaseWhileLoopProps. The properties themselves are stored as JSON and serialized to / deserialized from this type automatically. You should make sure this type can be serialized / deserialized via JSON. This means you should use only basic field types such as number, booleans, or strings, or nested types. Furthermore, if you wish, you can also use the type JSONObject to skip serialization / deserialization and work with the raw JSON data.
TState - Type of the custom state used during the execution of the loop. If you do not require any state, simply set this type parameter to Object.
All Superinterfaces:
IBaseWhileLoopClientHandlerNode<TData>, IBeanValidatingElement<TData, WorkflowNode>, IBeanValidatingNode<TData>, ICustomParametersUpdateable, IElementHandler<TData, WorkflowNode>, IExecutingLikePreTestLoopNode<TData>, IExecutionResultDescriptor, IFCPlugin, IHierarchyValidatingNode<TData>, INamedUiElement, INameProviding, INodeHandler<TData>, IPluginGenericCustomGUI<IPluginWorkflowNodeBean>, IPluginWorkflowNode, IRefinedExecutionResultDescriptor<TData>, IResourceBundleLocator, ISingleBaseWhileLoopNodePrototype<TData>, ISingleElementPrototype<TData, WorkflowNode>, ISingleNodePrototype<TData>, ITransferable, IWorkflowElementTypeProviding, IWorkflowNodeFlowAnalyzer<TData>, IWorkflowNodeTypeProviding, Serializable
All Known Implementing Classes:
APluginWhileLoopNodeHandler

public interface IPluginWhileLoopNodeHandler<TData extends BaseWhileLoopProps, TState extends IWorkflowLoopDataProviding> extends IPluginWorkflowNode, INodeHandler<TData>, IBaseWhileLoopClientHandlerNode<TData>, IBeanValidatingNode<TData>, IExecutingLikePreTestLoopNode<TData>, ISingleBaseWhileLoopNodePrototype<TData>
Mixin meant for IPluginWorkflowNode plugins that only wish to provide a workflow while loop that runs a test and executes the loop body for as long as the test holds true (= a while loop). The INodeHandler offers many methods that are irrelevant for this use case - this mixin implements most methods with the appropriate defaults.

By default, you only need to implement evaluateWhileLoopTest() and getName(), as well as getPropertiesViewXhtmlName() for the UI. Make sure that the getName() is unique among all plugins. This name is also used as the getType() of the workflow node.

The XHTML page with the UI for editing the while loop's property must be placed in the directory getPropertiesViewXhtmlPath(), with the file name getPropertiesViewXhtmlName(). You can also add properties files in getResourceBundlePath() with localized messages for the UI.

Assume the getType() is MyWhileLoopPlugin. Then, if you do not override the defaults:

  • Add an XHTML file with the custom UI for the while loop in /src/main/resources/WEB-INF/ui/FILENAME.xhtml. where FILENAME is the value from getPropertiesViewXhtmlName().
  • For each language you want to support, add a properties file in /src/main/resources/WEB-INF/properties/i18n_LOCALECODE.properties. The LOCALECODE is en for English, de for German, fr for French etc. These properties are then available in the XHTML page via the variable msg, see IElementHandler.getPropertiesViewXhtml()
  • Add an entry in the properties file for the keys MyWhileLoopPlugin.name, MyWhileLoopPlugin.desc, MyWhileLoopPlugin.label to customize the name of the plugin, the description of the plugin, and the name of the workflow while loop.

You can also override most methods of this mixin to customize the while loop plugin. The following lists a few common use cases:

To use a localized name or description
Add an entry to your resource bundle. For the name of the plugin as it appears in the backend plugin configuration menu, use getI18nKeyDisplayName(). For the description that also appears in the backend plugin configuration menu, use getI18nKeyDescription(). For the label of the while loop as it appears in the workflow designer, use getI18nKeyActionLabel().
To provide custom values to other actions inside the while loop
Override addCurrentValueDescriptorEntries() to describe which data your loop provides; and use params.currentValue() within evaluateWhileLoopTest() to provide the data. See also the example from addCurrentValueDescriptorEntries().
To provide custom result values to other actions after the loop has finished
Override addSuccessValueDescriptorEntries() to describe which results your loop provides when it has finished; and use params.normalResult().success() within finishLoop() to provide the data. If you want to accumulate some value from each iteration and make it available, you can use a custom state object that is available during the entire execution of the loop by overriding startLoop(INodeExecutionParams). See also the example from addSuccessValueDescriptorEntries().
To update the properties model for new versions of the plugin
First make sure the MANIFEST.MF of your plugin contains the appropriate version information, see getVersion(). Then, override updateCustomParams(). If you are using the SemVer (semantic version) format (i.e. your version looks like x.y.z), you may want to use the default methods provided by the mixin ISemverUpdating.
To provide pre-configured while loops to the drawer panel to the left of the workflow designer
Override getNodePrototypes(), optionally adding the list of prototypes (which contains just one item) returned by the super method implementation.
To display the while loop in a different category in the workflow designer
Override getSubCategory()
To use a custom UI
Create an XHTML page in getPropertiesViewXhtmlPath(); and override getPropertiesViewXhtmlName() with the name of the XHTML page. For example, if you name the XHTML page myCustomUi and do not override the XHTML path, add the file /src/main/resources/WEB-INF/ui/myCustomUi.xhtml. If you need a custom bean as a controller, also override getMainPluginBeanClass(). See getPropertiesViewXhtml() for more details on the XHTML page.
To use more than one bean
Override getUnmanagedBeans(), but make sure to include getMainPluginBeanClass(). The additional beans can be used in XHTML pages, or referenced via Inject.
To customize the serialization / deserialization process of the properties model
Use the JSONField annotation on the fields of your properties model class, and/or override IElementHandler.getFastJsonConverter()
Since:
8.2.0
Author:
XIMA MEDIA GmbH