Class TimeTriggerForCustomSettings
java.lang.Object
com.inet.taskplanner.server.api.trigger.time.AbstractTimeTrigger
com.inet.taskplanner.server.api.trigger.time.TimeTriggerForCustomSettings
- All Implemented Interfaces:
Trigger
public class TimeTriggerForCustomSettings
extends com.inet.taskplanner.server.api.trigger.time.AbstractTimeTrigger
Trigger implementation for the
CUSTOM
settings of the time trigger.
As there is only one trigger in the GUi and configuration, the TimeTriggerFactory
will
validate and create this kind of trigger in addition to the normal TimeTrigger
.
As this is only indirectly supported in the public api, there is no Builder for this trigger. Use
TimeTrigger
with TimeTriggerBuilder
whenever possible.
- Since:
- taskplanner 22.4
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.inet.taskplanner.server.api.trigger.Trigger
Trigger.TriggerAction
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
On the [cardinality] daystatic final int
On the [cardinality] weekday (Mo-Fr)static final int
Daily rhythmstatic final int
Monthly rhythmstatic final int
Weekly rhythmstatic final String
Every X weeks/days/months.static final String
static final String
At which day (1st, 2nd, last etc).static final String
At which day to execute for monthly repetition.static final String
At which day of week.Fields inherited from class com.inet.taskplanner.server.api.trigger.time.AbstractTimeTrigger
NUM_OF_NEXT_EXECUTION_DATES
-
Constructor Summary
ConstructorsConstructorDescriptionTimeTriggerForCustomSettings
(TriggerDefinition definition) Create the trigger for given definition -
Method Summary
Modifier and TypeMethodDescriptionprotected Optional<ZonedDateTime>
calculateNextExecutionTime
(ZonedDateTime lastExecutiontime) static String
generateNiceReadableSentenceForExecution
(ZonedDateTime startDate, String localizedStartTime, TriggerDefinition definition) FOR INTERNAL USE ONLY.static int
getCardinalityFromSetting
(ZonedDateTime startDate, MonthlyDay monthlyCardinality) FOR INTERNAL USE ONLY.static List<ZonedDateTime>
getNextExecutionDates
(TriggerDefinition definition) FOR INTERNAL USE ONLY.protected String
Methods inherited from class com.inet.taskplanner.server.api.trigger.time.AbstractTimeTrigger
activate, deactivate, runAction, schedule, triggerAction
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.inet.taskplanner.server.api.trigger.Trigger
activate, clearState
-
Field Details
-
PROP_CUSTOM_INTERVALTYPE
- See Also:
-
INTERVALTYPE_DAILY
public static final int INTERVALTYPE_DAILYDaily rhythm- See Also:
-
INTERVALTYPE_WEEKLY
public static final int INTERVALTYPE_WEEKLYWeekly rhythm- See Also:
-
INTERVALTYPE_MONTHLY
public static final int INTERVALTYPE_MONTHLYMonthly rhythm- See Also:
-
PROP_CUSTOM_INTERVAL
Every X weeks/days/months. Must be 1 or greater.- See Also:
-
PROP_CUSTOM_WEEKLY_DAYOFWEEK
At which day of week. TypeDayOfWeek
.- See Also:
-
PROP_CUSTOM_MONTHLY_CARDINALITY
At which day (1st, 2nd, last etc).Type=
MonthlyDay
. This exists in conjunction withPROP_CUSTOM_MONTHLY_DAY_OF_MONTH
.- See Also:
-
PROP_CUSTOM_MONTHLY_DAY_OF_MONTH
At which day to execute for monthly repetition. Exists in conjunction withPROP_CUSTOM_MONTHLY_CARDINALITY
.Type=int, where the DaysOfWeek are equals to the number in
DayOfWeek
(Monday=1,Sunday=7), plusCUSTOM_MONTHLY_DAY_DAY
andCUSTOM_MONTHLY_DAY_WEEKDAY
are possible values.- See Also:
-
CUSTOM_MONTHLY_DAY_DAY
public static final int CUSTOM_MONTHLY_DAY_DAYOn the [cardinality] day- See Also:
-
CUSTOM_MONTHLY_DAY_WEEKDAY
public static final int CUSTOM_MONTHLY_DAY_WEEKDAYOn the [cardinality] weekday (Mo-Fr)- See Also:
-
-
Constructor Details
-
TimeTriggerForCustomSettings
Create the trigger for given definition- Parameters:
definition
- definition with settings for custom repeat.- Since:
- taskplanner 22.4
-
-
Method Details
-
calculateNextExecutionTime
- Specified by:
calculateNextExecutionTime
in classcom.inet.taskplanner.server.api.trigger.time.AbstractTimeTrigger
-
getTriggerDescribingStringForLog
- Specified by:
getTriggerDescribingStringForLog
in classcom.inet.taskplanner.server.api.trigger.time.AbstractTimeTrigger
-
getCardinalityFromSetting
FOR INTERNAL USE ONLY. get the cardinality setting (the nTh value) as int which we will then count down.- Parameters:
startDate
- start date setting (INITIAL)monthlyCardinality
- cardinality setting- Returns:
- the value
-
getNextExecutionDates
FOR INTERNAL USE ONLY. Get some next execution dates.- Parameters:
definition
- settings of the trigger- Returns:
- the dates, empty if is invalid
-
generateNiceReadableSentenceForExecution
public static String generateNiceReadableSentenceForExecution(ZonedDateTime startDate, String localizedStartTime, TriggerDefinition definition) FOR INTERNAL USE ONLY. Generate a nice sentence for custom time settings.- Parameters:
startDate
- start Date of the triggerlocalizedStartTime
- localized string with hour/minute of execution.definition
- the trigger definition settings- Returns:
- the string
- Throws:
IllegalArgumentException
- if settings are invalid
-