private static boolean computeActive(DateTime activeFromDate, DateTime activeToDate, DateTime activeAsOfDate) { // the precision of this check should be to the second, not milliseconds, so we want to chop off any // milliseconds and do a ceiling of our seconds. Sometimes changes are made in near real time after a record // becomes activated or inactivated so we want to have the best result possible if they are still within the // same second, so we essentially always round up to ensure that this check will never fail in high throughput // environments activeAsOfDate = activeAsOfDate.secondOfDay().roundCeilingCopy(); return (activeFromDate == null || activeAsOfDate.getMillis() >= activeFromDate.getMillis()) && (activeToDate == null || activeAsOfDate.getMillis() < activeToDate.getMillis()); }
public DateTime maxDateTime(DateTime dateTime) { switch (this) { case YEAR: return dateTime.dayOfYear().withMaximumValue() .secondOfDay().withMaximumValue(); case QUARTER: // TODO: case MONTH: return dateTime.dayOfMonth().withMaximumValue() .secondOfDay().withMaximumValue(); case DAY: return dateTime.secondOfDay().withMaximumValue(); case HOUR: return dateTime.minuteOfHour().withMaximumValue() .secondOfMinute().withMaximumValue(); case MINUTE: case SECOND: return dateTime.secondOfMinute().withMaximumValue(); } return dateTime; }
private ProgressSnapshot createEndOfSeriesEntry(ProgressSnapshot latestSnapshot, Optional<Point> intersection) { return ProgressSnapshot.forRequirementType(latestSnapshot.getRequirementType()) .atTime(latestSnapshot.getTime().plus(1).secondOfDay().getDateTime()) .and(0).failed() .and(0).completed() .and(latestSnapshot.getCompleted()).estimated() .outOf(latestSnapshot.getTotal()) .forBuild("ESTIMATED_DONE_DATE"); }