Class EmailResultActionFactory

java.lang.Object
com.inet.taskplanner.server.api.common.AbstractFactory<com.inet.taskplanner.server.api.action.email.EmailResultAction, ResultActionDefinition, ResultActionInfo, SummaryInfo>
com.inet.taskplanner.server.api.common.SeriesDependentFactory<com.inet.taskplanner.server.api.action.email.EmailResultAction, ResultActionDefinition, ResultActionInfo, SummaryInfo>
com.inet.taskplanner.server.api.action.ResultActionFactory<com.inet.taskplanner.server.api.action.email.EmailResultAction>
com.inet.taskplanner.server.api.action.email.EmailResultActionFactory
All Implemented Interfaces:
com.inet.plugin.NamedExtension

public class EmailResultActionFactory extends ResultActionFactory<com.inet.taskplanner.server.api.action.email.EmailResultAction>
A result action factory for managing EmailResultAction settings and instances.
  • Field Details

  • Constructor Details

    • EmailResultActionFactory

      public EmailResultActionFactory()
      Creates an instance of the factory.
      Since:
      taskplanner 3.0
  • Method Details

    • getInformation

      public ResultActionInfo getInformation(@Nullable com.inet.id.GUID taskID)
      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 Task Planner web GUI. This includes display information and available configuration options. The returned information contains fields that describe the values a user can specify in the web GUI. The fields are also responsible for replacing placeholders for the corresponding property in a serial task. That means properties without a field definition will not get any series placeholder replaced.

      If you implement a factory for a component used only through the API, you can return null here.

      Specified by:
      getInformation in class AbstractFactory<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 ResultActionDefinition definition, @Nullable com.inet.id.GUID taskID) throws ValidationException
      Validate the given definition.

      The given definition is guaranteed to belong to this factory

      Specified by:
      validate in class AbstractFactory<com.inet.taskplanner.server.api.action.email.EmailResultAction, ResultActionDefinition, ResultActionInfo, SummaryInfo>
      Parameters:
      definition - the definition to validate
      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.
      Throws:
      ValidationException - if the component has some errors
    • createInstanceFrom

      protected com.inet.taskplanner.server.api.action.email.EmailResultAction createInstanceFrom(@Nullable ResultActionDefinition definition, @Nullable com.inet.id.GUID taskID)
      Constructs a component (PRODUCT) from the given definition.
      Overrides:
      createInstanceFrom in class AbstractFactory<com.inet.taskplanner.server.api.action.email.EmailResultAction, ResultActionDefinition, ResultActionInfo, SummaryInfo>
      Parameters:
      definition - the definition holding information for the PRODUCT
      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:
      a new PRODUCT
    • getSummary

      public SummaryInfo getSummary(@Nullable ResultActionDefinition definition)
      Constructs summary information for the component represented by the given definition.

      The summary information is used when the web GUI displays the component.

      When implementing a factory for a component to be used only through the API, you can return null here.

      Specified by:
      getSummary in class AbstractFactory<com.inet.taskplanner.server.api.action.email.EmailResultAction, ResultActionDefinition, ResultActionInfo, SummaryInfo>
      Parameters:
      definition - the definition with the settings made by a user
      Returns:
      summary information containing text lines to be displayed in the web GUI for this component.
    • getSupportedFlavors

      public List<ResultFlavor> getSupportedFlavors(ResultActionDefinition definition)
      Returns the list of flavors supported by this action for the given definition. This method determines which types of results (created by a Job) 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.NONE if 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.FILE if file attachments are enabled)
      • Return all flavors your action can potentially handle - the system will filter results automatically
      Specified by:
      getSupportedFlavors in class ResultActionFactory<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 currently supported according to the given definition Never returns null, but may return an empty list.
    • isAutoResolvePlaceholders

      public boolean isAutoResolvePlaceholders()
      Defines whether placeholders will be automatically replaced before the handle method is called. The default implementation returns true.
      The automatic replacement asks all fields defined by the factory to resolve placeholders that match a field key and are supported by that field.

      For manual replacement, the PlaceholderResolver can be used.
      Overrides:
      isAutoResolvePlaceholders in class ResultActionFactory<com.inet.taskplanner.server.api.action.email.EmailResultAction>
      Returns:
      true if the placeholders shall be resolved automatically, false if the implementation needs to manage them itself.
    • patchDefinitionProperties

      protected ResultActionDefinition patchDefinitionProperties(@Nonnull ResultActionDefinition baseDefinition, @Nonnull Map<String,String> seriesProperties, @Nullable com.inet.id.GUID taskID)
      Patches the properties of the given base definition with properties from the series properties.

      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. For example, {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:
      patchDefinitionProperties in class SeriesDependentFactory<com.inet.taskplanner.server.api.action.email.EmailResultAction, ResultActionDefinition, ResultActionInfo, SummaryInfo>
      Parameters:
      baseDefinition - original definition from the model; this one will not be changed
      seriesProperties - properties from the current series set
      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:
      a new definition with patched properties