diff --git a/src/net/java/sip/communicator/service/metahistory/MetaHistoryService.java b/src/net/java/sip/communicator/service/metahistory/MetaHistoryService.java new file mode 100644 index 000000000..865d77c25 --- /dev/null +++ b/src/net/java/sip/communicator/service/metahistory/MetaHistoryService.java @@ -0,0 +1,227 @@ +/* + * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package net.java.sip.communicator.service.metahistory; + +import java.util.*; +import net.java.sip.communicator.service.history.event.*; + +/** + * The Meta History Service is wrapper around the other known + * history services. Query them all at once, sort the result and return all + * merged records in one collection. + * + * @author Damian Minkov + */ +public interface MetaHistoryService +{ + /** + * Returns all the records for the descriptor after the given date. + * + * @param services the services classnames we will query + * @param descriptor CallParticipant address(String), + * MetaContact or ChatRoom. + * @param startDate Date the date of the first record to return + * @return Collection sorted result that conists of records returned from + * the services we wrap + * @throws RuntimeException + */ + public Collection findByStartDate(String[] services, + Object descriptor, Date startDate) + throws RuntimeException; + + /** + * Returns all the records before the given date + * + * @param services the services classnames we will query + * @param descriptor CallParticipant address(String), + * MetaContact or ChatRoom. + * @param endDate Date the date of the last record to return + * @return Collection sorted result that conists of records returned from + * the services we wrap + * @throws RuntimeException + */ + public Collection findByEndDate(String[] services, + Object descriptor, Date endDate) + throws RuntimeException; + + /** + * Returns all the records between the given dates + * + * @param services the services classnames we will query + * @param descriptor CallParticipant address(String), + * MetaContact or ChatRoom. + * @param startDate Date the date of the first record to return + * @param endDate Date the date of the last record to return + * @return Collection sorted result that conists of records returned from + * the services we wrap + * @throws RuntimeException + */ + public Collection findByPeriod(String[] services, + Object contact, Date startDate, Date endDate) + throws RuntimeException; + + /** + * Returns all the records between the given dates and having the given + * keywords + * + * @param services the services classnames we will query + * @param descriptor CallParticipant address(String), + * MetaContact or ChatRoom. + * @param startDate Date the date of the first record to return + * @param endDate Date the date of the last record to return + * @param keywords array of keywords + * @return Collection sorted result that conists of records returned from + * the services we wrap + * @throws RuntimeException + */ + public Collection findByPeriod(String[] services, + Object contact, Date startDate, Date endDate, String[] keywords) + throws RuntimeException; + + /** + * Returns all the records between the given dates and having the given + * keywords + * + * @param services the services classnames we will query + * @param descriptor CallParticipant address(String), + * MetaContact or ChatRoom. + * @param startDate Date the date of the first record to return + * @param endDate Date the date of the last record to return + * @param keywords array of keywords + * @param caseSensitive is keywords search case sensitive + * @return Collection sorted result that conists of records returned from + * the services we wrap + * @throws RuntimeException + */ + public Collection findByPeriod(String[] services, + Object contact, Date startDate, Date endDate, + String[] keywords, boolean caseSensitive) + throws RuntimeException; + + /** + * Returns all the records having the given keyword + * + * @param services the services classnames we will query + * @param descriptor CallParticipant address(String), + * MetaContact or ChatRoom. + * @param keyword keyword + * @return Collection sorted result that conists of records returned from + * the services we wrap + * @throws RuntimeException + */ + public Collection findByKeyword(String[] services, + Object contact, String keyword) + throws RuntimeException; + + /** + * Returns all the records having the given keyword + * + * @param services the services classnames we will query + * @param descriptor CallParticipant address(String), + * MetaContact or ChatRoom. + * @param keyword keyword + * @param caseSensitive is keywords search case sensitive + * @return Collection sorted result that conists of records returned from + * the services we wrap + * @throws RuntimeException + */ + Collection findByKeyword(String[] services, + Object contact, String keyword, boolean caseSensitive) + throws RuntimeException; + + /** + * Returns all the records having the given keywords + * + * @param services the services classnames we will query + * @param contact CallParticipant address(String), + * MetaContact or ChatRoom. + * @param keywords keyword + * @return Collection sorted result that conists of records returned from + * the services we wrap + * @throws RuntimeException + */ + public Collection findByKeywords(String[] services, + Object contact, String[] keywords) + throws RuntimeException; + + /** + * Returns all the records having the given keywords + * + * @param services the services classnames we will query + * @param descriptor CallParticipant address(String), + * MetaContact or ChatRoom. + * @param keywords keyword + * @param caseSensitive is keywords search case sensitive + * @return Collection sorted result that conists of records returned from + * the services we wrap + * @throws RuntimeException + */ + public Collection findByKeywords(String[] services, + Object contact, String[] keywords, boolean caseSensitive) + throws RuntimeException; + + /** + * Returns the supplied number of recent records. + * + * @param services the services classnames we will query + * @param descriptor CallParticipant address(String), + * MetaContact or ChatRoom. + * @param count messages count + * @return Collection sorted result that conists of records returned from + * the services we wrap + * @throws RuntimeException + */ + public Collection findLast(String[] services, + Object contact, int count) + throws RuntimeException; + + /** + * Returns the supplied number of recent records after the given date + * + * @param services the services classnames we will query + * @param descriptor CallParticipant address(String), + * MetaContact or ChatRoom. + * @param date messages after date + * @param count messages count + * @return Collection sorted result that conists of records returned from + * the services we wrap + * @throws RuntimeException + */ + public Collection findFirstMessagesAfter(String[] services, + Object contact, Date date, int count) + throws RuntimeException; + + /** + * Returns the supplied number of recent records before the given date + * + * @param services the services classnames we will query + * @param descriptor CallParticipant address(String), + * MetaContact or ChatRoom. + * @param date messages before date + * @param count messages count + * @return Collection sorted result that conists of records returned from + * the services we wrap + * @throws RuntimeException + */ + public Collection findLastMessagesBefore(String[] services, + Object contact, Date date, int count) + throws RuntimeException; + + /** + * Adding progress listener for monitoring progress of search process + * + * @param listener HistorySearchProgressListener + */ + public void addSearchProgressListener(HistorySearchProgressListener listener); + + /** + * Removing progress listener + * + * @param listener HistorySearchProgressListener + */ + public void removeSearchProgressListener(HistorySearchProgressListener listener); +}