while (iterator.hasNext()) {
LogEvent inEvent = (LogEvent) iterator.next();
Event event = new Event(inEvent.getType());
switch (inEvent.getType()) {
case LogEvent.INSERTED:
ObjectLogEvent inObjectEvent = (ObjectLogEvent) inEvent;
event.setString("Object inserted (" + inObjectEvent.getFactId() + "): " + inObjectEvent.getObjectToString());
if (currentBeforeActivationEvent != null) {
currentBeforeActivationEvent.addSubEvent(event);
} else {
events.add(event);
}
event.addSubEvents(newActivations);
newActivations.clear();
objectMap.put(new Long(((ObjectLogEvent) inEvent).getFactId()), event);
break;
case LogEvent.UPDATED:
inObjectEvent = (ObjectLogEvent) inEvent;
event.setString("Object updated (" + inObjectEvent.getFactId() + "): " + inObjectEvent.getObjectToString());
if (currentBeforeActivationEvent != null) {
currentBeforeActivationEvent.addSubEvent(event);
} else {
events.add(event);
}
event.addSubEvents(newActivations);
newActivations.clear();
Event assertEvent = (Event) objectMap.get(new Long(((ObjectLogEvent) inEvent).getFactId()));
if (assertEvent != null) {
event.setCauseEvent(assertEvent);
}
break;
case LogEvent.RETRACTED:
inObjectEvent = (ObjectLogEvent) inEvent;
event.setString("Object removed (" + inObjectEvent.getFactId() + "): " + inObjectEvent.getObjectToString());
if (currentBeforeActivationEvent != null) {
currentBeforeActivationEvent.addSubEvent(event);
} else {
events.add(event);
}