Package eu.woolplatform.utils.schedule
Class TaskSchedule.TimeSchedule
- java.lang.Object
-
- eu.woolplatform.utils.schedule.TaskSchedule
-
- eu.woolplatform.utils.schedule.TaskSchedule.TimeSchedule
-
- Enclosing class:
- TaskSchedule
public static class TaskSchedule.TimeSchedule extends TaskSchedule
Schedule for a task that should be run at a specified date/time with possible repeats. The repeats can be specified by date and by time independently. An iteration may be skipped if a run doesn't end before the scheduled next run.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class eu.woolplatform.utils.schedule.TaskSchedule
TaskSchedule.FixedDelay, TaskSchedule.FixedRate, TaskSchedule.Immediate, TaskSchedule.LocalTime, TaskSchedule.TimeSchedule, TaskSchedule.UtcTime
-
-
Constructor Summary
Constructors Constructor Description TimeSchedule(org.joda.time.LocalDate startDate, org.joda.time.LocalTime startTime)Constructs a new schedule that is run once at the specified date and time.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.joda.time.LocalDategetEndDate()Returns the date at and after which the task should no longer be run.org.joda.time.LocalTimegetEndTime()Returns the time at and after which the task should no longer be run at each scheduled date.DateDurationgetRepeatDate()If the task should be repeated at multiple dates, this method returns the repeat interval.TimeDurationgetRepeatTime()If the task should be repeated at multiple times within each scheduled date, this method returns the repeat interval.org.joda.time.LocalDategetStartDate()Returns the date when the task should be first run.org.joda.time.LocalTimegetStartTime()Returns the time when the task should be first run on each scheduled date.voidsetEndDate(org.joda.time.LocalDate endDate)Sets the date at and after which the task should no longer be run.voidsetEndTime(org.joda.time.LocalTime endTime)Sets the time at and after which the task should no longer be run at each scheduled date.voidsetRepeatDate(DateDuration repeatDate)If the task should be repeated at multiple dates, this method sets the repeat interval.voidsetRepeatTime(TimeDuration repeatTime)If the task should be repeated at multiple times within each scheduled date, this method sets the repeat interval.voidsetStartDate(org.joda.time.LocalDate startDate)Sets the date when the task should be first run.voidsetStartTime(org.joda.time.LocalTime startTime)Sets the time when the task should be first run on each scheduled date.
-
-
-
Constructor Detail
-
TimeSchedule
public TimeSchedule(org.joda.time.LocalDate startDate, org.joda.time.LocalTime startTime)Constructs a new schedule that is run once at the specified date and time. After construction you can set additional properties to define repeats. In that case the specified date/time defines a start date/time. That is the time when the first run is scheduled.- Parameters:
startDate- the start datestartTime- the start time
-
-
Method Detail
-
getStartDate
public org.joda.time.LocalDate getStartDate()
Returns the date when the task should be first run. The time is returned bygetStartTime(). If no date repeat is defined, this is the only date.- Returns:
- the start date
-
setStartDate
public void setStartDate(org.joda.time.LocalDate startDate)
Sets the date when the task should be first run. The time is set withsetStartTime(). If no date repeat is defined, this is the only date.- Parameters:
startDate- the start date
-
getStartTime
public org.joda.time.LocalTime getStartTime()
Returns the time when the task should be first run on each scheduled date. If no time repeat is defined, this is the only time at each date.- Returns:
- the start time
-
setStartTime
public void setStartTime(org.joda.time.LocalTime startTime)
Sets the time when the task should be first run on each scheduled date. If no time repeat is defined, this is the only time at each date.- Parameters:
startTime- the start time
-
getEndDate
public org.joda.time.LocalDate getEndDate()
Returns the date at and after which the task should no longer be run. This can be used together with a date repeat. If there is no date repeat or the task should be repeated indefinitely, this method returns null.- Returns:
- the end date or null (default)
-
setEndDate
public void setEndDate(org.joda.time.LocalDate endDate)
Sets the date at and after which the task should no longer be run. This can be used together with a date repeat. If there is no date repeat or the task should be repeated indefinitely, the end date should be null.- Parameters:
endDate- the end date or null (default)
-
getEndTime
public org.joda.time.LocalTime getEndTime()
Returns the time at and after which the task should no longer be run at each scheduled date. This can be used together with a time repeat. If there is no time repeat or the task should be repeated indefinitely within each date, this method should return null.- Returns:
- the end time or null (default)
-
setEndTime
public void setEndTime(org.joda.time.LocalTime endTime)
Sets the time at and after which the task should no longer be run at each scheduled date. This can be used together with a time repeat. If there is no time repeat or the task should be repeated indefinitely within each date, the end time should be null.- Parameters:
endTime- the end time or null (default)
-
getRepeatDate
public DateDuration getRepeatDate()
If the task should be repeated at multiple dates, this method returns the repeat interval. The task will be run at the start date and then at each interval after that until an optional end date (seegetEndDate()). At each date the task is run according to the defined time schedule (start time and possible repeats).If the task should only run at the start date, this method returns null.
- Returns:
- the date repeat interval or null
-
setRepeatDate
public void setRepeatDate(DateDuration repeatDate)
If the task should be repeated at multiple dates, this method sets the repeat interval. The task will be run at the start date and then at each interval after that until an optional end date (seesetEndDate()). At each date the task is run according to the defined time schedule (start time and possible repeats).If the task should only run at the start date, you should set the repeat interval to null.
- Parameters:
repeatDate- the date repeat interval or null
-
getRepeatTime
public TimeDuration getRepeatTime()
If the task should be repeated at multiple times within each scheduled date, this method returns the repeat interval. At each date, the task will be run at the start time and then at each interval after that until an optional end time (seegetEndTime()).If the task should only run at the start time within each scheduled date, this method returns null.
- Returns:
- the time repeat interval or null
-
setRepeatTime
public void setRepeatTime(TimeDuration repeatTime)
If the task should be repeated at multiple times within each scheduled date, this method sets the repeat interval. At each date, the task will be run at the start time and then at each interval after that until an optional end time (seesetEndTime()).If the task should only run at the start time within each scheduled date, you should set the repeat interval to null.
- Parameters:
repeatTime- the time repeat interval or null
-
-