From 918a8ec7c019c192c2441e469b4091fe60b3e4cc Mon Sep 17 00:00:00 2001 From: Damian Minkov Date: Wed, 24 Jun 2009 13:45:08 +0000 Subject: MetaHistory Service impl and add Contact field to FileRecord. --- .../impl/filehistory/FileHistoryServiceImpl.java | 29 ++++++++++++++-------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'src/net/java/sip/communicator/impl/filehistory') diff --git a/src/net/java/sip/communicator/impl/filehistory/FileHistoryServiceImpl.java b/src/net/java/sip/communicator/impl/filehistory/FileHistoryServiceImpl.java index b71059a..95b968d 100644 --- a/src/net/java/sip/communicator/impl/filehistory/FileHistoryServiceImpl.java +++ b/src/net/java/sip/communicator/impl/filehistory/FileHistoryServiceImpl.java @@ -213,7 +213,8 @@ public class FileHistoryServiceImpl return readers; } - private FileRecord createFileRecordFromHistoryRecord(HistoryRecord hr) + private FileRecord createFileRecordFromHistoryRecord( + HistoryRecord hr, Contact contact) { String file = null; String dir = null; @@ -243,7 +244,7 @@ public class FileHistoryServiceImpl status = hr.getPropertyValues()[i]; } - return new FileRecord(dir, date, new File(file), status); + return new FileRecord(contact, dir, date, new File(file), status); } /** @@ -265,13 +266,14 @@ public class FileHistoryServiceImpl for (Map.Entry readerEntry : readers.entrySet()) { + Contact c = readerEntry.getKey(); HistoryReader reader = readerEntry.getValue(); // add the progress listeners Iterator recs = reader.findByStartDate(startDate); while (recs.hasNext()) { - result.add(createFileRecordFromHistoryRecord(recs.next())); + result.add(createFileRecordFromHistoryRecord(recs.next(), c)); } } @@ -296,13 +298,14 @@ public class FileHistoryServiceImpl for (Map.Entry readerEntry : readers.entrySet()) { + Contact c = readerEntry.getKey(); HistoryReader reader = readerEntry.getValue(); // add the progress listeners Iterator recs = reader.findByEndDate(endDate); while (recs.hasNext()) { - result.add(createFileRecordFromHistoryRecord(recs.next())); + result.add(createFileRecordFromHistoryRecord(recs.next(), c)); } } @@ -350,6 +353,7 @@ public class FileHistoryServiceImpl for (Map.Entry readerEntry : readers.entrySet()) { + Contact c = readerEntry.getKey(); HistoryReader reader = readerEntry.getValue(); // add the progress listeners @@ -357,7 +361,7 @@ public class FileHistoryServiceImpl startDate, endDate, keywords, SEARCH_FIELD, caseSensitive); while (recs.hasNext()) { - result.add(createFileRecordFromHistoryRecord(recs.next())); + result.add(createFileRecordFromHistoryRecord(recs.next(), c)); } } @@ -384,13 +388,14 @@ public class FileHistoryServiceImpl for (Map.Entry readerEntry : readers.entrySet()) { + Contact c = readerEntry.getKey(); HistoryReader reader = readerEntry.getValue(); // add the progress listeners Iterator recs = reader.findByPeriod(startDate, endDate); while (recs.hasNext()) { - result.add(createFileRecordFromHistoryRecord(recs.next())); + result.add(createFileRecordFromHistoryRecord(recs.next(), c)); } } @@ -415,13 +420,14 @@ public class FileHistoryServiceImpl for (Map.Entry readerEntry : readers.entrySet()) { + Contact c = readerEntry.getKey(); HistoryReader reader = readerEntry.getValue(); // add the progress listeners Iterator recs = reader.findLast(count); while (recs.hasNext()) { - result.add(createFileRecordFromHistoryRecord(recs.next())); + result.add(createFileRecordFromHistoryRecord(recs.next(), c)); } } @@ -494,6 +500,7 @@ public class FileHistoryServiceImpl for (Map.Entry readerEntry : readers.entrySet()) { + Contact c = readerEntry.getKey(); HistoryReader reader = readerEntry.getValue(); // add the progress listeners @@ -501,7 +508,7 @@ public class FileHistoryServiceImpl reader.findByKeywords(keywords, SEARCH_FIELD, caseSensitive); while (recs.hasNext()) { - result.add(createFileRecordFromHistoryRecord(recs.next())); + result.add(createFileRecordFromHistoryRecord(recs.next(), c)); } } @@ -528,6 +535,7 @@ public class FileHistoryServiceImpl for (Map.Entry readerEntry : readers.entrySet()) { + Contact c = readerEntry.getKey(); HistoryReader reader = readerEntry.getValue(); // add the progress listeners @@ -535,7 +543,7 @@ public class FileHistoryServiceImpl reader.findFirstRecordsAfter(date, count); while (recs.hasNext()) { - result.add(createFileRecordFromHistoryRecord(recs.next())); + result.add(createFileRecordFromHistoryRecord(recs.next(), c)); } } @@ -568,6 +576,7 @@ public class FileHistoryServiceImpl for (Map.Entry readerEntry : readers.entrySet()) { + Contact c = readerEntry.getKey(); HistoryReader reader = readerEntry.getValue(); // add the progress listeners @@ -575,7 +584,7 @@ public class FileHistoryServiceImpl reader.findLastRecordsBefore(date, count); while (recs.hasNext()) { - result.add(createFileRecordFromHistoryRecord(recs.next())); + result.add(createFileRecordFromHistoryRecord(recs.next(), c)); } } -- cgit v1.1