/** * Parses the date defined in the application configuration properties as <code>ontrack.version.date</code>. */ public static LocalDateTime parseDate(String value) { if (StringUtils.isBlank(value)) { logger.info("[version-info] No date defined, using current date."); return Time.now(); } else { try { return LocalDateTime.parse(value, DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss")); } catch (DateTimeParseException ex) { logger.warn("[version-info] Wrong date format, using current date: " + value); return Time.now(); } } } }
public Signature withTime(LocalDateTime dateTime) { return new Signature(dateTime != null ? dateTime : Time.now(), user); } }
public static Signature of(String name) { return of(Time.now(), name); }
private static ApplicationLogEntry create(ApplicationLogEntryLevel level, Throwable exception, NameDescription type, String information) { return new ApplicationLogEntry( level, Time.now(), null, type, information, null, Collections.emptyMap() ).withStacktrace(ExceptionUtils.getStackTrace(exception)); }
public static Signature none() { return new Signature( Time.now(), User.anonymous() ); }
@Override public void cleanup(int retentionDays) { LocalDateTime pivotDate = Time.now().minus(retentionDays, ChronoUnit.DAYS); getNamedParameterJdbcTemplate().update( "DELETE FROM APPLICATION_LOG_ENTRIES WHERE TIMESTAMP < :date", params("date", dateTimeForDB(pivotDate)) ); }
message = Objects.toString(message, ""); LocalDateTime dateTime = Time.from(date, Time.now());