Class EmailResultActionFactory
- All Implemented Interfaces:
com.inet.plugin.NamedExtension
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe extension name used to create aResultActionDefinition.static final StringThe attachment property used to create aResultActionDefinition.static final StringThe BCC property used to create aResultActionDefinition.static final StringThe CC property used to create aResultActionDefinition.static final StringThe message property used to create aResultActionDefinition.static final Stringproperty for whether to treat PROP_MESSAGE as plaintext or not (i.e.static final StringThe receiver property used to create aResultActionDefinition.static final StringThe optional sender/from address property used to create aResultActionDefinition"static final StringThe subject property used to create aResultActionDefinition.static final StringThe format of the file names.Fields inherited from class com.inet.taskplanner.server.api.common.SeriesDependentFactory
PLACEHOLDER_END_CHARACTER, PLACEHOLDER_START_CHARACTER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected com.inet.taskplanner.server.api.action.email.EmailResultActioncreateInstanceFrom(@Nullable ResultActionDefinition definition, @Nullable com.inet.id.GUID taskID) Construct a component (PRODUCT) from the given definition.getInformation(@Nullable com.inet.id.GUID taskID) Returns an information object about components which can be produced with this factory.getSummary(@Nullable ResultActionDefinition definition) Construct Summary infos for the component represented by given definition.getSupportedFlavors(ResultActionDefinition definition) Returns the list offlavorssupported by this action for the given definition.booleanDefines whether placeholders will be automatically replaced before the handle method is called.protected ResultActionDefinitionpatchDefinitionProperties(@Nonnull ResultActionDefinition baseDefinition, @Nonnull Map<String, String> seriesProperties, @Nullable com.inet.id.GUID taskID) Patch the properties of the given baseDefinition with properties from the seriesProperties.voidvalidate(@Nonnull ResultActionDefinition definition, @Nullable com.inet.id.GUID taskID) Validate the given definition.Methods inherited from class com.inet.taskplanner.server.api.action.ResultActionFactory
hasPlaceholderSetMethods inherited from class com.inet.taskplanner.server.api.common.SeriesDependentFactory
createFrom, getFirstValueFromSeries, updateValues, updateValues, validateMethods inherited from class com.inet.taskplanner.server.api.common.AbstractFactory
checkDefinitionArgument, createInstanceFrom, getExtensionName, isAvailable
-
Field Details
-
EXTENSION_NAME
The extension name used to create aResultActionDefinition.- See Also:
-
PROP_SUBJECT
The subject property used to create aResultActionDefinition.- See Also:
-
PROP_PLAINTEXT
property for whether to treat PROP_MESSAGE as plaintext or not (i.e. HTML)- See Also:
-
PROP_MESSAGE
The message property used to create aResultActionDefinition. Treated as plain text if PROP_PLAINTEXT is true, else HTML.- See Also:
-
PROP_RECEIVER
The receiver property used to create aResultActionDefinition. A semicolon separated list of email addresses.- See Also:
-
PROP_CC
The CC property used to create aResultActionDefinition. A semicolon separated list of email addresses.- See Also:
-
PROP_BCC
The BCC property used to create aResultActionDefinition. A semicolon separated list of email addresses.- See Also:
-
PROP_ATTACH_FILES
The attachment property used to create aResultActionDefinition. Valid values are "true" or "false".- See Also:
-
PROPERTY_FILENAME_FORMAT
The format of the file names. Default is "[filename] [date] [time]"- See Also:
-
PROP_SENDER
The optional sender/from address property used to create aResultActionDefinition"- See Also:
-
-
Constructor Details
-
EmailResultActionFactory
public EmailResultActionFactory()Creates a instance of the factory.- Since:
- taskplanner 3.0
-
-
Method Details
-
getInformation
Returns an information object about components which can be produced with this factory.The returned info contains information about how such a component is to be presented in the taskPlanner GUI. This are display-infos or available options to configure. The returned information contains
fieldswhich describes the values a user can specify in the WEB GUI. The field is also responsible to replace any placeholders for the corresponding property in aserialtask. That means properties without a field definition will not get any series placeholder replaced.If you implement a factory for a component only to be used by API, only then you can return null here.
- Specified by:
getInformationin classAbstractFactory<com.inet.taskplanner.server.api.action.email.EmailResultAction,ResultActionDefinition, ResultActionInfo, SummaryInfo> - Parameters:
taskID- the ID of the task the definition belongs or will belong to, for optional use. Can be null if the operation is done for a non-saved task.- Returns:
- an information object for components this factory can produce
-
validate
public void validate(@Nonnull @Nonnull ResultActionDefinition definition, @Nullable @Nullable com.inet.id.GUID taskID) throws ValidationException Validate the given definition.The given definition is guaranteed to belong to this factory
- Specified by:
validatein classAbstractFactory<com.inet.taskplanner.server.api.action.email.EmailResultAction,ResultActionDefinition, ResultActionInfo, SummaryInfo> - Parameters:
definition- the definition to validatetaskID- the ID of the task the definition belongs or will belong to, for optional use. Can be null if the operation is done for a non-saved task.- Throws:
ValidationException- if the component has some errors
-
createInstanceFrom
protected com.inet.taskplanner.server.api.action.email.EmailResultAction createInstanceFrom(@Nullable @Nullable ResultActionDefinition definition, @Nullable @Nullable com.inet.id.GUID taskID) Construct a component (PRODUCT) from the given definition.- Overrides:
createInstanceFromin classAbstractFactory<com.inet.taskplanner.server.api.action.email.EmailResultAction,ResultActionDefinition, ResultActionInfo, SummaryInfo> - Parameters:
definition- the definition holding information for the PRODUCTtaskID- the ID of the task the definition belongs or will belong to, for optional use. Can be null if the operation is done for a non-saved task.- Returns:
- a new PRODUCT
-
getSummary
Construct Summary infos for the component represented by given definition.The summary info is used when the webgui displays the component.
When implementing a factory for a component only to be used per API, only then you can return null here.
- Specified by:
getSummaryin classAbstractFactory<com.inet.taskplanner.server.api.action.email.EmailResultAction,ResultActionDefinition, ResultActionInfo, SummaryInfo> - Parameters:
definition- the definition with the settings made by a user- Returns:
- summary infos containing text lines to be displayed in the webgui for this component.
-
getSupportedFlavors
Returns the list offlavorssupported by this action for the given definition. This method determines which types ofresults(created by aJob) that this action can process, potentially based on the action's configuration.Important: The system will only pass results to this action if the result's flavor (as returned by
Result.getFlavors()) matches one of the flavors returned by this method.Examples:
- Email Action: Returns
[ResultFlavor.FILE, ResultFlavor.TEXT, ResultFlavor.NONE]because it can attach files, include text in the message body, and send emails even without results - File Save Action: Returns
[ResultFlavor.FILE]because it can only save file-type results
Common Patterns:
- Always include
ResultFlavor.NONEif your action should execute even when no matching results are present - Make the returned list conditional on the action's configuration (e.g., only return
ResultFlavor.FILEif file attachments are enabled) - Return all flavors your action can potentially handle - the system will filter results automatically
- Specified by:
getSupportedFlavorsin classResultActionFactory<com.inet.taskplanner.server.api.action.email.EmailResultAction>- Parameters:
definition- the current definition settings, which may affect which flavors are supported- Returns:
- the list of result flavors that are currently supported according to the given definition. Never returns null, but may return an empty list.
- Email Action: Returns
-
isAutoResolvePlaceholders
public boolean isAutoResolvePlaceholders()Defines whether placeholders will be automatically replaced before the handle method is called. The default implementation returnstrue.
The automatic replacement will ask all fields, defined by the factory, to resolve all placeholders that match a field key and supports placeholders.
For manual replacement, thePlaceholderResolvercan be used.- Overrides:
isAutoResolvePlaceholdersin classResultActionFactory<com.inet.taskplanner.server.api.action.email.EmailResultAction>- Returns:
trueif the placeholders shall be resolve automatically,falseif the implementation needs to manage this by themself.
-
patchDefinitionProperties
protected ResultActionDefinition patchDefinitionProperties(@Nonnull @Nonnull ResultActionDefinition baseDefinition, @Nonnull @Nonnull Map<String, String> seriesProperties, @Nullable @Nullable com.inet.id.GUID taskID) Patch the properties of the given baseDefinition with properties from the seriesProperties.Patch and Replacement:
Properties from seriesProperties will overwrite properties with the same name from the definition. Other new properties are added.
Placeholders in the properties will be replaced. Sth like {path} will be replaced with the value of a property 'path'. If no property 'path' exists then the placeholder is replaced with empty string.- Overrides:
patchDefinitionPropertiesin classSeriesDependentFactory<com.inet.taskplanner.server.api.action.email.EmailResultAction,ResultActionDefinition, ResultActionInfo, SummaryInfo> - Parameters:
baseDefinition- original definition from the model, this one will not be changedseriesProperties- properties from the current series settaskID- the ID of the task the definition belongs or will belong to, for optional use. Can be null if the operation is done for a non-saved task.- Returns:
- a new Definition with patched properties
-