Class FcEmailHandler
- java.lang.Object
-
- de.xima.fc.workflow.designer.registry.nodes.FcEmailHandler
-
- All Implemented Interfaces:
IResourceBundleLocator
,IWorkflowNodeFlowAnalyzer<FcEmailProps>
,IElementHandler<FcEmailProps,WorkflowNode>
,IExecutionResultDescriptor
,ICustomParametersUpdateable
,IWorkflowElementTypeProviding
,IBeanValidatingElement<FcEmailProps,WorkflowNode>
,IBeanValidatingNode<FcEmailProps>
,IExecutingLikeActionNode<FcEmailProps>
,IHierarchyValidatingNode<FcEmailProps>
,IKeyValueSummarizableElement<FcEmailProps,WorkflowNode>
,IKeyValueSummarizableNode<FcEmailProps>
,IOfficialHelpPageElement<FcEmailProps,WorkflowNode>
,IOfficialHelpPageNode<FcEmailProps>
,ISemverUpdating<FcEmailProps,WorkflowNode>
,ISemverUpdatingNode<FcEmailProps>
,ISequentialUpdating<FcEmailProps,WorkflowNode,com.vdurmont.semver4j.Semver>
,ISingleElementPrototype<FcEmailProps,WorkflowNode>
,ISingleNodePrototype<FcEmailProps>
,INodeHandler<FcEmailProps>
,IWorkflowNodeTypeProviding
,IListenerRegistrator
,IOrderable
,ISingleBaseActionBuiltinNodePrototype<FcEmailProps>
,ISingleBuiltinNodePrototype<FcEmailProps>
,IBuiltinResourcesHandler<FcEmailProps,WorkflowNode>
,IBaseActionNode<FcEmailProps>
,IBuiltinNodeType<FcEmailProps>
,ISingleBaseActionNodePrototype<FcEmailProps>
,IFcEmailDescriptors
,Comparable<IOrderable>
@Immutable public final class FcEmailHandler extends Object implements INodeHandler<FcEmailProps>, IBaseActionNode<FcEmailProps>, IBuiltinNodeType<FcEmailProps>, IBuiltinResourcesHandler<FcEmailProps,WorkflowNode>, IExecutingLikeActionNode<FcEmailProps>, ISemverUpdatingNode<FcEmailProps>, IFcEmailDescriptors, IKeyValueSummarizableNode<FcEmailProps>, ISingleBaseActionBuiltinNodePrototype<FcEmailProps>
TheINodeHandler
for nodes of typeEWorkflowNodeType.FC_EMAIL
.- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
-
-
Field Summary
-
Fields inherited from interface de.xima.fc.interfaces.workflow.elements.IElementHandler
CURRENT_HANDLER_VERSION
-
Fields inherited from interface de.xima.fc.workflow.retval.node.IFcEmailDescriptors
ATTR_CONTENT, ATTR_FILE_SIZE, ATTR_MAILS, ATTR_MAILS_BCC, ATTR_MAILS_CC, ATTR_MAILS_SUBJECT, ATTR_MAILS_TO, ATTR_USER_NOT_FOUND_USERS, ATTR_USER_NOT_FOUND_USERS_ID, ATTR_USER_NOT_FOUND_USERS_NAME, ATTR_USER_NOT_FOUND_USERS_TYPE, ATTR_USER_NOT_FOUND_USERS_TYPE_USER_DIRECT, ATTR_USER_NOT_FOUND_USERS_TYPE_USER_INDIRECT, ATTR_USER_NOT_FOUND_USERS_TYPE_USER_INDIRECT_LOOKUP_ENTRIES, ATTR_USER_NOT_FOUND_USERS_TYPE_USER_INDIRECT_LOOKUP_ENTRIES_NAME
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
INormalCompletionResult
execute(INodeExecutionParams<FcEmailProps> params)
Executes the given workflow node.EWorkflowNodeType
getBuiltinType()
Class<FcEmailProps>
getDataModelClass()
Returns the class of the custom properties used by the elements handled by this element logic handler.ISummaryKeyValueModel
getElementSummaryKeyValueModel(IGetElementSummaryParams<FcEmailProps> params)
static FcEmailHandler
getInstance()
IElementCategory
getMainCategory(IGetElementPrototypesParams params)
Class<? extends INodePropertiesBean<FcEmailProps>>
getPropertiesBeanClass()
Returns the class of the bean that should be used when editing the properties of a workflow element.URL
getPropertiesViewXhtml()
This method must return the path to the XHTML page for the custom user interface.FcEmailProps
getPrototypeModelData(String label, IGuiIcon icon, IGetElementPrototypesParams params)
This default implementation returns a new instance of theTData
properties model, prefilled with the label and icon (BaseActionProps.getName()
andBaseActionProps.getIcon()
).IElementCategory
getSubCategory(IGetElementPrototypesParams params)
Optional sub category.Map<com.vdurmont.semver4j.Semver,IUpdateTransition>
getTransitions()
A map from the version where an update is required to that update.int
hashCode()
boolean
isAvailable(IIsAvailableParams<FcEmailProps> params)
Checks whether this workflow element is available to the given client.IWorkflowElementValidationResult
validateLocal(IElementLocalValidationParams<FcEmailProps,WorkflowNode> params)
Performs a local validation of the given workflow workflow element properties.-
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.IBaseActionNode
isValidChildCount, isValidChildType, isValidParentType
-
Methods inherited from interface de.xima.fc.interfaces.workflow.mixin.IBeanValidatingElement
getValidationGroups
-
Methods inherited from interface de.xima.fc.workflow.mixin.IBuiltinNodeType
getOfficialHelpPagePath, getType, register
-
Methods inherited from interface de.xima.fc.workflow.designer.registry.IBuiltinResourcesHandler
getCascadingStyleSheet, getJavaScript
-
Methods inherited from interface de.xima.fc.interfaces.workflow.elements.IElementHandler
extractDescription, extractName, extractSearchTerms, getCascadingStyleSheet, getDisplayLabel, getFastJsonConverter, getFilterCriteriaForEntities, getJavaScript, getResourceBundle, getVersion, isHasUserVisibleName, readEntityReferences, readPlaceholders, validateGlobal, writeEntityReferences, writePlaceholders
-
Methods inherited from interface de.xima.fc.interfaces.workflow.mixin.IExecutingLikeActionNode
createFlowGraph
-
Methods inherited from interface de.xima.fc.interfaces.workflow.execution.IExecutionResultDescriptor
getAlwaysValueDescriptor
-
Methods inherited from interface de.xima.fc.workflow.retval.node.IFcEmailDescriptors
getAttachmentValueDescriptor, getErrorValueDescriptor, getFileValueDescriptor, getSoftErrorValueDescriptor, getSuccessValueDescriptor
-
Methods inherited from interface de.xima.fc.interfaces.workflow.mixin.IKeyValueSummarizableElement
getElementSummaryModel, getElementSummaryXhtml
-
Methods inherited from interface de.xima.fc.interfaces.workflow.nodes.INodeHandler
getLocalizedTypeName, getRelatedNodeTypes, isCreateProtocolEntryAfterExecution, 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.mixin.ISemverUpdating
parseVersion
-
Methods inherited from interface de.xima.fc.interfaces.workflow.mixin.ISequentialUpdating
updateCustomParams
-
Methods inherited from interface de.xima.fc.workflow.mixin.ISingleBaseActionNodePrototype
getThemeColor
-
Methods inherited from interface de.xima.fc.workflow.designer.mixin.ISingleBuiltinNodePrototype
getPrototypeIcon, getPrototypeLabel, getPrototypeSearchText, getPrototypeSortKey, getPrototypeSubLabel, getPrototypeTitle
-
Methods inherited from interface de.xima.fc.interfaces.workflow.mixin.ISingleElementPrototype
getPrototypeTags
-
Methods inherited from interface de.xima.fc.interfaces.workflow.mixin.ISingleNodePrototype
getNodePrototypes, getPrototypeElement
-
-
-
-
Method Detail
-
execute
public INormalCompletionResult execute(INodeExecutionParams<FcEmailProps> 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 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:
execute
in interfaceINodeHandler<FcEmailProps>
- 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:
getBuiltinType
in interfaceIBuiltinNodeType<FcEmailProps>
- Returns:
- The built-in node type.
-
getDataModelClass
public Class<FcEmailProps> 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<FcEmailProps,WorkflowNode>
- Returns:
- The class corresponding to the type parameter
TData
.
-
getElementSummaryKeyValueModel
public ISummaryKeyValueModel getElementSummaryKeyValueModel(IGetElementSummaryParams<FcEmailProps> params)
- Specified by:
getElementSummaryKeyValueModel
in interfaceIKeyValueSummarizableElement<FcEmailProps,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.
-
getMainCategory
public IElementCategory getMainCategory(IGetElementPrototypesParams params)
- Specified by:
getMainCategory
in interfaceISingleElementPrototype<FcEmailProps,WorkflowNode>
- Parameters:
params
- Parameters with the current client, locale, entity context etc.- Returns:
IElementCategory
element's main category, which is used for grouping the elements.
-
getPropertiesBeanClass
public Class<? extends INodePropertiesBean<FcEmailProps>> getPropertiesBeanClass()
Description copied from interface:IElementHandler
Returns the class of the bean that should be used when editing the properties of a workflow element. May benull
if 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:
getPropertiesBeanClass
in interfaceIElementHandler<FcEmailProps,WorkflowNode>
- Specified by:
getPropertiesBeanClass
in interfaceINodeHandler<FcEmailProps>
- 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: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: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}"/>
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<FcEmailProps,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
-
getPrototypeModelData
public FcEmailProps getPrototypeModelData(String label, IGuiIcon icon, IGetElementPrototypesParams params)
Description copied from interface:ISingleBaseActionNodePrototype
This default implementation returns a new instance of theTData
properties model, prefilled with the label and icon (BaseActionProps.getName()
andBaseActionProps.getIcon()
). All other fields remain at their default values.This method assumes that the
TData
type possesses a public no-arg constructor. If it does not, you will need to override this method and create the instance yourself. Otherwise, you can also override this method, callsuper
, and add additional defaults - but make sure JSON deserialization can still create an instance as well, such as viaJSONCreator
.- Specified by:
getPrototypeModelData
in interfaceISingleBaseActionNodePrototype<FcEmailProps>
- Specified by:
getPrototypeModelData
in interfaceISingleElementPrototype<FcEmailProps,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).
- See Also:
ISingleElementPrototype.getPrototypeModelData(String, IGuiIcon, IGetElementPrototypesParams)
-
getSubCategory
public IElementCategory getSubCategory(IGetElementPrototypesParams params)
Description copied from interface:ISingleElementPrototype
Optional sub category. When not set or this returnsnull
, the element is shown under the categorymiscellaneous
.- Specified by:
getSubCategory
in interfaceISingleElementPrototype<FcEmailProps,WorkflowNode>
- Parameters:
params
- Parameters with the current client, locale, entity context etc.- Returns:
IElementCategory
element's sub category, which is used for grouping the element within the given main group.
-
getTransitions
public Map<com.vdurmont.semver4j.Semver,IUpdateTransition> getTransitions()
Description copied from interface:ISequentialUpdating
A map from the version where an update is required to that update. For example, if the properties model needs to be updated in version1.1.7
,1.3.4
, and2.2.0
, the returned map should have one entry for each of these three versions.- Specified by:
getTransitions
in interfaceISequentialUpdating<FcEmailProps,WorkflowNode,com.vdurmont.semver4j.Semver>
- Returns:
- A map from the version to the update for that version.
-
isAvailable
public boolean isAvailable(IIsAvailableParams<FcEmailProps> params)
Description copied from interface:IElementHandler
Checks whether this workflow element is available to the given client. If this returnfalse
, this action cannot be used in the workflow designer. When attempting to execute a workflow with an unavailable action, an error of typeNODE_UNAVAILABLE
is thrown. The default implementation always returnstrue
.- Specified by:
isAvailable
in interfaceIBuiltinNodeType<FcEmailProps>
- Specified by:
isAvailable
in interfaceIElementHandler<FcEmailProps,WorkflowNode>
- Parameters:
params
- The node's data, the entity context, and the current client.- Returns:
- Whether the workflow element is available to the given client.
-
validateLocal
public IWorkflowElementValidationResult validateLocal(IElementLocalValidationParams<FcEmailProps,WorkflowNode> params) throws WorkflowValidationException
Description copied from interface:IElementHandler
Performs a local validation of the given workflow workflow element properties. This method should only validate the properties of the given workflow element, without respect to any other workflow elements.This method allows you to implement custom validation logic. Consider using
IBeanValidatingElement
and annotating your properties model class with the annotation from the bean annotation APIjavax.validation
. This also offers the advantage that it can be integrated into JSF, allowing you to use the same validations for the UI view as well.- Specified by:
validateLocal
in interfaceIBaseActionNode<FcEmailProps>
- Specified by:
validateLocal
in interfaceIBeanValidatingElement<FcEmailProps,WorkflowNode>
- Specified by:
validateLocal
in interfaceIBeanValidatingNode<FcEmailProps>
- Specified by:
validateLocal
in interfaceIElementHandler<FcEmailProps,WorkflowNode>
- Specified by:
validateLocal
in interfaceIHierarchyValidatingNode<FcEmailProps>
- Parameters:
params
- The properties to validate. Also provides access to the project, client etc.- Returns:
- The result of the validation, i.e. whether the workflow element is valid, and a list of messages to display
to the user. If this returns, this is treated as if a valid result without messages had been returned. You may use
use params.
getValidationContext()
.resultBuilder()
to create the result, or implement the interface yourself. To indicate that the validation was performed, but no validation constraints were violated, simply callbuild
on the result builder and return that, without adding any messages. - Throws:
WorkflowValidationException
- When the validation could not be performed. Please note that this is meant for unexpected errors only - you should not throw an exception if a workflow element is simply just invalid.
-
getInstance
public static FcEmailHandler getInstance()
- Returns:
- The singleton instance of this handler.
-
-