org.broadleafcommerce.common.time
Class SystemTime

java.lang.Object
  extended by org.broadleafcommerce.common.time.SystemTime

public class SystemTime
extends Object


Constructor Summary
SystemTime()
           
 
Method Summary
static Calendar asCalendar()
           
static Calendar asCalendar(boolean includeTime)
           
static Calendar asCalendar(Locale locale)
           
static Calendar asCalendar(Locale locale, TimeZone timeZone, boolean includeTime)
           
static Calendar asCalendar(TimeZone timeZone)
           
static Date asDate()
           
static Date asDate(boolean includeTime)
           
static long asMillis()
           
static long asMillis(boolean includeTime)
           
static Date getCurrentDateWithinTimeResolution(Date cachedDate, Long dateResolutionMillis)
          Many DAO objects in Broadleaf use a cached time concept.
static TimeSource getTimeSource()
           
static void reset()
           
static void resetGlobalTimeSource()
           
static void resetLocalTimeSource()
           
static void setGlobalTimeSource(TimeSource globalTS)
           
static void setLocalTimeSource(TimeSource localTS)
           
static boolean shouldCacheDate()
          Returns false if the current time source is a FixedTimeSource indicating that the time is being overridden.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemTime

public SystemTime()
Method Detail

getTimeSource

public static TimeSource getTimeSource()

setGlobalTimeSource

public static void setGlobalTimeSource(TimeSource globalTS)

resetGlobalTimeSource

public static void resetGlobalTimeSource()

setLocalTimeSource

public static void setLocalTimeSource(TimeSource localTS)

resetLocalTimeSource

public static void resetLocalTimeSource()

reset

public static void reset()

asMillis

public static long asMillis()

asMillis

public static long asMillis(boolean includeTime)

asDate

public static Date asDate()

asDate

public static Date asDate(boolean includeTime)

asCalendar

public static Calendar asCalendar()

asCalendar

public static Calendar asCalendar(boolean includeTime)

asCalendar

public static Calendar asCalendar(Locale locale)

asCalendar

public static Calendar asCalendar(TimeZone timeZone)

shouldCacheDate

public static boolean shouldCacheDate()
Returns false if the current time source is a FixedTimeSource indicating that the time is being overridden. For example to preview items in a later time.

Returns:

getCurrentDateWithinTimeResolution

public static Date getCurrentDateWithinTimeResolution(Date cachedDate,
                                                      Long dateResolutionMillis)
Many DAO objects in Broadleaf use a cached time concept. Since most entities have an active start and end date, the DAO may ask for a representation of "NOW" that is within some threshold. By default, most entities cache active-date queries to every 10 seconds. These DAO classes can be overridden to extend or decrease this default.

Returns:

asCalendar

public static Calendar asCalendar(Locale locale,
                                  TimeZone timeZone,
                                  boolean includeTime)


Copyright © 2013. All Rights Reserved.