private static Optional<Date> findLastChangeOfEmployeeStatusInHistory(final EmployeeDO employee) { final Predicate<HistoryEntry> hasStatusChangeHistoryEntries = historyEntry -> ((HistoryEntry<?>) historyEntry) .getDiffEntries() .stream() .anyMatch( diffEntry -> diffEntry.getPropertyName().startsWith("status") ); return HistoryBaseDaoAdapter .getHistoryEntries(employee) .stream() .filter(hasStatusChangeHistoryEntries) .map(HistoryEntry::getModifiedAt) .findFirst(); // the history entries are already sorted by date } }
public static PropertyDelta diffEntryToPropertyDelta(DiffEntry de) { long begin = System.currentTimeMillis(); SimplePropertyDelta ret = new SimplePropertyDelta(de.getPropertyName(), String.class, de.getOldValue(), de.getNewValue()); long end = System.currentTimeMillis(); log.info("HistoryBaseDaoAdapter.diffEntryToPropertyDelta took: " + (end - begin) + " ms."); return ret; }
this.propertyName = prop.getPropertyName();