private void attachInsertProperties(IEmgr<?> emgr, PfHistoryMasterDO hm) { // EntityMetadata ent = emfac.getMetadataRepository().findEntityMetadata(hm.getEntityName()); // a dummy entry. String newVal = ""; String oldVal = ""; String propertyName = ""; String propertyType = "java.lang.String"; DiffEntry de = new DiffEntry(); HistProp newp = new HistProp(propertyName, propertyType, newVal); de.setNewProp(newp); HistProp oldp = new HistProp(propertyName, propertyType, oldVal); de.setOldProp(oldp); de.setPropertyName(propertyName); de.setPropertyOpType(getPropOpTypeFrom(hm.getEntityOpType())); HistoryServiceImpl.putHistProp(hm, de); }
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; }
if (prop.getNewProp() != null) { this.propertyType = prop.getNewProp().getType(); if (prop.getOldProp() != null) { this.propertyType = prop.getOldProp().getType(); this.newValue = prop.getNewValue(); this.oldValue = prop.getOldValue(); Object oldObjectValue = null; Object newObjectValue = null; oldObjectValue = getObjectValue(userGroupCache, session, prop.getOldProp()); } catch (final Exception ex) { oldObjectValue = "???"; log.warn("Error while try to parse old object value '" + prop.getOldValue() + "' of prop-type '" + prop.getClass().getName() newObjectValue = getObjectValue(userGroupCache, session, prop.getNewProp()); } catch (final Exception ex) { newObjectValue = "???"; log.warn("Error while try to parse new object value '" + prop.getNewValue() + "' of prop-type '" + prop.getClass().getName() this.propertyName = prop.getPropertyName();
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 } }
String propertyType = rcs.getString("property_type"); propertyType = expandPropType(emgr, propertyType); DiffEntry de = new DiffEntry(); HistProp newp = new HistProp(propertyName, propertyType, newVal); de.setNewProp(newp); HistProp oldp = new HistProp(propertyName, propertyType, oldVal); de.setOldProp(oldp); de.setPropertyName(propertyName); de.setPropertyOpType(getPropOpTypeFrom(hm.getEntityOpType())); HistoryServiceImpl.putHistProp(hm, de); });