Class ScheduleSettings<T extends Help>

Object
ScheduleSettings<T>
All Implemented Interfaces:
Help

public class ScheduleSettings<T extends Help> extends Object implements 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.


   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 Details

    • ScheduleSettings

      public ScheduleSettings(T backLink, Invocations<MethodInvocationRecord> invocations, CalculationFlowTimeUnit timeUnit, BigDecimal numberOfTimeUnits, String startingDate, Boolean periodic, CFTraitType traitType)
  • Method Details

    • getObjectName

      public String getObjectName()
      Specified by:
      getObjectName in interface Help
    • getTimeUnit

      public CalculationFlowTimeUnit getTimeUnit()
      Gets you time unit as seen in the UI. Possible options are MINUTE, HOUR, DAY.
    • getNumberOfTimeUnits

      public BigDecimal getNumberOfTimeUnits()
      Number of time units to next triggering of schedule.
    • getStartingDate

      public String getStartingDate()
      Starting date and time of the associated formula
    • isPeriodic

      public Boolean 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

      public void setNewNumberOfTimeUnits(BigDecimal newNumberOfTimeUnits)
      Method that alters the schedule for next run. Sets new number of time units.
    • setNewStartingDate

      public void setNewStartingDate(String newStartingDate)
      Method that alters the schedule for next run. Sets new starting date.
    • setNewPeriodic

      public void setNewPeriodic(Boolean newPeriodic)
      Method that alters the schedule for next run. Sets periodicity.
    • getNewTimeUnit

      public CalculationFlowTimeUnit getNewTimeUnit()
      Gets newly set time unit.
    • getNewNumberOfTimeUnits

      public BigDecimal getNewNumberOfTimeUnits()
      Gets newly set number of time units.
    • getNewStartingDate

      public String getNewStartingDate()
      Gets newly set starting date.
    • isNewPeriodic

      public Boolean 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

      public T back()
    • getDateTimeFormat

      public String getDateTimeFormat()
    • toString

      public String toString()
      Overrides:
      toString in class Object