org.kuali.hr.time.util
Class TKUtils

java.lang.Object
  extended by org.kuali.hr.time.util.TKUtils

public class TKUtils
extends Object


Constructor Summary
TKUtils()
           
 
Method Summary
static Date addDates(Date aDate, int aNumber)
           
static String arrayToString(String[] stringArray)
           
static Timestamp convertDateStringToTimestamp(String dateStr)
          Creates a Timestamp object using Jodatime as an intermediate data structure from the provided date and time string.
static Timestamp convertDateStringToTimestamp(String dateStr, String timeStr)
          Creates a Timestamp object using Jodatime as an intermediate data structure from the provided date and time string.
static Timestamp convertDateStringToTimestampNoTimezone(String dateStr)
          Creates a Timestamp object using Jodatime as an intermediate data structure from the provided date and time string.
static Timestamp convertDateStringToTimestampWithoutZone(String dateStr, String timeStr)
           
static long convertHoursToMillis(BigDecimal hours)
           
static BigDecimal convertMillisToDays(long millis)
           
static BigDecimal convertMillisToHours(long millis)
           
static int convertMillisToWholeDays(long millis)
           
static BigDecimal convertMinutesToHours(BigDecimal minutes)
           
static Date createDate(int month, int day, int year, int hours, int minutes, int seconds)
           
static List<org.joda.time.Interval> createDaySpan(org.joda.time.DateTime beginDateTime, org.joda.time.DateTime endDateTime, org.joda.time.DateTimeZone zone)
           
static Map<String,String> formatAssignmentDescription(Assignment assignment)
           
static String formatAssignmentKey(Long jobNumber, Long workArea, Long task)
           
static String formatDate(Date dt)
           
static Date formatDateString(String date)
           
static String formatDateTime(Timestamp timestamp)
           
static String getAssignmentString(Assignment assignment)
           
static Date getCurrentDate()
           
static Timestamp getCurrentTimestamp()
           
static String getDayOfMonthFromDateString(String dateString)
           
static long getDaysBetween(Calendar startDate, Calendar endDate)
           
static long getDaysBetween(Date startDate, Date endDate)
           
static List<org.joda.time.Interval> getDaySpanForCalendarEntry(CalendarEntries calendarEntry)
           
static List<org.joda.time.Interval> getDaySpanForCalendarEntry(CalendarEntries calendarEntry, org.joda.time.DateTimeZone timeZone)
          Constructs a list of Day Spans for the pay calendar entry provided.
static List<org.joda.time.Interval> getFullWeekDaySpanForCalendarEntry(CalendarEntries calendarEntry)
           
static List<org.joda.time.Interval> getFullWeekDaySpanForCalendarEntry(CalendarEntries calendarEntry, org.joda.time.DateTimeZone timeZone)
           
static BigDecimal getHoursBetween(long start, long end)
           
static String getIPAddressFromRequest(javax.servlet.http.HttpServletRequest request)
           
static String getIPNumber()
           
static int getNumberOfWeeks(Date beginDate, Date endDate)
           
static int getSessionTimeoutTime()
          Get the session timeout time.
static org.joda.time.DateTimeZone getSystemDateTimeZone()
           
static String getSystemTimeZone()
           
static Date getTimelessDate(Date date)
          Returns a enforced timeless version of the provided date, if the date is null the current date is returned.
static String getTimezoneOffset(org.joda.time.DateTime date)
          Method to obtain the timezone offset string for the specified date time.
static List<org.joda.time.Interval> getWeekIntervals(Date beginDate, Date endDate)
          Includes partial weeks if the time range provided does not divide evenly into 7 day spans.
static int getWorkDays(Date startDate, Date endDate)
           
static boolean isVirtualWorkDay(Calendar payCalendarStartTime)
           
static boolean isWeekend(Date aDate)
           
static Date removeTime(Date date)
           
static Date subtractOneMillisecondFromDate(Date date)
           
static Timestamp subtractOneSecondFromTimestamp(Timestamp originalTimestamp)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TKUtils

public TKUtils()
Method Detail

getCurrentDate

public static Date getCurrentDate()

getDayOfMonthFromDateString

public static String getDayOfMonthFromDateString(String dateString)
Parameters:
dateString - the format has to be mm/dd/yyyy
Returns:
dayOfMonth

getSystemTimeZone

public static String getSystemTimeZone()

getSystemDateTimeZone

public static org.joda.time.DateTimeZone getSystemDateTimeZone()

getTimelessDate

public static Date getTimelessDate(Date date)
Returns a enforced timeless version of the provided date, if the date is null the current date is returned.

Parameters:
date -
Returns:
A java.sql.Date version of the provided date, if provided date is null, the current date is returned.

getDaysBetween

public static long getDaysBetween(Calendar startDate,
                                  Calendar endDate)

getDaysBetween

public static long getDaysBetween(Date startDate,
                                  Date endDate)

getHoursBetween

public static BigDecimal getHoursBetween(long start,
                                         long end)

getNumberOfWeeks

public static int getNumberOfWeeks(Date beginDate,
                                   Date endDate)

formatAssignmentKey

public static String formatAssignmentKey(Long jobNumber,
                                         Long workArea,
                                         Long task)

formatAssignmentDescription

public static Map<String,String> formatAssignmentDescription(Assignment assignment)

getAssignmentString

public static String getAssignmentString(Assignment assignment)

getDaySpanForCalendarEntry

public static List<org.joda.time.Interval> getDaySpanForCalendarEntry(CalendarEntries calendarEntry,
                                                                      org.joda.time.DateTimeZone timeZone)
Constructs a list of Day Spans for the pay calendar entry provided. You must also provide a DateTimeZone so that we can create relative boundaries.

Parameters:
calendarEntry -
timeZone -
Returns:

getWeekIntervals

public static List<org.joda.time.Interval> getWeekIntervals(Date beginDate,
                                                            Date endDate)
Includes partial weeks if the time range provided does not divide evenly into 7 day spans.

Parameters:
beginDate - Starting Date/Time
endDate - Ending Date/Time
Returns:
A List of Intervals of 7 day spans. The last Interval in the list may be less than seven days.

convertHoursToMillis

public static long convertHoursToMillis(BigDecimal hours)

convertMillisToHours

public static BigDecimal convertMillisToHours(long millis)

convertMillisToDays

public static BigDecimal convertMillisToDays(long millis)

convertMinutesToHours

public static BigDecimal convertMinutesToHours(BigDecimal minutes)

convertMillisToWholeDays

public static int convertMillisToWholeDays(long millis)

isVirtualWorkDay

public static boolean isVirtualWorkDay(Calendar payCalendarStartTime)

convertDateStringToTimestamp

public static Timestamp convertDateStringToTimestamp(String dateStr,
                                                     String timeStr)
Creates a Timestamp object using Jodatime as an intermediate data structure from the provided date and time string. (From the form POST and javascript formats)

Parameters:
dateStr - (the format is 01/01/2011)
timeStr - (the format is 8:0)
Returns:
Timestamp

convertDateStringToTimestampWithoutZone

public static Timestamp convertDateStringToTimestampWithoutZone(String dateStr,
                                                                String timeStr)

getIPAddressFromRequest

public static String getIPAddressFromRequest(javax.servlet.http.HttpServletRequest request)

createDate

public static Date createDate(int month,
                              int day,
                              int year,
                              int hours,
                              int minutes,
                              int seconds)

getIPNumber

public static String getIPNumber()

subtractOneSecondFromTimestamp

public static Timestamp subtractOneSecondFromTimestamp(Timestamp originalTimestamp)

subtractOneMillisecondFromDate

public static Date subtractOneMillisecondFromDate(Date date)

formatDate

public static String formatDate(Date dt)

formatDateTime

public static String formatDateTime(Timestamp timestamp)

formatDateString

public static Date formatDateString(String date)

getTimezoneOffset

public static String getTimezoneOffset(org.joda.time.DateTime date)
Method to obtain the timezone offset string for the specified date time. Examples: -0500 -0800

Parameters:
date -
Returns:

arrayToString

public static String arrayToString(String[] stringArray)

getSessionTimeoutTime

public static int getSessionTimeoutTime()
Get the session timeout time. If it's not defined in the (local) config file, give it a default time.


convertDateStringToTimestamp

public static Timestamp convertDateStringToTimestamp(String dateStr)
Creates a Timestamp object using Jodatime as an intermediate data structure from the provided date and time string. (From the form POST and javascript formats)

Parameters:
dateStr - (the format is 01/01/2011)
Returns:
Timestamp

convertDateStringToTimestampNoTimezone

public static Timestamp convertDateStringToTimestampNoTimezone(String dateStr)
Creates a Timestamp object using Jodatime as an intermediate data structure from the provided date and time string. (From the form POST and javascript formats)

Parameters:
dateStr - (the format is 01/01/2011)
Returns:
Timestamp

getCurrentTimestamp

public static Timestamp getCurrentTimestamp()

createDaySpan

public static List<org.joda.time.Interval> createDaySpan(org.joda.time.DateTime beginDateTime,
                                                         org.joda.time.DateTime endDateTime,
                                                         org.joda.time.DateTimeZone zone)

getDaySpanForCalendarEntry

public static List<org.joda.time.Interval> getDaySpanForCalendarEntry(CalendarEntries calendarEntry)

getFullWeekDaySpanForCalendarEntry

public static List<org.joda.time.Interval> getFullWeekDaySpanForCalendarEntry(CalendarEntries calendarEntry)

getFullWeekDaySpanForCalendarEntry

public static List<org.joda.time.Interval> getFullWeekDaySpanForCalendarEntry(CalendarEntries calendarEntry,
                                                                              org.joda.time.DateTimeZone timeZone)

removeTime

public static Date removeTime(Date date)

getWorkDays

public static int getWorkDays(Date startDate,
                              Date endDate)

isWeekend

public static boolean isWeekend(Date aDate)

addDates

public static Date addDates(Date aDate,
                            int aNumber)


Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.