Class ResultActionFactory<T extends ResultAction>
java.lang.Object
com.inet.taskplanner.server.api.common.AbstractFactory<COMPONENT,DEFINITION,INFO,SUMMARY>
com.inet.taskplanner.server.api.common.SeriesDependentFactory<T,ResultActionDefinition,ResultActionInfo,SummaryInfo>
com.inet.taskplanner.server.api.action.ResultActionFactory<T>
- 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
-
Field Summary
Fields inherited from class com.inet.taskplanner.server.api.common.SeriesDependentFactory
PLACEHOLDER_END_CHARACTER, PLACEHOLDER_START_CHARACTER -
Constructor Summary
ConstructorsConstructorDescriptionResultActionFactory(String extensionName) Creates a new ResultActionFactory instance. -
Method Summary
Modifier and TypeMethodDescriptionabstract List<ResultFlavor>getSupportedFlavors(ResultActionDefinition definition) Returns the list offlavorssupported by this action for the given definition.booleanhasPlaceholderSet(String value, com.inet.id.GUID taskID) Returns whether the given value contains at least one of the available placeholders of the task.booleanDefines whether placeholders will be automatically replaced before the handle method is called.Methods inherited from class com.inet.taskplanner.server.api.common.SeriesDependentFactory
createFrom, getFirstValueFromSeries, patchDefinitionProperties, updateValues, updateValues, validateMethods inherited from class com.inet.taskplanner.server.api.common.AbstractFactory
checkDefinitionArgument, createInstanceFrom, createInstanceFrom, getExtensionName, getInformation, getSummary, isAvailable, validate
-
Constructor Details
-
ResultActionFactory
Creates a new ResultActionFactory instance.- Parameters:
extensionName- the unique name of the ResultAction this factory can produce.ResultActionDefinitionsfor this kind of action must have the same extensionName.- Since:
- taskplanner 3.0
-
-
Method Details
-
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
- 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
- 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.- Returns:
trueif the placeholders shall be resolve automatically,falseif the implementation needs to manage this by themself.- Since:
- taskplanner 3.0
-
hasPlaceholderSet
Returns whether the given value contains at least one of the available placeholders of the task.- Parameters:
value- the value to be checked for placeholderstaskID- 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
-