com.ibm.commerce.subscription.commands

Class SimpleScheduleEvaluateCmdImpl

  • All Implemented Interfaces:
    com.ibm.commerce.command.CacheableECCommand, ECCommand, ECTargetableCommand, TaskCommand, ScheduleEvaluateCmd, 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 SimpleScheduleEvaluateCmdImpl
    extends TaskCommandImpl
    implements ScheduleEvaluateCmd
    This class evaluates the simple schedule information where in it uses the Frequency and the start date, it computes the next occurrence. If the schedule is not time-bound, this class sets the end date to SubscriptionFacadeConstants.MAXIMUM_DATE. If the scheduled is time bound, this class computes :
    • The total occurrences and duration if the end date is specified.
    • The end date and total occurrences if the duration is specified.
    • The end date and duration if the total occurrences is specified.
    When the command is set to compute the next occurrence from the previous occurrence, this class computes the next occurrence based on the frequency.
    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

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

      • SimpleScheduleEvaluateCmdImpl

        public SimpleScheduleEvaluateCmdImpl()
        Default constructor for the class.
    • Method Detail

      • computeFullSchedule

        public void computeFullSchedule()
                                 throws com.ibm.commerce.foundation.internal.common.exception.FoundationApplicationException
        This method computes the complete schedule information using the schedule information provided through ScheduleInfoType that was set using setScheduleToEvaluate method. The method validates the information in the ScheduleInfoType and computes the total number of occurrences, duration or the end date related info based on the input values specified. It then saves the fully computed schedule information back into ScheduleInfoType.
        Specified by:
        computeFullSchedule in interface ScheduleEvaluateCmd
        Throws:
        com.ibm.commerce.foundation.internal.common.exception.FoundationApplicationException
      • nextOccurrence

        public java.util.Date nextOccurrence()
        This method returns the next occurrence of the schedule from the current date.
        Specified by:
        nextOccurrence in interface ScheduleEvaluateCmd
        Returns:
        The next occurrence of the schedule.
      • setScheduleToEvaluate

        public void setScheduleToEvaluate(com.ibm.commerce.foundation.common.datatypes.ScheduleInfoType scheduleInfo)
        Sets the schedule to be evaluated.
        Specified by:
        setScheduleToEvaluate in interface ScheduleEvaluateCmd
        Parameters:
        scheduleInfo - The schedule information object to be evaluated.
      • validateSchedule

        public void validateSchedule()
                              throws com.ibm.commerce.foundation.internal.common.exception.FoundationApplicationException
        This method validates if the schedule information provided is sufficient to evaluate it. Use this method to check if the parameters required to compute the schedule is available or not.
        Specified by:
        validateSchedule in interface ScheduleEvaluateCmd
        Throws:
        com.ibm.commerce.foundation.internal.common.exception.FoundationApplicationException
      • performExecute

        public void performExecute()
                            throws ECException
        Based on the value returned by the getEvaluateMode method, this method invokes the computeFullSchedule method to compute the schedule information or the computeNextOccurrence method to compute the details of the next occurrence.
        Specified by:
        performExecute in interface ECCommand
        Specified by:
        performExecute in interface com.ibm.websphere.command.TargetableCommand
        Overrides:
        performExecute in class AbstractECTargetableCommand
        Throws:
        ECException
      • isScheduleEnded

        public boolean isScheduleEnded()
        This method indicates if the schedule has ended. It should be called only after the command has been executed successfully. This method expects the end date to be passed if the evaluation mode is to compute the next occurrence.
        Specified by:
        isScheduleEnded in interface ScheduleEvaluateCmd
        Returns:
        If the schedule has ended or not.
      • setComputeFullSchedule

        public void setComputeFullSchedule()
        This method sets the evaluation mode of the command to compute the full schedule.
        Specified by:
        setComputeFullSchedule in interface ScheduleEvaluateCmd
      • setComputeNextOccurenceFromSchedule

        public void setComputeNextOccurenceFromSchedule()
        This method sets the evaluation mode of the command to compute the next occurrence of the schedule.
        Specified by:
        setComputeNextOccurenceFromSchedule in interface ScheduleEvaluateCmd
      • setPreviousOccurrence

        public void setPreviousOccurrence(java.util.Date previousOccurrence)
        This method sets the previous occurrence of the schedule for the command to calculate its next occurrence.
        Specified by:
        setPreviousOccurrence in interface ScheduleEvaluateCmd
        Parameters:
        previousOccurrence - The previous occurrence of the schedule.
      • computeNextOccurrence

        public void computeNextOccurrence()
                                   throws com.ibm.commerce.foundation.internal.common.exception.FoundationApplicationException
        This method computes the next occurrence of the schedule using the previous occurrence info and the schedule information specified through the ScheduleInfoType that was set in the setScheduleToEvaluate method. It then saves the computed value back into ScheduleInfoType.
        Specified by:
        computeNextOccurrence in interface ScheduleEvaluateCmd
        Throws:
        com.ibm.commerce.foundation.internal.common.exception.FoundationApplicationException