List of usage examples for org.joda.time DateTimeZone UTC
DateTimeZone UTC
To view the source code for org.joda.time DateTimeZone UTC.
Click Source Link
From source file:com.picdrop.service.implementation.AuthorizationService.java
protected TokenSet.JsonWrapper generateTokens(RegisteredUser user, String nonce, String name) throws ApplicationException { JWTClaimsSet authClaims = this.authCsFact.builder().subject(user.getId()).build(); JWTClaimsSet refreshClaims = this.refreshCsFact.builder().subject(user.getId()).build(); TokenSet ts = new TokenSet(); ts.setAuthJti(authClaims.getJWTID()); ts.setRefreshJti(refreshClaims.getJWTID()); ts.setOwner(user);// w ww . ja va2s .c o m ts.setName(name); ts.setExpireAt(DateTime.now(DateTimeZone.UTC).plusMinutes(tsExpiry).toDate()); ts = this.tsRepo.save(ts); try { String authToken = tokenFactory.getToken(authClaims); String refreshToken = tokenFactory.getToken(refreshClaims); return new TokenSet.JsonWrapper().auth(authToken).refresh(refreshToken) .nonce(Strings.isNullOrEmpty(nonce) ? null : nonce); } catch (IOException ex) { throw new ApplicationException(ex).status(403); } }
From source file:com.proofpoint.event.monitor.Monitor.java
License:Apache License
@Managed public void checkState() { DateTime startTime = now(DateTimeZone.UTC); DateTime oldestGoodDateTime = startTime.minusMinutes(maxAgeInMinutes); log.info("Checking state for monitor %s", name); if (eventStore.recentEventExists(eventType, eventPredicate, oldestGoodDateTime)) { recovered(/* w ww . jav a 2 s. c o m*/ String.format("At least one event has been sent within the last %d minutes", maxAgeInMinutes)); } else { failed(String.format("Expected to have seen an event since %s (%s minutes ago), but have not", oldestGoodDateTime, maxAgeInMinutes)); } lastChecked = startTime; }
From source file:com.pzybrick.iote2e.common.utils.Iote2eUtils.java
License:Apache License
/** * Gets the date now utc 8601.// www .jav a 2 s . c o m * * @return the date now utc 8601 */ public static String getDateNowUtc8601() { return ISODateTimeFormat.dateTime().print(new DateTime().toDateTime(DateTimeZone.UTC)); }
From source file:com.pzybrick.iote2e.stream.persist.ActuatorStateDao.java
License:Apache License
/** * Actuator state from row.//w ww . ja v a2s . co m * * @param row the row * @return the actuator state */ public static ActuatorState actuatorStateFromRow(Row row) { if (row == null) return null; String loginSourceSensor = row.getString("login_source_sensor"); if (loginSourceSensor == null) return null; // not found String[] losose = loginSourceSensor.split("[|]"); ActuatorState actuatorState = new ActuatorState().setLoginName(losose[0]).setSourceName(losose[1]) .setSensorName(losose[2]).setActuatorName(row.getString("actuator_name")) .setActuatorValue(row.getString("actuator_value")).setActuatorDesc(row.getString("actuator_desc")) .setActuatorValueUpdatedAt(new DateTime(row.getTimestamp("actuator_value_updated_at")) .withZone(DateTimeZone.UTC).toString()); return actuatorState; }
From source file:com.qatickets.domain.common.DateHelper.java
License:Open Source License
public static DateTime toUserTimeZone(UserProfile user, Date dateUTC) { DateTime dt = new DateTime(dateUTC, DateTimeZone.UTC); return dt.toDateTime(user.getDateTimeZone()); }
From source file:com.qatickets.domain.common.DateHelper.java
License:Open Source License
public static Date nowUTC() { return new DateTime(DateTimeZone.UTC).toDate(); }
From source file:com.querydsl.sql.types.LocalDateTimeType.java
License:Apache License
@Override public LocalDateTime getValue(ResultSet rs, int index) throws SQLException { Timestamp ts = rs.getTimestamp(index, utc()); return ts != null ? new LocalDateTime(ts.getTime(), DateTimeZone.UTC) : null; }
From source file:com.querydsl.sql.types.LocalDateTimeType.java
License:Apache License
@Override public void setValue(PreparedStatement st, int index, LocalDateTime value) throws SQLException { DateTime dt = value.toDateTime(DateTimeZone.UTC); st.setTimestamp(index, new Timestamp(dt.getMillis()), utc()); }
From source file:com.querydsl.sql.types.LocalDateType.java
License:Apache License
@Override public LocalDate getValue(ResultSet rs, int startIndex) throws SQLException { Date date = rs.getDate(startIndex, utc()); return date != null ? new LocalDate(date.getTime(), DateTimeZone.UTC) : null; }
From source file:com.querydsl.sql.types.LocalDateType.java
License:Apache License
@Override public void setValue(PreparedStatement st, int startIndex, LocalDate value) throws SQLException { st.setDate(startIndex, new Date(value.toDateTimeAtStartOfDay(DateTimeZone.UTC).getMillis()), utc()); }