com.ibm.commerce.price.rule.commands.element

Class DateConditionElementCmdImpl

  • All Implemented Interfaces:
    DateConditionElementCmd, PriceRuleElementCmd, com.ibm.websphere.cache.Sizeable, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command, com.ibm.websphere.command.CommandCaller, com.ibm.websphere.command.TargetableCommand, java.io.Serializable


    public class DateConditionElementCmdImpl
    extends PriceRuleElementCmdImpl
    implements DateConditionElementCmd
    The default implementation for the date condition element command. This command is used to determine whether date condition is met.
    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
      • CLASSNAME

        public static final java.lang.String CLASSNAME
        The name of this class.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DateConditionElementCmdImpl

        public DateConditionElementCmdImpl()
    • Method Detail

      • performExecute

        public void performExecute()
                            throws java.lang.Exception
        The main logic to execute the command. The following checks are made to decide if the condition is true.
        • Whether the current date time is between start date and end date which are defined in the condition.
        • If isEveryDayOfTheWeek is false, check whether the current weekday is in the weekdays defined.
        • If isAllThroughTheDay is false, check whether the current time is within the start time and end time defined.
        Specified by:
        performExecute in interface com.ibm.websphere.command.TargetableCommand
        Overrides:
        performExecute in class PriceRuleElementCmdImpl
        Throws:
        java.lang.Exception
      • getCurrentTime

        public java.sql.Timestamp getCurrentTime()
        Returns the current time from the command context. First, check if pricing date is specified in runtime parameters, which in turn comes from the request properties in original command context when invoking the price rule engine. If not found, check the time from the preview context. Then, check the time from the command context. Finally, check the time from the request properties. If there is no time in the request properties, get the current system time and save it in the request properties for next use.
        Returns:
        The current time. It doesn't return null.
      • validateParameters

        public java.util.List validateParameters(java.util.Map elementParameters)
        This method performs validations.
        Specified by:
        validateParameters in interface PriceRuleElementCmd
        Overrides:
        validateParameters in class PriceRuleElementCmdImpl
        Parameters:
        elementParameters -
        Returns:
        A list which contains all validation errors.This value will be empty if no errors found. It does not return null.