DBTransaction transaction = TransactionPool.get().beginWork();
try {
final Iterator<LogEntry> itr = queryDatabase(transaction, timedate);
ItemInfo oldItemInfo = new ItemInfo();
while (itr.hasNext()) {
final LogEntry entry = itr.next();
// detect group change (next item)
if (!entry.getItemid().equals(oldItemInfo.getItemid())) {
oldItemInfo = new ItemInfo();
oldItemInfo.setItemid(entry.getItemid());
oldItemInfo.setName("");
oldItemInfo.setQuantity("1");
oldItemInfo.setOwner(entry.getSource());
}
ItemInfo itemInfo = (ItemInfo) oldItemInfo.clone();
itemInfo.setOwner(entry.getSource());
ItemEventType eventType = ItemEventTypeFactory.create(entry.getEvent());
eventType.process(entry, itemInfo);
if (!oldItemInfo.getOwner().equals(itemInfo.getOwner())) {
logTransfer(oldItemInfo, itemInfo, entry);
}