atg.commerce.order.scheduled
Class CalendarScheduleProperty

java.lang.Object
  extended by atg.commerce.order.scheduled.ComplexScheduledOrderProperty
      extended by atg.commerce.order.scheduled.ScheduleProperty
          extended by atg.commerce.order.scheduled.CalendarScheduleProperty

public class CalendarScheduleProperty
extends ScheduleProperty

This class represents the schedule property in the scheduledOrder repository. The schedule property will be a Calendar Schedule. The property is mapped to the user fields on the User Interface which are for Calendar Schedule, such as selection of daily,weekly or monthly sechdule, selection of the day within the week, etc.

See Also:
atg.b2bcommerce.order.scheduled.ScheduleProperty

Field Summary
static java.lang.String CLASS_VERSION
           
 
Fields inherited from class atg.commerce.order.scheduled.ScheduleProperty
sResourceBundle
 
Constructor Summary
CalendarScheduleProperty()
           
 
Method Summary
protected  boolean allFalse(java.lang.String pPropertyName, int startIndex)
          This method checks whether the values of a property are all false
protected  int countTrueValues(boolean[] pValues, int startIndex)
          This method counts the true value of a boolean array
protected  Schedule createScheduleFromUserInput(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method creates the Schedule object from the user inputs.
protected  java.lang.String getReadableDailyScheduleString(Schedule pSchedule)
          This method returns a human-readable daily schedule String.
protected  java.lang.String getReadableDaysOfTheWeek(boolean[] pDays)
          This method returns a human-readable day of the week String.
protected  java.lang.String getReadableMonthlyScheduleString(Schedule pSchedule)
          This method returns a human-readable monthly schedule String.
protected  java.lang.String getReadableOccurancesOfTheMonth(boolean[] pNumbers)
          Deprecated. because of misspelling
protected  java.lang.String getReadableOccurrencesOfTheMonth(boolean[] pNumbers)
          This method returns a human-readable occurrence of the month String.
 java.lang.String getReadableScheduleString(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse, Schedule pSchedule)
          This method returns a human-readable schedule String.
protected  java.lang.String getReadableStringList(boolean[] pInclude, java.lang.String[] pStringList)
          This method translates a boolean array to a String.
protected  java.lang.String getReadableWeeklyScheduleString(Schedule pSchedule)
          This method returns a human-readable weekly schedule String.
protected  void handleDailyMode(CalendarSchedule schedule)
          This method sets the properties of the schedule object if the schedule mode is Daily.
protected  void handleMonthlyMode(CalendarSchedule schedule)
          This method sets the properties of the schedule object if the schedule mode is Monthly.
protected  void handleWeeklyMode(CalendarSchedule schedule)
          This method sets the properties of the schedule object if the schedule mode is Weekly.
protected  void initializeUserInputField(java.lang.String pUserInputFieldName)
          This method initializes the user input values for a particular user input.
 void initializeUserInputFields()
          This method initializes all the user inputs.
protected  void remapDaysOfTheWeekToUserInput(CalendarSchedule pSchedule)
          This method maps to the daysOfTheWeek user input field from the schedule object.
protected  void remapNullScheduleToUserInputFields(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method maps to the user inputs when no schedule exists.
protected  void remapOccuranceInMonthToUserInput(CalendarSchedule pSchedule)
          Deprecated. because of misspelling
protected  void remapOccurrenceInMonthToUserInput(CalendarSchedule pSchedule)
          This method maps to the occurrenceInMonth user input field from the schedule object.
protected  void remapScheduleModeToUserInput(CalendarSchedule pSchedule)
          This method maps to the scheduleMode user field from the schedule object.
protected  void remapScheduleStringToUserInput(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse, CalendarSchedule pSchedule)
          This method remaps the human-readable schedule string to the user input
protected  void remapScheduleToUserInputFields(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse, Schedule pSchedule)
          This method maps the Calendar Schedule Object to the user inputs.
protected  void verifyDailyMode(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method verifies the values of the user input when the schedule mode is daily schedule mode.
protected  void verifyMonthlyMode(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method verifies the values of the user input when the schedule mode is Monthly schedule mode.
 void verifyUserInputFields(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method verifies the values of the user input.
protected  void verifyWeeklyMode(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method verifies the values of the user input when the schedule mode is weekly schedule mode.
 
Methods inherited from class atg.commerce.order.scheduled.ScheduleProperty
getComplexScheduledOrderPropertyValue, remapValueFromScheduledOrder, remapValueFromUserInputFields
 
Methods inherited from class atg.commerce.order.scheduled.ComplexScheduledOrderProperty
getFormHandler, getScheduledOrderPropertyName, getUserInputField, getUserInputFieldNames, getUserInputFields, setFormHandler, setScheduledOrderPropertyName, setUserInputField, setUserInputFieldNames, setUserInputFields
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Constructor Detail

CalendarScheduleProperty

public CalendarScheduleProperty()
Method Detail

remapNullScheduleToUserInputFields

protected void remapNullScheduleToUserInputFields(DynamoHttpServletRequest pRequest,
                                                  DynamoHttpServletResponse pResponse)
This method maps to the user inputs when no schedule exists. It will set the default value for the user input fields like daysOfWeek,occurrenceInMonth,etc.

Specified by:
remapNullScheduleToUserInputFields in class ScheduleProperty
Parameters:
pRequest - the servlet's request
pResponse - the servlet's response

verifyUserInputFields

public void verifyUserInputFields(DynamoHttpServletRequest pRequest,
                                  DynamoHttpServletResponse pResponse)
This method verifies the values of the user input. It first looks into the schedule mode(Daily,Weekly or Monthly). Depending on the different schedule mode, it will check the validity of each user input to make sure that there is no significant error for the user input value such as there is at least one occurrence of the week being checked when the schedule mode is set to be SELECTEDWEEKS.

Specified by:
verifyUserInputFields in class ComplexScheduledOrderProperty
Parameters:
pRequest - the servlet's request
pResponse - the servlet's response

verifyDailyMode

protected void verifyDailyMode(DynamoHttpServletRequest pRequest,
                               DynamoHttpServletResponse pResponse)
This method verifies the values of the user input when the schedule mode is daily schedule mode. If no day of the week(Mon, Tus, etc) is selected, an exception will be thrown. It can be overriden if more check is needed.

Parameters:
pRequest - the servlet's request
pResponse - the servlet's response

verifyWeeklyMode

protected void verifyWeeklyMode(DynamoHttpServletRequest pRequest,
                                DynamoHttpServletResponse pResponse)
This method verifies the values of the user input when the schedule mode is weekly schedule mode. If no day of the week(Mon, Tus, etc) is selected, an exception will be thrown. If the mode is select week and no occurrence of the week is selected, an exception will be thrown. It can be overriden if more checking is needed.

Parameters:
pRequest - the servlet's request
pResponse - the servlet's response

verifyMonthlyMode

protected void verifyMonthlyMode(DynamoHttpServletRequest pRequest,
                                 DynamoHttpServletResponse pResponse)
This method verifies the values of the user input when the schedule mode is Monthly schedule mode. No action is needed right now, but it can be overriden if more check is needed.

Parameters:
pRequest - the servlet's request
pResponse - the servlet's response

handleDailyMode

protected void handleDailyMode(CalendarSchedule schedule)
This method sets the properties of the schedule object if the schedule mode is Daily.

Parameters:
schedule - the schedule object

handleWeeklyMode

protected void handleWeeklyMode(CalendarSchedule schedule)
This method sets the properties of the schedule object if the schedule mode is Weekly.

Parameters:
schedule - the schedule object

handleMonthlyMode

protected void handleMonthlyMode(CalendarSchedule schedule)
This method sets the properties of the schedule object if the schedule mode is Monthly.

Parameters:
schedule - the schedule object

createScheduleFromUserInput

protected Schedule createScheduleFromUserInput(DynamoHttpServletRequest pRequest,
                                               DynamoHttpServletResponse pResponse)
This method creates the Schedule object from the user inputs. It first creates an empty schedule object, then based on the schedule mode, set the corresponding properties of the schedule object. remapValueFromUserInputFields will use the schedule object to map the user input to the schedule property of the repository.

Specified by:
createScheduleFromUserInput in class ScheduleProperty
Parameters:
pRequest - the servlet's request
pResponse - the servlet's response
Returns:
A Schedule object

remapDaysOfTheWeekToUserInput

protected void remapDaysOfTheWeekToUserInput(CalendarSchedule pSchedule)
This method maps to the daysOfTheWeek user input field from the schedule object.

Parameters:
pSchedule - the schedule object

remapOccuranceInMonthToUserInput

protected void remapOccuranceInMonthToUserInput(CalendarSchedule pSchedule)
Deprecated. because of misspelling

This method maps to the occurrenceInMonth user input field from the schedule object.

See Also:
remapOccurrenceInMonthToUserInput

remapOccurrenceInMonthToUserInput

protected void remapOccurrenceInMonthToUserInput(CalendarSchedule pSchedule)
This method maps to the occurrenceInMonth user input field from the schedule object. For backward compatibility, this method also maps to the occuranceInMonth user input field.

Parameters:
pSchedule - the schedule object

remapScheduleModeToUserInput

protected void remapScheduleModeToUserInput(CalendarSchedule pSchedule)
This method maps to the scheduleMode user field from the schedule object.

Parameters:
pSchedule - the schedule object

remapScheduleStringToUserInput

protected void remapScheduleStringToUserInput(DynamoHttpServletRequest pRequest,
                                              DynamoHttpServletResponse pResponse,
                                              CalendarSchedule pSchedule)
This method remaps the human-readable schedule string to the user input

Parameters:
pSchedule - the Schedule Object

remapScheduleToUserInputFields

protected void remapScheduleToUserInputFields(DynamoHttpServletRequest pRequest,
                                              DynamoHttpServletResponse pResponse,
                                              Schedule pSchedule)
This method maps the Calendar Schedule Object to the user inputs. It will go through all the properties which need to be mapped to set the proper values for the user input fields.

Specified by:
remapScheduleToUserInputFields in class ScheduleProperty
Parameters:
pSchedule - the Schedule Object
pRequest - the servlet's request
pResponse - the servlet's response

allFalse

protected boolean allFalse(java.lang.String pPropertyName,
                           int startIndex)
This method checks whether the values of a property are all false

Parameters:
pPropertyName - the property name whose value will be evaluated
startIndex - the start index of the property value array to be evaluated
Returns:
a boolean value, true if all the array values are false

countTrueValues

protected int countTrueValues(boolean[] pValues,
                              int startIndex)
This method counts the true value of a boolean array

Parameters:
pValues - the boolean array to be evaluated
startIndex - the start index of the array to be evaluated
Returns:
the number of true values in the array

getReadableScheduleString

public java.lang.String getReadableScheduleString(DynamoHttpServletRequest pRequest,
                                                  DynamoHttpServletResponse pResponse,
                                                  Schedule pSchedule)
This method returns a human-readable schedule String.

Specified by:
getReadableScheduleString in class ScheduleProperty
Parameters:
pSchedule - the schedule object
Returns:
a human-readable schedule string

getReadableDailyScheduleString

protected java.lang.String getReadableDailyScheduleString(Schedule pSchedule)
This method returns a human-readable daily schedule String.

Parameters:
pSchedule - the schedule object
Returns:
a human-readable daily schedule string

getReadableWeeklyScheduleString

protected java.lang.String getReadableWeeklyScheduleString(Schedule pSchedule)
This method returns a human-readable weekly schedule String.

Parameters:
pSchedule - the schedule object
Returns:
a human-readable weekly schedule string

getReadableMonthlyScheduleString

protected java.lang.String getReadableMonthlyScheduleString(Schedule pSchedule)
This method returns a human-readable monthly schedule String.

Parameters:
pSchedule - the schedule object
Returns:
a human-readable monthly schedule string

getReadableDaysOfTheWeek

protected java.lang.String getReadableDaysOfTheWeek(boolean[] pDays)
This method returns a human-readable day of the week String. Example: Monday,Tuesday and Saturday

Parameters:
pDays - a boolean array indicating which days are selected
Returns:
a human-readable day of the week String.

getReadableOccurancesOfTheMonth

protected java.lang.String getReadableOccurancesOfTheMonth(boolean[] pNumbers)
Deprecated. because of misspelling

This method returns a human-readable occurrence of the month String. Example: first,second and fourth

See Also:
getReadableOccurrencesOfTheMonth

getReadableOccurrencesOfTheMonth

protected java.lang.String getReadableOccurrencesOfTheMonth(boolean[] pNumbers)
This method returns a human-readable occurrence of the month String. Example: first,second and fourth

Parameters:
pNumbers - a boolean array indicating which occurrences are selected
Returns:
a human-readable occurrence of the month String.

getReadableStringList

protected java.lang.String getReadableStringList(boolean[] pInclude,
                                                 java.lang.String[] pStringList)
This method translates a boolean array to a String.

Parameters:
pInclude - a boolean array to be translated
pStringList - a String array as the translation is looking for
Returns:
a translated String.

initializeUserInputFields

public void initializeUserInputFields()
This method initializes all the user inputs.

Specified by:
initializeUserInputFields in class ComplexScheduledOrderProperty

initializeUserInputField

protected void initializeUserInputField(java.lang.String pUserInputFieldName)
This method initializes the user input values for a particular user input.

Parameters:
pUserInputFieldName - the user input field name