com.ibm.commerce.marketing.promotion.schedule

Class TimeRangeSchedule

  • java.lang.Object
    • com.ibm.commerce.marketing.promotion.schedule.TimeRangeSchedule
  • All Implemented Interfaces:
    Schedule, ScheduleLookAheadSupport, XMLizable, java.io.Serializable
    Direct Known Subclasses:
    DateRangeSchedule, TimeRangeWithinADaySchedule


    public class TimeRangeSchedule
    extends java.lang.Object
    implements Schedule, ScheduleLookAheadSupport
    This class is used for representing the time range of a promotion where any promotion can be active during a certain period of time defined by a start and end time.

    XML Snippet for TimeRangeSchedule:

     <TimeRange impl="com.ibm.commerce.marketing.promotion.schedule.TimeRangeSchedule">
                    <Start inclusive="true">00:00:00</Start>
                    <End inclusive="false">23:59:59</End>
     </TimeRange>
     
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      TimeRangeSchedule()
      Default Constructor
      TimeRangeSchedule(java.util.Date aStartTime, java.util.Date anEndTime)
      Constructor
      TimeRangeSchedule(java.util.Date aStartTime, java.util.Date anEndTime, boolean anIncludeStart, boolean anIncludeEnd)
      Constructor
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void calculateNextStateAndExpirationTime()
      Calculates the next state shift time and the next state
      int clockResolution()
      returns the clock resolution
      static boolean convertPromotionDatesToUTC()
      Read the value of the flag "ConvertPromotionDatesToUTC" defined in the promotion component configuration file (wc-admin-component.xml) to determine if the promotion dates must be converted to or interpreted in UTC (Coordinated Universal Time).
      boolean currentState()
      Returns the current schedule state
      java.util.Date currentStateValidUntil()
      Returns the time to next state shift point
      static java.util.Date formatStringIntoDate(java.lang.String strFormat, java.lang.String value)
      This method uses the SimpleDateFormat class to parse text from a string to produce a Date.
      void fromXML(org.w3c.dom.Node node)
      Transforms the XML node into its corresponding real Object.
      java.util.Date getEndTime()
      Returns the endTime.
      java.util.Date getOverallEndDate()
      returns the overall end date, in this case whatever the value of endTime is, including the date portion
      java.util.Date getOverallStartDate()
      Returns the overall start Date, in this case whatever the value of startTime is, including the date portion
      java.util.Date getStartTime()
      Returns the startTime.
      boolean isActive()
      Checks to see if a schedule is active or not
      boolean isActiveAsOf(java.util.Date theTime)
      Checks to see if a schedule is active at a certain time
      boolean isIncludeEnd()
      Returns if the end time is included.
      boolean isIncludeStart()
      Returns if the start time is included.
      void setEndTime(java.util.Date anEndTime)
      Sets the endTime.
      void setIncludeEnd(boolean anIncludeEnd)
      Sets the includeEnd.
      void setIncludeStart(boolean anIncludeStart)
      Sets the includeStart.
      void setStartTime(java.util.Date aStartTime)
      Sets the startTime.
      java.lang.String toXML()
      Converts the object into its corresponding XML format representation.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TimeRangeSchedule

        public TimeRangeSchedule(java.util.Date aStartTime,
                                 java.util.Date anEndTime)
        Constructor
        Parameters:
        aStartTime - start time inclusive
        anEndTime - end time inclusive
      • TimeRangeSchedule

        public TimeRangeSchedule()
        Default Constructor
      • TimeRangeSchedule

        public TimeRangeSchedule(java.util.Date aStartTime,
                                 java.util.Date anEndTime,
                                 boolean anIncludeStart,
                                 boolean anIncludeEnd)
        Constructor
        Parameters:
        aStartTime - start time
        anEndTime - end time
        anIncludeStart - whether start time should be included
        anIncludeEnd - whether end time should be included
    • Method Detail

      • formatStringIntoDate

        public static java.util.Date formatStringIntoDate(java.lang.String strFormat,
                                                          java.lang.String value)
                                                   throws java.text.ParseException
        This method uses the SimpleDateFormat class to parse text from a string to produce a Date.
        Parameters:
        strFormat - The date and time pattern string
        value - The text string to parse
        Returns:
        A Date parsed from the string.
        Throws:
        java.text.ParseException
      • isActive

        public boolean isActive()
        Description copied from interface: Schedule
        Checks to see if a schedule is active or not
        Specified by:
        isActive in interface Schedule
        Returns:
        true if the schedule is active, false otherwise
        See Also:
        com.ibm.commerce.discount.mixmatch.Schedule#isActive()
      • isActiveAsOf

        public boolean isActiveAsOf(java.util.Date theTime)
        Description copied from interface: Schedule
        Checks to see if a schedule is active at a certain time
        Specified by:
        isActiveAsOf in interface Schedule
        Parameters:
        theTime - the "certain time"
        Returns:
        true, if the schedule is active at that time, false otherwise
        See Also:
        com.ibm.commerce.discount.mixmatch.Schedule#isActiveAsOf(Date)
      • currentState

        public boolean currentState()
        Returns the current schedule state
        Specified by:
        currentState in interface ScheduleLookAheadSupport
        Returns:
        current schedule state
      • getEndTime

        public java.util.Date getEndTime()
        Returns the endTime.
        Returns:
        Date of the end time.
      • isIncludeEnd

        public boolean isIncludeEnd()
        Returns if the end time is included.
        Returns:
        boolean true if the end time is included, otherwise, it is false.
      • isIncludeStart

        public boolean isIncludeStart()
        Returns if the start time is included.
        Returns:
        boolean true if the start time is included, otherwise, it is false.
      • getStartTime

        public java.util.Date getStartTime()
        Returns the startTime.
        Returns:
        Date of start time.
      • setEndTime

        public void setEndTime(java.util.Date anEndTime)
        Sets the endTime.
        Parameters:
        anEndTime - The endTime to set
      • setIncludeEnd

        public void setIncludeEnd(boolean anIncludeEnd)
        Sets the includeEnd.
        Parameters:
        anIncludeEnd - The includeEnd to set
      • setIncludeStart

        public void setIncludeStart(boolean anIncludeStart)
        Sets the includeStart.
        Parameters:
        anIncludeStart - The includeStart to set
      • setStartTime

        public void setStartTime(java.util.Date aStartTime)
        Sets the startTime.
        Parameters:
        aStartTime - The startTime to set
      • getOverallStartDate

        public java.util.Date getOverallStartDate()
        Returns the overall start Date, in this case whatever the value of startTime is, including the date portion
        Specified by:
        getOverallStartDate in interface Schedule
        Returns:
        the overall start date
      • getOverallEndDate

        public java.util.Date getOverallEndDate()
        returns the overall end date, in this case whatever the value of endTime is, including the date portion
        Specified by:
        getOverallEndDate in interface Schedule
        Returns:
        the overall end date
      • convertPromotionDatesToUTC

        public static boolean convertPromotionDatesToUTC()
        Read the value of the flag "ConvertPromotionDatesToUTC" defined in the promotion component configuration file (wc-admin-component.xml) to determine if the promotion dates must be converted to or interpreted in UTC (Coordinated Universal Time). The default value is false.
        Returns:
        A boolean value of true if the flag "ConvertPromotionDatesToUTC" is set to true; false otherwise.