Example usage for org.joda.time.tz CachedDateTimeZone forZone

List of usage examples for org.joda.time.tz CachedDateTimeZone forZone

Introduction

In this page you can find the example usage for org.joda.time.tz CachedDateTimeZone forZone.

Prototype

public static CachedDateTimeZone forZone(DateTimeZone zone) 

Source Link

Document

Returns a new CachedDateTimeZone unless given zone is already cached.

Usage

From source file:org.opentestsystem.delivery.Sb11TimeZoneBuilder.java

License:Open Source License

public Sb11TimeZoneBuilder(final String timeZone) {
    cachedDateTimeZone = CachedDateTimeZone.forZone(DateTimeZone.forID(timeZone));
}

From source file:org.opentestsystem.delivery.Sb11TimeZoneBuilder.java

License:Open Source License

@PostConstruct
public void init() {
    //default to 'user' timezone which would be local server time, which gets replaced with the client's configured TZ if found.
    cachedDateTimeZone = CachedDateTimeZone.forZone(DateTimeZone.forID(System.getProperty("user.timezone")));
    List<ClientEntity> clientEntityList = entityService.findAll(ClientEntity.FORMAT_TYPE);
    if (clientEntityList != null && !clientEntityList.isEmpty()) {
        ClientEntity clientEntity = clientEntityList.get(0);
        if (clientEntity.getTimeZone() != null && !clientEntity.getTimeZone().isEmpty()) {
            if (!DateTimeZone.getAvailableIDs().contains(clientEntity.getTimeZone())) {
                LOGGER.error("misconfiguration (invalid timezone id): " + clientEntity.getTimeZone());
            } else {
                cachedDateTimeZone = CachedDateTimeZone.forZone(DateTimeZone.forID(clientEntity.getTimeZone()));
            }//from   ww w.j a  v a  2  s. c o  m
        }
    }
}