logEntriesQ.setTimestamp("cutoff", new java.sql.Timestamp(cutoff.getTime()));
logEntries = logEntriesQ.iterate();
}
List wgLogs = new ArrayList();
LinkedMap wgLogsByTarget = new LinkedMap();
Map conflictTargets = new HashMap();
LogEntry entry;
// First pass: Create update logs
while (logEntries.hasNext()) {
entry = (LogEntry) logEntries.next();
WGUpdateLog newLog = null;
WGUpdateLog oldLog = null;
Date currentTime = null;
if (entry.getTarget() != null && !entry.getTarget().equals("#UNKNOWN#")) {
newLog = new WGUpdateLog(entry.getType(), entry.getLogtime(), entry.getLoguser(), entry.getTarget());
wgLogs.add(newLog);
List logsList = (List) wgLogsByTarget.get(entry.getTarget());
if (logsList == null) {
logsList = new ArrayList();
wgLogsByTarget.put(entry.getTarget(), logsList);
}
logsList.add(newLog);
}
}
// Second pass for CS version < 5 to workaround some weaknesses of the CS3/4 history log
if (_ddlVersion < WGDatabase.CSVERSION_WGA5) {
// Determine conflicting log entries, where update and delete is done on the same time and the same document
Iterator wgLogsByTargetIt = wgLogsByTarget.values().iterator();
while (wgLogsByTargetIt.hasNext()) {
List logs = (List) wgLogsByTargetIt.next();
WGUtils.sortByProperty(logs, "date");
Iterator logsIt = logs.iterator();
Date lastTime = null;