com.atlassian.jira.web.component.cron
Class CronEditorBean

java.lang.Object
  extended by com.atlassian.jira.web.component.cron.CronEditorBean

public class CronEditorBean
extends java.lang.Object

Represents the form state for the CronEditorWebComponent.


Field Summary
static java.lang.String ADVANCED_MODE
           
static java.lang.String DAILY_SPEC_MODE
           
static java.lang.String DAYS_OF_MONTH_SPEC_MODE
           
static java.lang.String DAYS_OF_WEEK_SPEC_MODE
           
static java.lang.String DOT
           
 
Constructor Summary
CronEditorBean()
           
CronEditorBean(java.lang.String paramPrefix, java.util.Map params)
          Initialises to the state defined by the given params, which are identified by the presence of paramPrefix on the key.
 
Method Summary
 java.lang.String getCronString()
          Returns the cron string that the object was constructed with.
 java.lang.String getDayInMonthOrdinal()
          Returns a number that represents the first, second third etc.
 java.lang.String getDayOfMonth()
          Gets the day of month field specified in the cron string.
 java.lang.String getHoursFrom()
          Returns the lower bound of the hour range if this entry has a range.
 java.lang.String getHoursFromMeridian()
          Returns the meridian indicator @{link #AM} or @{link #PM} for the lower bound of a range entry.
 java.lang.String getHoursRunOnce()
          Returns the single hour value for this entry if it is a run once entry.
 java.lang.String getHoursRunOnceMeridian()
          Returns the meridian indicator @{link #AM} or @{link #PM} for the entry if it is a run once entry.
 java.lang.String getHoursTo()
          Returns the upper bound of the hour range if this entry has a range.
 java.lang.String getHoursToMeridian()
          Returns the meridian indicator @{link #AM} or @{link #PM} for the upper bound of a range entry.
 java.lang.String getIncrementInMinutes()
          Used to determine the total increment in minutes derived by the hour and minutes fields' increment parts.
 java.lang.String getMinutes()
          Gets the minutes specified.
 java.lang.String getSeconds()
           
 java.lang.String getSpecifiedDaysPerWeek()
          Returns all the days that have been specified in a comma separated list.
 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).
 boolean isAdvancedMode()
          Will return true if the passed in cron string is not valid for the editor.
 boolean isDailyMode()
          Will return true if the editors daily mode can handle the provided cron string.
 boolean isDayOfWeekOfMonth()
          Returns true if isDaysPerMonthMode() is true and the sub-mode of day of week per month has been selected.
 boolean isDayPerWeekMode()
          Will return true if the editors day per week mode can handle the provided cron string.
 boolean isDaySpecified(java.lang.String dayStr)
          Returns true if the passed in day has been specified, false otherwise.
 boolean isDaysPerMonthMode()
          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 isRangeHoursValid()
          Used to validate the hours to see that the from hour is before the to hour, if specified.
 void setCronString(java.lang.String cronString)
          The full cron string that may have been specified.
 void setDayInMonthOrdinal(java.lang.String dayInMonthOrdinal)
           
 void setDayOfMonth(java.lang.String dayOfMonth)
           
 void setDayOfWeekOfMonth(boolean dayOfWeekOfMonth)
           
 void setHoursFrom(java.lang.String hoursFrom)
           
 void setHoursFromMeridian(java.lang.String hoursFromMeridian)
           
 void setHoursRunOnce(java.lang.String hoursRunOnce)
           
 void setHoursRunOnceMeridian(java.lang.String hoursRunOnceMeridian)
           
 void setHoursTo(java.lang.String hoursTo)
           
 void setHoursToMeridian(java.lang.String hoursToMeridian)
           
 void setIncrementInMinutes(java.lang.String incrementInMinutes)
          Set the interval of repetition.
 void setMinutes(java.lang.String minutes)
           
 void setMode(java.lang.String mode)
           
 void setSeconds(java.lang.String seconds)
           
 void setSpecifiedDaysOfWeek(java.lang.String specifiedDaysOfWeek)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DAILY_SPEC_MODE

public static final java.lang.String DAILY_SPEC_MODE
See Also:
Constant Field Values

DAYS_OF_WEEK_SPEC_MODE

public static final java.lang.String DAYS_OF_WEEK_SPEC_MODE
See Also:
Constant Field Values

DAYS_OF_MONTH_SPEC_MODE

public static final java.lang.String DAYS_OF_MONTH_SPEC_MODE
See Also:
Constant Field Values

ADVANCED_MODE

public static final java.lang.String ADVANCED_MODE
See Also:
Constant Field Values

DOT

public static final java.lang.String DOT
See Also:
Constant Field Values
Constructor Detail

CronEditorBean

public CronEditorBean()

CronEditorBean

public CronEditorBean(java.lang.String paramPrefix,
                      java.util.Map params)
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 Detail

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

public java.lang.String getCronString()
Returns the cron string that the object was constructed with. This method does not guarantee that the returned cron string is valid according the the CronTrigger.

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 to DAYS_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 to DAYS_OF_MONTH_SPEC_MODE, false otherwise

isDayOfWeekOfMonth

public boolean isDayOfWeekOfMonth()
Returns true if isDaysPerMonthMode() is true and the sub-mode of day of week per month has been selected.


getDayOfMonth

public java.lang.String getDayOfMonth()
Gets the day of month field specified in the cron string. Should be between 1-31 or L.


getMinutes

public java.lang.String getMinutes()
Gets the minutes specified. Should be between 0-59.


getHoursFrom

public java.lang.String 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

public java.lang.String 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

public java.lang.String 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

public java.lang.String 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

public java.lang.String 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

public java.lang.String 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

public boolean isDaySpecified(java.lang.String dayStr)
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

public java.lang.String 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

public java.lang.String getSpecifiedDaysPerWeek()
Returns all the days that have been specified in a comma separated list.

Returns:
string representing days (e.g. "1,2,3").

getIncrementInMinutes

public java.lang.String 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

public void setCronString(java.lang.String cronString)
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

public void setMode(java.lang.String mode)

setDayOfWeekOfMonth

public void setDayOfWeekOfMonth(boolean dayOfWeekOfMonth)

setDayOfMonth

public void setDayOfMonth(java.lang.String dayOfMonth)

setMinutes

public void setMinutes(java.lang.String minutes)

setHoursFrom

public void setHoursFrom(java.lang.String hoursFrom)

setHoursTo

public void setHoursTo(java.lang.String hoursTo)

setHoursFromMeridian

public void setHoursFromMeridian(java.lang.String hoursFromMeridian)

setHoursToMeridian

public void setHoursToMeridian(java.lang.String hoursToMeridian)

setHoursRunOnce

public void setHoursRunOnce(java.lang.String hoursRunOnce)

setHoursRunOnceMeridian

public void setHoursRunOnceMeridian(java.lang.String hoursRunOnceMeridian)

setSpecifiedDaysOfWeek

public void setSpecifiedDaysOfWeek(java.lang.String specifiedDaysOfWeek)

setDayInMonthOrdinal

public void setDayInMonthOrdinal(java.lang.String dayInMonthOrdinal)

setIncrementInMinutes

public void setIncrementInMinutes(java.lang.String incrementInMinutes)
Set the interval of repetition. "0" indicates there is no repetition.

Parameters:
incrementInMinutes - the interval or "0"

setSeconds

public void setSeconds(java.lang.String seconds)

getSeconds

public java.lang.String getSeconds()


Copyright © 2002-2010 Atlassian. All Rights Reserved.