Class TimeTriggerFactory
- java.lang.Object
-
- com.inet.taskplanner.server.api.common.AbstractFactory<COMPONENT,DEFINITION,INFO,SUMMARY>
-
- com.inet.taskplanner.server.api.common.SeriesIndependentFactory<T,TriggerDefinition,TriggerInfo,SummaryInfo>
-
- com.inet.taskplanner.server.api.trigger.TriggerFactory<com.inet.taskplanner.server.api.trigger.time.TimeTrigger>
-
- com.inet.taskplanner.server.api.trigger.time.TimeTriggerFactory
-
- All Implemented Interfaces:
com.inet.plugin.NamedExtension
public class TimeTriggerFactory extends TriggerFactory<com.inet.taskplanner.server.api.trigger.time.TimeTrigger>
A task planner trigger that executes a task when the configured time settings apply- Since:
- taskplanner 3.0
- See Also:
TimeTrigger
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringEXTENSION_NAMEExtension name of the time trigger to use intriggerDefinitions.static java.lang.StringPROP_REPEAT_SELECTKey for the repeat-interval of this trigger.static java.lang.StringPROP_START_DAYKey for the start day which specifies the earliest day for the execution.static java.lang.StringPROP_START_TIMEKey for the start time which specifies at which hour and minute of the day this trigger will fire.static java.lang.StringPROP_WHICH_SELECTKey for the Monthly day setting, which determines on which day of the month this trigger fires.
-
Constructor Summary
Constructors Constructor Description TimeTriggerFactory()Creates a new TimeTriggerFactory instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.inet.taskplanner.server.api.trigger.time.TimeTriggercreateInstanceFrom(TriggerDefinition definition, com.inet.id.GUID taskID)Construct a component (PRODUCT) from the given definition.TriggerInfogetInformation(com.inet.id.GUID taskID)Returns an information object about components which can be produced with this factory.java.util.List<java.time.ZonedDateTime>getNextExecutionTimes(TriggerDefinition definition)Returns the calculated time of the next executions.SummaryInfogetSummary(TriggerDefinition definition)Construct Summary infos for the component represented by given definition.java.util.Map<java.lang.String,java.lang.String>updateValues(TriggerDefinition definition, com.inet.id.GUID taskID)Update values according to the give definition.voidvalidate(TriggerDefinition triggerDefinition, com.inet.id.GUID taskID)Validate the given definition.-
Methods inherited from class com.inet.taskplanner.server.api.common.SeriesIndependentFactory
createFrom
-
Methods inherited from class com.inet.taskplanner.server.api.common.AbstractFactory
checkDefinitionArgument, createInstanceFrom, getExtensionName, isAvailable
-
-
-
-
Field Detail
-
EXTENSION_NAME
public static final java.lang.String EXTENSION_NAME
Extension name of the time trigger to use intriggerDefinitions.- See Also:
- Constant Field Values
-
PROP_START_DAY
public static final java.lang.String PROP_START_DAY
Key for the start day which specifies the earliest day for the execution. The value must be a number with the milliseconds since 1st January 1970 GMT.- See Also:
- Constant Field Values
-
PROP_START_TIME
public static final java.lang.String PROP_START_TIME
Key for the start time which specifies at which hour and minute of the day this trigger will fire. The value must be a number with the milliseconds since 1st January 1970 GMT. Only hour and minute are used.- See Also:
- Constant Field Values
-
PROP_REPEAT_SELECT
public static final java.lang.String PROP_REPEAT_SELECT
Key for the repeat-interval of this trigger. Value must be a String representation of theRepeatIntervalenum or null.- See Also:
- Constant Field Values
-
PROP_WHICH_SELECT
public static final java.lang.String PROP_WHICH_SELECT
Key for the Monthly day setting, which determines on which day of the month this trigger fires. The value must be a string representation of theMonthlyDayenum.- See Also:
- Constant Field Values
-
-
Method Detail
-
createInstanceFrom
protected com.inet.taskplanner.server.api.trigger.time.TimeTrigger createInstanceFrom(TriggerDefinition definition, com.inet.id.GUID taskID)
Construct a component (PRODUCT) from the given definition.- Overrides:
createInstanceFromin classAbstractFactory<com.inet.taskplanner.server.api.trigger.time.TimeTrigger,TriggerDefinition,TriggerInfo,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
-
getInformation
public TriggerInfo getInformation(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 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.trigger.time.TimeTrigger,TriggerDefinition,TriggerInfo,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
-
updateValues
public java.util.Map<java.lang.String,java.lang.String> updateValues(TriggerDefinition definition, com.inet.id.GUID taskID)
Update values according to the give definition.The given definition is guaranteed to belong to this factory
- Overrides:
updateValuesin classSeriesIndependentFactory<com.inet.taskplanner.server.api.trigger.time.TimeTrigger,TriggerDefinition,TriggerInfo,SummaryInfo>- Parameters:
definition- the definition with the current propertiestaskID- the ID of the task the definition belongs or will belong to, for optional use- Returns:
- a map of property key with their values that have changed
-
validate
public void validate(TriggerDefinition triggerDefinition, com.inet.id.GUID taskID) throws ValidationException
Validate the given definition.The given definition is guaranteed to belong to this factory
- Specified by:
validatein classSeriesIndependentFactory<com.inet.taskplanner.server.api.trigger.time.TimeTrigger,TriggerDefinition,TriggerInfo,SummaryInfo>- Parameters:
triggerDefinition- 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
-
getSummary
public SummaryInfo getSummary(TriggerDefinition definition)
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.trigger.time.TimeTrigger,TriggerDefinition,TriggerInfo,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.
-
getNextExecutionTimes
public java.util.List<java.time.ZonedDateTime> getNextExecutionTimes(TriggerDefinition definition)
Returns the calculated time of the next executions. If the trigger is e.g. event based and does not provide a time,nullis returned. In case time based trigger is configured incorrectly or does not have any future executions, then an empty list is returned.- Overrides:
getNextExecutionTimesin classTriggerFactory<com.inet.taskplanner.server.api.trigger.time.TimeTrigger>- Parameters:
definition- the current definition where to get the next executions for- Returns:
- the calculated time of the next execution. Normally 3 future executions are returned, or less if there are not 3 more from now.
-
-