Class FcSwitchDefaultHandler
- java.lang.Object
-
- de.xima.fc.workflow.designer.registry.nodes.FcSwitchDefaultHandler
-
- All Implemented Interfaces:
IResourceBundleLocator,IWorkflowNodeFlowAnalyzer<FcSwitchDefaultProps>,IElementHandler<FcSwitchDefaultProps,WorkflowNode>,IExecutionResultDescriptor,ICustomParametersUpdateable,IWorkflowElementTypeProviding,IBeanValidatingElement<FcSwitchDefaultProps,WorkflowNode>,IBeanValidatingNode<FcSwitchDefaultProps>,IExecutingLikeSequenceNode<FcSwitchDefaultProps>,IHierarchyValidatingNode<FcSwitchDefaultProps>,IOfficialHelpPageElement<FcSwitchDefaultProps,WorkflowNode>,IOfficialHelpPageNode<FcSwitchDefaultProps>,IResultlessNode<FcSwitchDefaultProps>,INodeHandler<FcSwitchDefaultProps>,IWorkflowNodeTypeProviding,IListenerRegistrator,IOrderable,IBuiltinResourcesHandler<FcSwitchDefaultProps,WorkflowNode>,IBuiltinNodeType<FcSwitchDefaultProps>,Comparable<IOrderable>
@Immutable public final class FcSwitchDefaultHandler extends Object implements INodeHandler<FcSwitchDefaultProps>, IBeanValidatingNode<FcSwitchDefaultProps>, IBuiltinNodeType<FcSwitchDefaultProps>, IBuiltinResourcesHandler<FcSwitchDefaultProps,WorkflowNode>, IExecutingLikeSequenceNode<FcSwitchDefaultProps>, IResultlessNode<FcSwitchDefaultProps>
TheINodeHandlerfor nodes of typeEWorkflowNodeType.FC_SWITCH.- 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 booleanequals(Object obj)INormalCompletionResultexecute(INodeExecutionParams<FcSwitchDefaultProps> params)Executes the given workflow node.EWorkflowNodeTypegetBuiltinType()Class<FcSwitchDefaultProps>getDataModelClass()Returns the class of the custom properties used by the elements handled by this element logic handler.static FcSwitchDefaultHandlergetInstance()List<INodePrototypeDescriptor<FcSwitchDefaultProps>>getNodePrototypes(IGetNodePrototypesParams params)Returns a list of all node prototypes for this node type.Class<? extends INodePropertiesBean<FcSwitchDefaultProps>>getPropertiesBeanClass()Returns the class of the bean that should be used when editing the properties of a workflow element.URLgetPropertiesViewXhtml()This method must return the path to the XHTML page for the custom user interface.Set<String>getRelatedNodeTypes()Complex workflow elements may consist of several related node types.inthashCode()booleanisCreateProtocolEntryAfterExecution(boolean success)Controls 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 java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.xima.fc.interfaces.workflow.mixin.IBeanValidatingElement
getValidationGroups
-
Methods inherited from interface de.xima.fc.interfaces.workflow.mixin.IBeanValidatingNode
validateLocal
-
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, readEntityReferences, readPlaceholders, validateGlobal, writeEntityReferences, writePlaceholders
-
Methods inherited from interface de.xima.fc.interfaces.workflow.mixin.IExecutingLikeSequenceNode
createFlowGraph
-
Methods inherited from interface de.xima.fc.interfaces.workflow.execution.IExecutionResultDescriptor
getAlwaysValueDescriptor, getFileValueDescriptor, getSoftErrorValueDescriptor
-
Methods inherited from interface de.xima.fc.interfaces.workflow.nodes.INodeHandler
getLocalizedTypeName, 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.mixin.IResultlessNode
getErrorValueDescriptor, getSuccessValueDescriptor
-
-
-
-
Method Detail
-
execute
public INormalCompletionResult execute(INodeExecutionParams<FcSwitchDefaultProps> 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 useIWorkflowExecutionContext.executor().In case you throw any other exception other than the exceptions mentioned in the throws clause, it will be wrapped in a
NodeThrewException.- Specified by:
executein interfaceINodeHandler<FcSwitchDefaultProps>- 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 execution of the node could not be completed normally, see below.NodeThrewException- When the execution of the node could not be completed normally due to abnormal circumstances. When this exception is thrown, execution of the workflow is cancelled, unless an error handler has been defined (such as via a try-catch node).NodeReturnedException- When the execution of the node could not be completed normally due to a return statement. To end the execution of the workflow and return, throw this exception.
-
getBuiltinType
public EWorkflowNodeType getBuiltinType()
- Specified by:
getBuiltinTypein interfaceIBuiltinNodeType<FcSwitchDefaultProps>- Returns:
- The built-in node type.
-
getDataModelClass
public Class<FcSwitchDefaultProps> 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<FcSwitchDefaultProps,WorkflowNode>- Returns:
- The class corresponding to the type parameter
TData.
-
getNodePrototypes
public List<INodePrototypeDescriptor<FcSwitchDefaultProps>> getNodePrototypes(IGetNodePrototypesParams params)
Description copied from interface:INodeHandlerReturns 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:
getNodePrototypesin interfaceINodeHandler<FcSwitchDefaultProps>- 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.
nullis treated as an empty list.
-
getPropertiesBeanClass
public Class<? extends INodePropertiesBean<FcSwitchDefaultProps>> 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 required 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<FcSwitchDefaultProps,WorkflowNode>- Specified by:
getPropertiesBeanClassin interfaceINodeHandler<FcSwitchDefaultProps>- Returns:
- The class of the bean to use for editing a workflow node's properties.
- See Also:
IElementHandler.getPropertiesViewXhtml()
-
getPropertiesViewXhtml
public URL getPropertiesViewXhtml() throws MalformedURLException
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 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: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:newWorkflowProviding id="providing" value="#{model}" /> <!-- 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}"/>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<FcSwitchDefaultProps,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
-
getRelatedNodeTypes
public Set<String> getRelatedNodeTypes()
Description copied from interface:INodeHandlerComplex workflow elements may consist of several related node types. For example, a switch may consist of a switch node, a default case node, and a switch case node. This method should return such related node types (but not theIWorkflowElementTypeProviding.getType()itself. This is not a strict requirement, all features will still work even if this method returns an empty set. The result of this method is used e.g. to load the handlers for the related node types when the flowchart is loaded in the designer (otherwise they would be loaded dynamically once required).- Specified by:
getRelatedNodeTypesin interfaceINodeHandler<FcSwitchDefaultProps>- Returns:
- A list of related node types.
-
isCreateProtocolEntryAfterExecution
public boolean isCreateProtocolEntryAfterExecution(boolean success)
Description copied from interface:INodeHandlerControls whether a protocol entry is created after the node was executed.The default implementation always returns
true. May be set tofalsefor nodes such as flow control nodes (if-else, try-catch etc.).- Specified by:
isCreateProtocolEntryAfterExecutionin interfaceINodeHandler<FcSwitchDefaultProps>- Parameters:
success- Whether the action was executed successfully.- Returns:
trueto create a protocol entry, orfalseotherwise.
-
isValidChildCount
public boolean isValidChildCount(WorkflowNode node, int childCount)
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<FcSwitchDefaultProps>- 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
public boolean isValidChildType(WorkflowNode node, int childIndex, String nodeType)
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<FcSwitchDefaultProps>- 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
public boolean isValidParentType(WorkflowNode node, String nodeType)
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<FcSwitchDefaultProps>- 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
public static FcSwitchDefaultHandler getInstance()
- Returns:
- The immutable, stateless instance of this handler.
-
-