Class CronEditorBean
java.lang.Object
com.atlassian.jira.web.component.cron.CronEditorBean
Represents the form state for the CronEditorWebComponent.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCronEditorBean
(String paramPrefix, Map params) Initialises to the state defined by the given params, which are identified by the presence of paramPrefix on the key. -
Method Summary
Modifier and TypeMethodDescriptionReturns the cron string that the object was constructed with.Returns a number that represents the first, second third etc.Gets the day of month field specified in the cron string.Returns the lower bound of the hour range if this entry has a range.Returns the meridian indicator @{link #AM} or @{link #PM} for the lower bound of a range entry.Returns the single hour value for this entry if it is a run once entry.Returns the meridian indicator @{link #AM} or @{link #PM} for the entry if it is a run once entry.Returns the upper bound of the hour range if this entry has a range.Returns the meridian indicator @{link #AM} or @{link #PM} for the upper bound of a range entry.Used to determine the total increment in minutes derived by the hour and minutes fields' increment parts.Gets the minutes specified.Returns all the days that have been specified in a comma separated list.boolean
Indicates that the range of time specified spans across the full 24 hours in a day (which is indicated by the computed hoursFrom in 24 hour time being equal to the computed hoursTo in 24 hour time).boolean
Will return true if the passed in cron string is not valid for the editor.boolean
Will return true if the editors daily mode can handle the provided cron string.boolean
Returns true ifisDaysPerMonthMode()
is true and the sub-mode of day of week per month has been selected.boolean
Will return true if the editors day per week mode can handle the provided cron string.boolean
isDaySpecified
(String dayStr) Returns true if the passed in day has been specified, false otherwise.boolean
Will return true if the editors days per month mode can handle the provided cron string.boolean
isRange()
Indicates that a range of time is being specified.boolean
Used to validate the hours to see that the from hour is before the to hour, if specified.void
setCronString
(String cronString) The full cron string that may have been specified.void
setDayInMonthOrdinal
(String dayInMonthOrdinal) void
setDayOfMonth
(String dayOfMonth) void
setDayOfWeekOfMonth
(boolean dayOfWeekOfMonth) void
setHoursFrom
(String hoursFrom) void
setHoursFromMeridian
(String hoursFromMeridian) void
setHoursRunOnce
(String hoursRunOnce) void
setHoursRunOnceMeridian
(String hoursRunOnceMeridian) void
setHoursTo
(String hoursTo) void
setHoursToMeridian
(String hoursToMeridian) void
setIncrementInMinutes
(String incrementInMinutes) Set the interval of repetition.void
setMinutes
(String minutes) void
void
setSeconds
(String seconds) void
setSpecifiedDaysOfWeek
(String specifiedDaysOfWeek)
-
Field Details
-
DAILY_SPEC_MODE
- See Also:
-
DAYS_OF_WEEK_SPEC_MODE
- See Also:
-
DAYS_OF_MONTH_SPEC_MODE
- See Also:
-
ADVANCED_MODE
- See Also:
-
DOT
- See Also:
-
-
Constructor Details
-
CronEditorBean
public CronEditorBean() -
CronEditorBean
Initialises to the state defined by the given params, which are identified by the presence of paramPrefix on the key.- Parameters:
paramPrefix
- the prefix used on each of the params.params
- state parameters to use.
-
-
Method Details
-
isRangeHoursValid
public boolean isRangeHoursValid()Used to validate the hours to see that the from hour is before the to hour, if specified. Note: to allow the range to run "all-day" (eg. from 12AM to 12AM), we need to also allow the from and to times to be equal.- Returns:
- true if from is before to or if they have not been specified.
-
isRange
public boolean isRange()Indicates that a range of time is being specified.- Returns:
- true only if the form state indicates a from and to time.
-
is24HourRange
public boolean is24HourRange()Indicates that the range of time specified spans across the full 24 hours in a day (which is indicated by the computed hoursFrom in 24 hour time being equal to the computed hoursTo in 24 hour time).- Returns:
- true only if we have specified a range, and that range spans across the 24 hours.
-
getCronString
Returns the cron string that the object was constructed with. This method does not guarantee that the returned cron string is valid.- Returns:
- unmodified cronString
-
isAdvancedMode
public boolean isAdvancedMode()Will return true if the passed in cron string is not valid for the editor.- Returns:
- true if the cron string can not be handled, false otherwise.
-
isDailyMode
public boolean isDailyMode()Will return true if the editors daily mode can handle the provided cron string.- Returns:
- if we're in daily mode.
-
isDayPerWeekMode
public boolean isDayPerWeekMode()Will return true if the editors day per week mode can handle the provided cron string.- Returns:
- true if
mode
is equal toDAYS_OF_WEEK_SPEC_MODE
, false otherwise
-
isDaysPerMonthMode
public boolean isDaysPerMonthMode()Will return true if the editors days per month mode can handle the provided cron string.- Returns:
- true if
mode
is equal toDAYS_OF_MONTH_SPEC_MODE
, false otherwise
-
isDayOfWeekOfMonth
public boolean isDayOfWeekOfMonth()Returns true ifisDaysPerMonthMode()
is true and the sub-mode of day of week per month has been selected. -
getDayOfMonth
Gets the day of month field specified in the cron string. Should be between 1-31 or L. -
getMinutes
Gets the minutes specified. Should be between 0-59. -
getHoursFrom
Returns the lower bound of the hour range if this entry has a range.This end of the range is inclusive - e.g. if HoursFrom is 3PM and HoursTo is 5PM, the duration of the range is 2 hours.
- Returns:
- the lower bound or null if this is not a range hour entry.
-
getHoursTo
Returns the upper bound of the hour range if this entry has a range.This end of the range is exclusive - e.g. if HoursFrom is 3PM and HoursTo is 5PM, the duration of the range is 2 hours.
- Returns:
- the upper bound or null if this is not a range hour entry.
-
getHoursFromMeridian
Returns the meridian indicator @{link #AM} or @{link #PM} for the lower bound of a range entry.- Returns:
- the meridian belonging to the lower bound hour or null if this is not a range entry.
-
getHoursToMeridian
Returns the meridian indicator @{link #AM} or @{link #PM} for the upper bound of a range entry.- Returns:
- the meridian belonging to the upper bound hour or null if this is not a range entry.
-
getHoursRunOnce
Returns the single hour value for this entry if it is a run once entry.- Returns:
- the hour value or null if this is not a run once hour entry.
-
getHoursRunOnceMeridian
Returns the meridian indicator @{link #AM} or @{link #PM} for the entry if it is a run once entry.- Returns:
- the meridian belonging single hour value or null if this is not a run once entry.
-
isDaySpecified
Returns true if the passed in day has been specified, false otherwise.- Parameters:
dayStr
- a string representing a day (e.g. 1-7).- Returns:
- true if the day has been specified, false otherwise.
-
getDayInMonthOrdinal
Returns a number that represents the first, second third etc. day of the week in a month.- Returns:
- the ordinal or null if this entry doesn't specify it.
-
getSpecifiedDaysPerWeek
Returns all the days that have been specified in a comma separated list.- Returns:
- string representing days (e.g. "1,2,3").
-
getIncrementInMinutes
Used to determine the total increment in minutes derived by the hour and minutes fields' increment parts. An increment of 0 indicates no repetition based on the hours or minutes fields and will happen if the repetition is once a day.- Returns:
- a minute increment or "0"
-
setCronString
The full cron string that may have been specified. This can come from the advanced tab where the user has specified their own cron string. This does not validate the cron string.- Parameters:
cronString
- a valid cron string.
-
setMode
-
setDayOfWeekOfMonth
public void setDayOfWeekOfMonth(boolean dayOfWeekOfMonth) -
setDayOfMonth
-
setMinutes
-
setHoursFrom
-
setHoursTo
-
setHoursFromMeridian
-
setHoursToMeridian
-
setHoursRunOnce
-
setHoursRunOnceMeridian
-
setSpecifiedDaysOfWeek
-
setDayInMonthOrdinal
-
setIncrementInMinutes
Set the interval of repetition. "0" indicates there is no repetition.- Parameters:
incrementInMinutes
- the interval or "0"
-
setSeconds
-
getSeconds
-