Class ResultActionFactory<T extends ResultAction>

Type Parameters:
T - the concrete type of the Job implementation
All Implemented Interfaces:
com.inet.plugin.NamedExtension
Direct Known Subclasses:
EmailResultActionFactory

public abstract class ResultActionFactory<T extends ResultAction> extends SeriesDependentFactory<T,ResultActionDefinition,ResultActionInfo,SummaryInfo>
Base class for factories producing ResultAction components.

           ResultActionDefinition ----> ResultActionFactory ----> ResultAction
 

See documentation of AbstractFactory for more information about the life cycle.

When a factory is implemented, use ServerPluginManager.register(Class, Object) with ResultActionFactory.class as first argument:

spm.register(ResultActionFactory.class, new RabbitActionFactory());

Implementations sample: because the extensionName must be unique and must be used when a ResultActionDefinition is created by API, it is recommended to set up a public constant with the extensionName:


 public class RabbitActionFactory extends RabbitActionFactory<RabbitAction> {
      public static final String EXTENSION_NAME = "resultAction.rabbit";

      public RabbitActionFactory(){
          super(EXTENSION_NAME);
      }


      @Override
      protected RabbitAction createInstanceFrom( ResultActionDefinition definition, GUID taskID ) {
          RabbitAction action = new RabbitAction();
          //put values from definition to RabbitAction impl
          ...

          return action;
      }

      ...
      //somewhere using public API
      ResultActionDefinition rabbitAction = new ResultActionDefinition(RabbitActionFactory.EXTENSION_NAME);
      //configure it
      ...

 
Since:
taskplanner 3.0
  • Constructor Details

    • ResultActionFactory

      public ResultActionFactory(String extensionName)
      Creates a new ResultActionFactory instance.
      Parameters:
      extensionName - the unique name of the ResultAction this factory can produce. ResultActionDefinitions for this kind of action must have the same extensionName.
      Since:
      taskplanner 3.0
  • Method Details

    • getSupportedFlavors

      public abstract 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) 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.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
      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.
      Since:
      taskplanner 3.0
    • 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 will ask all fields, defined by the factory, to resolve all placeholders that match a field key and supports placeholders.

      For manual replacement, the PlaceholderResolver can be used.
      Returns:
      true if the placeholders shall be resolve automatically, false if the implementation needs to manage this by themself.
      Since:
      taskplanner 3.0
    • hasPlaceholderSet

      public boolean hasPlaceholderSet(String value, com.inet.id.GUID taskID)
      Returns whether the given value contains at least one of the available placeholders of the task.
      Parameters:
      value - the value to be checked for placeholders
      taskID - the unique ID of the task containing the current action
      Returns:
      true if the value contains at least one placeholder, false otherwise
      Since:
      taskplanner 3.0