psdi.common.dateselector

Class DateSelectorUtil

  • java.lang.Object
    • psdi.common.dateselector.DateSelectorUtil


  • public class DateSelectorUtil
    extends java.lang.Object
    Common class to select a date or range of dates for an activity as well as an interval for repeats.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int DAY 
      static int DAYOFMONTH 
      static int MONTH 
      static int WEEK 
    • Constructor Summary

      Constructors 
      Constructor and Description
      DateSelectorUtil() 
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.util.Date convertDateToClientDate(java.util.Date d, java.util.Locale l, java.util.TimeZone tz) 
      static com.ibm.icu.util.Calendar getCalAfterSetPattern(java.util.Locale l, java.util.TimeZone tz, java.util.Date d, java.lang.String[] str, int repeatValue, java.lang.String timeUnit)
      creates a calendar with pattern
      static com.ibm.icu.util.Calendar getCalendarForPattern(java.lang.String d, int day, int month, java.util.Locale l, java.util.TimeZone tz, int type) 
      static com.ibm.icu.util.Calendar getCalendarForPattern(java.lang.String d, int day, int month, java.util.Locale l, java.util.TimeZone tz, java.util.Locale clientl, java.util.TimeZone clienttz, int type) 
      long getDifference()
      returns the difference from the DateSelectorUtil object
      static int getDOMAsInt(java.lang.String domStr)
      Converts days of month to int to store in the pattern
      static java.lang.String[] getIndividualString(java.lang.String pattern)
      Get the individual string from the pattern.
      static int getMonthAsInt(java.util.Locale l, java.lang.String month)
      Converts month to int to store in the pattern
      static com.ibm.icu.util.Calendar getNextCalendar(com.ibm.icu.util.Calendar c, java.lang.String[] str, int repeatValue, java.lang.String timeUnit)
      sets the calendar with the next scheduled date
      static java.util.Date getNextPreviewDate(java.util.Locale l, java.util.TimeZone tz, java.util.Date d, DateSelectorUtil ds)
      Get difference in millisecond
      static java.util.Vector getPreviewDates(java.util.Date startDate, java.util.Date endDate, java.lang.String pattern)
      method to calculate preview dates between start and end date
      static java.util.Vector getPreviewDates(java.util.Locale l, java.util.TimeZone tz, java.util.Date startDate, java.util.Date endDate, java.lang.String pattern)
      method to calculate preview dates between start and end date
      static java.util.Vector getPreviewDatesAfterTodayInServerTimeZone(java.util.Date startDate, java.lang.String pattern)
      IJ00499 Return future dates for displaying preview dates in UI
      static java.util.Vector getPreviewDatesInClientPattern(java.util.Locale l, java.util.TimeZone tz, java.util.Date startDate, java.util.Date endDate, java.lang.String pattern)
      Get preview dates with pattern as shown in Date selector UI, i.e it doesn't change with respect to server locale and timezone
      static java.util.Vector getPreviewDatesInServerTimeZone(java.util.Date startDate, java.util.Date endDate, java.lang.String pattern)
      Return date for displaying preview dates in UI
      static long getSleepingTimeInMilliSecond(java.util.Date nextScheduled, java.util.Date d)
      Get difference in millisecond
      static long getSleepingTimeInMilliSecond(DateSelectorUtil ds)
      Get difference in millisecond
      static long getSleepingTimeInMilliSecond(java.util.Date d, java.lang.String pattern)
      calculate the sleeping time
      static long getSleepingTimeInMilliSecond(java.util.Locale l, java.util.TimeZone tz, java.util.Date d, DateSelectorUtil ds)
      Get difference in millisecond
      static long getSleepingTimeInMilliSecond(java.util.Locale l, java.util.TimeZone tz, java.util.Date d, java.lang.String pattern)
      calculate the sleeping time
      static long getSleepingTimeInMilliSecond(java.lang.String pattern)
      calculate the sleeping time
      static DateSelectorUtil getSleepingTimeInObject(java.util.Date d, java.lang.String pattern)
      calculate the sleeping time
      static DateSelectorUtil getSleepingTimeInObject(java.util.Locale l, java.util.TimeZone tz, java.util.Date d, java.lang.String pattern)
      calculate the sleeping time
      static DateSelectorUtil getSleepingTimeInObject(java.lang.String pattern)
      calculate the sleeping time
      static int getWeekDayAsInt(java.util.Locale l, java.lang.String weekDay)
      Converts weekday to int to store in the pattern
      • Methods inherited from class java.lang.Object

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

      • DateSelectorUtil

        public DateSelectorUtil()
    • Method Detail

      • getPreviewDates

        public static java.util.Vector getPreviewDates(java.util.Date startDate,
                                                       java.util.Date endDate,
                                                       java.lang.String pattern)
                                                throws MXException
        method to calculate preview dates between start and end date
        Parameters:
        startDate -
        endDate -
        pattern -
        Returns:
        the date vector to preview
        Throws:
        MXException
      • getPreviewDates

        public static java.util.Vector getPreviewDates(java.util.Locale l,
                                                       java.util.TimeZone tz,
                                                       java.util.Date startDate,
                                                       java.util.Date endDate,
                                                       java.lang.String pattern)
                                                throws MXException
        method to calculate preview dates between start and end date
        Parameters:
        l -
        tz -
        startDate -
        endDate -
        pattern -
        Returns:
        the date vector to preview
        Throws:
        MXException
      • getPreviewDatesAfterTodayInServerTimeZone

        public static java.util.Vector getPreviewDatesAfterTodayInServerTimeZone(java.util.Date startDate,
                                                                                 java.lang.String pattern)
                                                                          throws MXException
        IJ00499 Return future dates for displaying preview dates in UI
        Parameters:
        startDate -
        pattern -
        Returns:
        Throws:
        MXException
      • getPreviewDatesInServerTimeZone

        public static java.util.Vector getPreviewDatesInServerTimeZone(java.util.Date startDate,
                                                                       java.util.Date endDate,
                                                                       java.lang.String pattern)
                                                                throws MXException
        Return date for displaying preview dates in UI
        Parameters:
        l -
        tz -
        startDate -
        endDate -
        pattern -
        Returns:
        Throws:
        MXException
      • getPreviewDatesInClientPattern

        public static java.util.Vector getPreviewDatesInClientPattern(java.util.Locale l,
                                                                      java.util.TimeZone tz,
                                                                      java.util.Date startDate,
                                                                      java.util.Date endDate,
                                                                      java.lang.String pattern)
                                                               throws MXException
        Get preview dates with pattern as shown in Date selector UI, i.e it doesn't change with respect to server locale and timezone
        Parameters:
        l -
        tz -
        startDate -
        endDate -
        pattern -
        Returns:
        date list
        Throws:
        MXException
      • getCalAfterSetPattern

        public static com.ibm.icu.util.Calendar getCalAfterSetPattern(java.util.Locale l,
                                                                      java.util.TimeZone tz,
                                                                      java.util.Date d,
                                                                      java.lang.String[] str,
                                                                      int repeatValue,
                                                                      java.lang.String timeUnit)
                                                               throws MXException
        creates a calendar with pattern
        Parameters:
        l -
        tz -
        d -
        pattern -
        str -
        repeatValue -
        timeUnit -
        Returns:
        calendar after setting the pattern
        Throws:
        MXException
      • getIndividualString

        public static java.lang.String[] getIndividualString(java.lang.String pattern)
                                                      throws MXException
        Get the individual string from the pattern. 0 - repeats 1 - second 2 - minute 3 - hour 4 - date of month 5 - month,JAN=0 6 - year 7 - day of week 8 - first/last day of week. SUNDAY = 1 9 - first/last date of month
        Throws:
        MXException
      • getNextCalendar

        public static com.ibm.icu.util.Calendar getNextCalendar(com.ibm.icu.util.Calendar c,
                                                                java.lang.String[] str,
                                                                int repeatValue,
                                                                java.lang.String timeUnit)
                                                         throws MXException
        sets the calendar with the next scheduled date
        Parameters:
        c -
        pattern -
        str -
        repeatValue -
        timeUnit -
        Returns:
        the next calendar date after the start date
        Throws:
        MXException
      • getSleepingTimeInObject

        public static DateSelectorUtil getSleepingTimeInObject(java.lang.String pattern)
                                                        throws MXException
        calculate the sleeping time
        Parameters:
        pattern -
        Returns:
        DateSelectorUtil Object
        Throws:
        MXException
      • getSleepingTimeInObject

        public static DateSelectorUtil getSleepingTimeInObject(java.util.Date d,
                                                               java.lang.String pattern)
                                                        throws MXException
        calculate the sleeping time
        Parameters:
        d -
        pattern -
        Returns:
        DateSelectorUtil Object
        Throws:
        MXException
      • getSleepingTimeInObject

        public static DateSelectorUtil getSleepingTimeInObject(java.util.Locale l,
                                                               java.util.TimeZone tz,
                                                               java.util.Date d,
                                                               java.lang.String pattern)
                                                        throws MXException
        calculate the sleeping time
        Parameters:
        l -
        tz -
        d -
        pattern -
        Returns:
        DateSelectorUtil Object
        Throws:
        MXException
      • getDifference

        public long getDifference()
        returns the difference from the DateSelectorUtil object
        Parameters:
        ds -
        Returns:
        difference in millisecond
      • getSleepingTimeInMilliSecond

        public static long getSleepingTimeInMilliSecond(DateSelectorUtil ds)
                                                 throws MXException
        Get difference in millisecond
        Parameters:
        ds -
        Returns:
        difference in millisecond
        Throws:
        MXException
      • getSleepingTimeInMilliSecond

        public static long getSleepingTimeInMilliSecond(java.util.Locale l,
                                                        java.util.TimeZone tz,
                                                        java.util.Date d,
                                                        DateSelectorUtil ds)
                                                 throws MXException
        Get difference in millisecond
        Parameters:
        d -
        ds -
        Returns:
        difference in millisecond
        Throws:
        MXException
      • getSleepingTimeInMilliSecond

        public static long getSleepingTimeInMilliSecond(java.util.Date nextScheduled,
                                                        java.util.Date d)
                                                 throws MXException
        Get difference in millisecond
        Parameters:
        nextScheduled - the future date
        d - the current date
        Returns:
        difference in millisecond
        Throws:
        MXException
      • getNextPreviewDate

        public static java.util.Date getNextPreviewDate(java.util.Locale l,
                                                        java.util.TimeZone tz,
                                                        java.util.Date d,
                                                        DateSelectorUtil ds)
                                                 throws MXException
        Get difference in millisecond
        Parameters:
        l -
        tz -
        d -
        ds -
        Returns:
        difference in millisecond
        Throws:
        MXException
      • getSleepingTimeInMilliSecond

        public static long getSleepingTimeInMilliSecond(java.lang.String pattern)
                                                 throws MXException
        calculate the sleeping time
        Parameters:
        pattern -
        Returns:
        sleep time in milliseconds
        Throws:
        MXException
      • getSleepingTimeInMilliSecond

        public static long getSleepingTimeInMilliSecond(java.util.Date d,
                                                        java.lang.String pattern)
                                                 throws MXException
        calculate the sleeping time
        Parameters:
        d -
        pattern -
        Returns:
        sleep time in milliseconds
        Throws:
        MXException
      • getSleepingTimeInMilliSecond

        public static long getSleepingTimeInMilliSecond(java.util.Locale l,
                                                        java.util.TimeZone tz,
                                                        java.util.Date d,
                                                        java.lang.String pattern)
                                                 throws MXException
        calculate the sleeping time
        Parameters:
        l -
        tz -
        d -
        pattern -
        Returns:
        sleep time in milliseconds
        Throws:
        MXException
      • getWeekDayAsInt

        public static int getWeekDayAsInt(java.util.Locale l,
                                          java.lang.String weekDay)
                                   throws MXException
        Converts weekday to int to store in the pattern
        Parameters:
        l -
        weekDay -
        Returns:
        Throws:
        MXException
      • getMonthAsInt

        public static int getMonthAsInt(java.util.Locale l,
                                        java.lang.String month)
                                 throws MXException
        Converts month to int to store in the pattern
        Parameters:
        l -
        month -
        Returns:
        Throws:
        MXException
      • getDOMAsInt

        public static int getDOMAsInt(java.lang.String domStr)
                               throws MXException
        Converts days of month to int to store in the pattern
        Parameters:
        domStr -
        Returns:
        Throws:
        MXException
      • getCalendarForPattern

        public static com.ibm.icu.util.Calendar getCalendarForPattern(java.lang.String d,
                                                                      int day,
                                                                      int month,
                                                                      java.util.Locale l,
                                                                      java.util.TimeZone tz,
                                                                      int type)
                                                               throws MXApplicationException
        Throws:
        MXApplicationException
      • getCalendarForPattern

        public static com.ibm.icu.util.Calendar getCalendarForPattern(java.lang.String d,
                                                                      int day,
                                                                      int month,
                                                                      java.util.Locale l,
                                                                      java.util.TimeZone tz,
                                                                      java.util.Locale clientl,
                                                                      java.util.TimeZone clienttz,
                                                                      int type)
                                                               throws MXApplicationException
        Throws:
        MXApplicationException