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

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

public class CronEditorBean
extends Object

Represents the form state for the CronEditorWebComponent.


Field Summary
static String ADVANCED_MODE
           
static String DAILY_SPEC_MODE
           
static String DAYS_OF_MONTH_SPEC_MODE
           
static String DAYS_OF_WEEK_SPEC_MODE
           
static String DOT
           
 
Constructor Summary
CronEditorBean()
           
CronEditorBean(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
 String getCronString()
          Returns the cron string that the object was constructed with.
 String getDayInMonthOrdinal()
          Returns a number that represents the first, second third etc.
 String getDayOfMonth()
          Gets the day of month field specified in the cron string.
 String getHoursFrom()
          Returns the lower bound of the hour range if this entry has a range.
 String getHoursFromMeridian()
          Returns the meridian indicator @{link #AM} or @{link #PM} for the lower bound of a range entry.
 String getHoursRunOnce()
          Returns the single hour value for this entry if it is a run once entry.
 String getHoursRunOnceMeridian()
          Returns the meridian indicator @{link #AM} or @{link #PM} for the entry if it is a run once entry.
 String getHoursTo()
          Returns the upper bound of the hour range if this entry has a range.
 String getHoursToMeridian()
          Returns the meridian indicator @{link #AM} or @{link #PM} for the upper bound of a range entry.
 String getIncrementInMinutes()
          Used to determine the total increment in minutes derived by the hour and minutes fields' increment parts.
 String getMinutes()
          Gets the minutes specified.
 String getSeconds()
           
 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(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(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 setMode(String mode)
           
 void setSeconds(String seconds)
           
 void setSpecifiedDaysOfWeek(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 String DAILY_SPEC_MODE
See Also:
Constant Field Values

DAYS_OF_WEEK_SPEC_MODE

public static final String DAYS_OF_WEEK_SPEC_MODE
See Also:
Constant Field Values

DAYS_OF_MONTH_SPEC_MODE

public static final String DAYS_OF_MONTH_SPEC_MODE
See Also:
Constant Field Values

ADVANCED_MODE

public static final String ADVANCED_MODE
See Also:
Constant Field Values

DOT

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

CronEditorBean

public CronEditorBean()

CronEditorBean

public CronEditorBean(String paramPrefix,
                      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 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 String getDayOfMonth()
Gets the day of month field specified in the cron string. Should be between 1-31 or L.


getMinutes

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


getHoursFrom

public 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 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 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 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 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 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(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 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 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 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(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(String mode)

setDayOfWeekOfMonth

public void setDayOfWeekOfMonth(boolean dayOfWeekOfMonth)

setDayOfMonth

public void setDayOfMonth(String dayOfMonth)

setMinutes

public void setMinutes(String minutes)

setHoursFrom

public void setHoursFrom(String hoursFrom)

setHoursTo

public void setHoursTo(String hoursTo)

setHoursFromMeridian

public void setHoursFromMeridian(String hoursFromMeridian)

setHoursToMeridian

public void setHoursToMeridian(String hoursToMeridian)

setHoursRunOnce

public void setHoursRunOnce(String hoursRunOnce)

setHoursRunOnceMeridian

public void setHoursRunOnceMeridian(String hoursRunOnceMeridian)

setSpecifiedDaysOfWeek

public void setSpecifiedDaysOfWeek(String specifiedDaysOfWeek)

setDayInMonthOrdinal

public void setDayInMonthOrdinal(String dayInMonthOrdinal)

setIncrementInMinutes

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

Parameters:
incrementInMinutes - the interval or "0"

setSeconds

public void setSeconds(String seconds)

getSeconds

public String getSeconds()


Copyright © 2002-2012 Atlassian. All Rights Reserved.