i-net Clear Reports

com.inet.report.schedule
Class ScheduleExecution

java.lang.Object
  extended by com.inet.report.schedule.ScheduleExecution
All Implemented Interfaces:
ExecutionTimeProvider
Direct Known Subclasses:
DailyExecution, MonthlyExecution, OneDayExecution, WeeklyExecution

public abstract class ScheduleExecution
extends java.lang.Object
implements ExecutionTimeProvider

An abstract implementation of ExecutionTimeProvider, already including time of day information, either of the form "once at __:__" or "every ___ hours starting at __:__ until __ o'clock".
The most important methods are for setting the start time or the hour range. Note that these two are exclusive - the one replaces the information set by the other.

To create an instance of ScheduleExecution, use the methods in ScheduleExecutionFactory.

Since:
6.0
See Also:
OneDayExecution, DailyExecution, WeeklyExecution, MonthlyExecution, ScheduleExecutionFactory, ExecutionTimeProvider

Method Summary
 java.util.Date getEndDate()
          Returns the end date for this execution time provider - that is, the last point in time this task is allowed to be executed.
 int getHour()
          Returns the specific hour of day the task is to be executed at for the first time - if an hour range has been set, this will return the first hour of the hour range.
 int[] getHourRange()
          Returns the range of hours (e.g. every hour from 12 to 16 would return {1,12,16})
 int getLoopCount()
          Get the amount of executions after this task is stopped.
 int getMinute()
          Returns the specific minute of the hour the task is to be executed at.
 java.util.Date getNextExecutionTime()
          The core of the object - must return the next point in time the task is to be executed.
 java.util.Date getStartDate()
          Returns the start date (NOT to be mistaken for the point in time - the only thing that counts in the date object is the actual day - setting a Date object with time information will cause the time information to be ignored.) for this execution time provider - that is, the first day this task is allowed to be executed.
 void setEndDate(java.util.Date endDate)
          Sets the end date for this execution time provider - that is, the last point in time this task is allowed to be executed.
 void setHourRange(int stepSize, int startHour, int endHour)
          Sets the hour range for this execution time.
 void setHourRange(int stepSize, int startHour, int endHour, int minute)
          Sets the hour range for this execution time.
 void setLoopCount(int loopCount)
          Set after how many executions this task should stop.
 void setStartDate(java.util.Date date)
          Sets the start date of the task.
 void setStartTime(int hour, int minute)
          Sets the task's starting time of day - causes this execution time to be of the form "once at __:__".
 

Method Detail

getNextExecutionTime

public java.util.Date getNextExecutionTime()
The core of the object - must return the next point in time the task is to be executed. If there is no future execution time, this will return null.

Specified by:
getNextExecutionTime in interface ExecutionTimeProvider
Returns:
The next point in time the task is to be executed, or null if there is no future time of execution.

setHourRange

public void setHourRange(int stepSize,
                         int startHour,
                         int endHour)
                  throws ScheduleException
Sets the hour range for this execution time. An hour range is a set of times with a specified hour interval between the times. If the hour range is determined to be only one point in time (e.g. start hour 10, end hour 12, step size 3) then it will automatically be interpreted as a single time, as if setStartTime had been called.

Parameters:
stepSize - Interval length in hours (must be at least 1)
startHour - First hour of the hour range
endHour - Last hour of the hour range
Throws:
ScheduleException - If the range is not legal, for example, if one of the numbers is negative or if the end hour is earlier than the start hour

setHourRange

public void setHourRange(int stepSize,
                         int startHour,
                         int endHour,
                         int minute)
                  throws ScheduleException
Sets the hour range for this execution time. An hour range is a set of times with a specified hour interval between the times. If the hour range is determined to be only one point in time (e.g. start hour 10, end hour 12, step size 3) then it will automatically be interpreted as a single time, as if setStartTime had been called.

Parameters:
stepSize - Interval length in hours (must be at least 1)
startHour - First hour of the hour range
endHour - Last hour of the hour range
minute - Minute of the execution times
Throws:
ScheduleException - If the range is not legal, for example, if one of the numbers is negative or if the end hour is earlier than the start hour

getStartDate

public java.util.Date getStartDate()
Returns the start date (NOT to be mistaken for the point in time - the only thing that counts in the date object is the actual day - setting a Date object with time information will cause the time information to be ignored.) for this execution time provider - that is, the first day this task is allowed to be executed.

Specified by:
getStartDate in interface ExecutionTimeProvider
Returns:
The start date for this execution time provider.

setStartDate

public void setStartDate(java.util.Date date)
                  throws ScheduleException
Sets the start date of the task. From this date onward this task will be scheduled until the set end date is reached.

Specified by:
setStartDate in interface ExecutionTimeProvider
Parameters:
date - The start date (NOT to be mistaken for the point in time - the only thing that counts in the date object is the actual day - setting a Date object with time information will cause the time information to be ignored.) to set. May not be null
Throws:
ScheduleException - If date is null. (error code SE0044)

getEndDate

public final java.util.Date getEndDate()
Returns the end date for this execution time provider - that is, the last point in time this task is allowed to be executed. If the end date is null, then there is no such "last point in time allowed".

Specified by:
getEndDate in interface ExecutionTimeProvider
Returns:
The end date for this execution time provider.

setEndDate

public final void setEndDate(java.util.Date endDate)
Sets the end date for this execution time provider - that is, the last point in time this task is allowed to be executed. If the end date is null, then there is no such "last point in time allowed".

Specified by:
setEndDate in interface ExecutionTimeProvider
Parameters:
endDate - The end date for this execution time provider. If null, end date is set to non-existent.

setStartTime

public void setStartTime(int hour,
                         int minute)
                  throws ScheduleException
Sets the task's starting time of day - causes this execution time to be of the form "once at __:__".

Parameters:
hour - Hour of day, minimum is 0 (meaning 12 a.m), maximum is 23 (meaning 11 p.m.)
minute - Minute of the hour, minimum is 0, maximum is 59
Throws:
ScheduleException - If the hour is not between 0 and 23, or the minute is not between 0 and 59.

getHour

public int getHour()
Returns the specific hour of day the task is to be executed at for the first time - if an hour range has been set, this will return the first hour of the hour range.

Returns:
The specific hour of day the task is to be executed at for the first time.

getMinute

public int getMinute()
Returns the specific minute of the hour the task is to be executed at.

Returns:
The specific minute of the hour the task is to be executed at.

getHourRange

public int[] getHourRange()
Returns the range of hours (e.g. every hour from 12 to 16 would return {1,12,16})

Returns:
null - if no range (for example, if only one point in time); otherwise {stepsize,start,end} (if stepsize = 0, this is also no range)

setLoopCount

public void setLoopCount(int loopCount)
Set after how many executions this task should stop.

Specified by:
setLoopCount in interface ExecutionTimeProvider
Parameters:
loopCount - after how many executions it should stop, use -1 for never, 0 means it will not be scheduled at all. When 0, ExecutionTimeProvider.getNextExecutionTime() will always return null.

getLoopCount

public int getLoopCount()
Get the amount of executions after this task is stopped.

Specified by:
getLoopCount in interface ExecutionTimeProvider
Returns:
the amount, 0=it is currently stopped (will not be executed any longer), -1 = it is never stopped by this mechanism

i-net Clear Reports

Copyright © 1999-2011 by i-net software GmbH