continue;
}
// create new task to be persisted/merged
Date operDate = new Date();
IntEvent intEvent = new IntEvent();
intEvent.setStatus(IntEvent.Status.REGISTERED);
intEvent.setEventUri(eventUri);
intEvent.getFingerprint().setInsertDate(operDate);
intEvent.getFingerprint().setUpdateDate(operDate);
intEvent.setEventGroup(tds.get(2).text());
intEvent.setEventName(tds.get(3).text());
String dateString = tds.get(4).text() + " " + tds.get(5).text();
try {
intEvent.setEventDate(eventDateFmt.parse(dateString));
} catch (ParseException e) {
log.append("[ERROR]: unable to parse date string: ").append(dateString)
.append(": ").append(e.getMessage()).append("\n");
errors++;
continue;
}
String updateDateString = tds.get(1).text();
try {
Date updateDate = updateDateFmt.parse(updateDateString);
if (updateDate.compareTo(maxUpdateDate) > 0) {
maxUpdateDate = updateDate;
}
} catch (ParseException e) {
log.append("[WARN]: unable to parse update date string: ").append(dateString)
.append(": ").append(e.getMessage()).append("\n");
}
// find persistent task with matching event uri
EventTaskQuery query = new EventTaskQuery();
query.getEntity().setEventUri(eventUri);
IntEvent persistent = dao.findUnique(query);
StringBuilder detailLog = null;
try {
boolean changed = false;
if (persistent == null) {
dao.persist(intEvent);
log.append("[INFO]: persisted: ");
changed = true;
persisted++;
} else {
CompareToBuilder cmp = new CompareToBuilder();
cmp.append(intEvent.getEventDate(), persistent.getEventDate());
cmp.append(intEvent.getEventGroup(), persistent.getEventGroup());
cmp.append(intEvent.getEventName(), persistent.getEventName());
if (cmp.toComparison() != 0) {
Date eventDate = intEvent.getEventDate();
String eventName = intEvent.getEventName();
String eventGroup = intEvent.getEventGroup();
detailLog = new StringBuilder();
Utils.append(detailLog, "|",
DateUtils.format(persistent.getEventDate(), eventDateFmtR, "null"),
" --> ", DateUtils.format(eventDate, eventDateFmtR, "null"));
Utils.append(detailLog, "|", persistent.getEventGroup(), " --> ",
eventGroup);
Utils.append(detailLog, "|", persistent.getEventName(), " --> ", eventName);
persistent.setEventDate(eventDate);
persistent.setEventGroup(eventGroup);
persistent.setEventName(eventName);
intEvent = dao.merge(persistent);
log.append("[INFO]: merged: ");
changed = true;
merged++;
} else {