Class ScheduleSettings<T extends Help>
Object
ScheduleSettings<T>
- All Implemented Interfaces:
Help
This action is helping you to get an information about schedule as seen in the UI + if needed alter it.
This sample is showing how to change original schedule interval of 10 minutes (as defined in UI), to 2 minute interval and back. Running this element in CF logic would run CF in intervals START, 2, 8, 2, 8, 2, ..... → original 10 minute interval is intact, we are putting in there another 2 minute interval.
This sample is showing how to change original schedule interval of 10 minutes (as defined in UI), to 2 minute interval and back. Running this element in CF logic would run CF in intervals START, 2, 8, 2, 8, 2, ..... → original 10 minute interval is intact, we are putting in there another 2 minute interval.
api.retainGlobal = true
// Schedules are: original interval, 2 minutes interval, original interval, 2 minutes interval, original interval
// let's say the original interval is 10 minutes and start at 9:34 then the
// sequence of schedules will be: 9:44, 9:46, 9:54, 9:56, 10:04, 10:06, 10:14
// you see that the 10 minute interval is kept, with one run inside that interval
def sharedState = api.global
if (sharedState.condititionMet) {
// switching from original schedule per each run to 2 minut schedule
sharedState.condititionMet = false
def settings = actionBuilder.getScheduleSettings()
// make note of original schedule
sharedState.startingDate = settings.getStartingDate()
sharedState.numberOfTimeUnits = settings.getNumberOfTimeUnits()
settings.setNewNumberOfTimeUnits(2)
} else {
// switching from 2 minute schedule to original schedule
sharedState.condititionMet = true
def settings = actionBuilder.getScheduleSettings()
def startingDate = sharedState.remove("startingDate")
def numberOfTimeUnits = sharedState.remove("numberOfTimeUnits")
settings.setNewStartingDate(startingDate)
settings.setNewNumberOfTimeUnits(numberOfTimeUnits)
// note the logic will go there also for the first ever run, global state is not set yet,
// properties are null and using setting.setNew... with null values means "keep the original values"
// -> therefore first run is always the original schedule interval
}
-
Constructor Summary
ConstructorDescriptionScheduleSettings
(T backLink, Invocations<MethodInvocationRecord> invocations, CalculationFlowTimeUnit timeUnit, BigDecimal numberOfTimeUnits, String startingDate, Boolean periodic, CFTraitType traitType) -
Method Summary
Modifier and TypeMethodDescriptionback()
void
Gets newly set number of time units.Gets newly set starting date.CalculationFlowTimeUnit
Gets newly set time unit.Number of time units to next triggering of schedule.Starting date and time of the associated formulaCalculationFlowTimeUnit
Gets you time unit as seen in the UI.CFTraitType
Gets newly set periodicity.If this CF item is period or not.boolean
boolean
void
setNewNumberOfTimeUnits
(BigDecimal newNumberOfTimeUnits) Method that alters the schedule for next run.void
setNewPeriodic
(Boolean newPeriodic) Method that alters the schedule for next run.void
setNewStartingDate
(String newStartingDate) Method that alters the schedule for next run.void
setNewTimeUnit
(CalculationFlowTimeUnit newTimeUnit) Method that alters the schedule for next run.toString()
-
Constructor Details
-
ScheduleSettings
public ScheduleSettings(T backLink, Invocations<MethodInvocationRecord> invocations, CalculationFlowTimeUnit timeUnit, BigDecimal numberOfTimeUnits, String startingDate, Boolean periodic, CFTraitType traitType)
-
-
Method Details
-
getObjectName
- Specified by:
getObjectName
in interfaceHelp
-
getTimeUnit
public CalculationFlowTimeUnit getTimeUnit()Gets you time unit as seen in the UI. Possible options are MINUTE, HOUR, DAY. -
getNumberOfTimeUnits
Number of time units to next triggering of schedule. -
getStartingDate
Starting date and time of the associated formula -
isPeriodic
If this CF item is period or not. Default option is that it is periodic. -
setNewTimeUnit
public void setNewTimeUnit(CalculationFlowTimeUnit newTimeUnit) Method that alters the schedule for next run. Sets new time unit. -
setNewNumberOfTimeUnits
Method that alters the schedule for next run. Sets new number of time units. -
setNewStartingDate
Method that alters the schedule for next run. Sets new starting date. -
setNewPeriodic
Method that alters the schedule for next run. Sets periodicity. -
getNewTimeUnit
public CalculationFlowTimeUnit getNewTimeUnit()Gets newly set time unit. -
getNewNumberOfTimeUnits
Gets newly set number of time units. -
getNewStartingDate
Gets newly set starting date. -
isNewPeriodic
Gets newly set periodicity. -
getTraitType
public CFTraitType getTraitType() -
isStartImmediatelyTraitActive
public boolean isStartImmediatelyTraitActive()- Returns:
- Retuns true if the CF was run on user request (not by scheduler itself) either manually in UI or via REST API action
-
isScheduleChangeRequested
public boolean isScheduleChangeRequested() -
clearNewSchedule
public void clearNewSchedule() -
back
-
getDateTimeFormat
-
toString
-