Exposed message handling methods through DatabaseComponent interface.

This commit is contained in:
akwizgran
2013-01-30 18:23:53 +00:00
parent 9a78071bde
commit 520b6da5ac
7 changed files with 337 additions and 144 deletions

View File

@@ -152,12 +152,21 @@ public interface DatabaseComponent {
/** Returns the local transport properties for the given transport. */
TransportProperties getLocalProperties(TransportId t) throws DbException;
/** Returns the body of the message with the given ID. */
byte[] getMessageBody(MessageId m) throws DbException;
/** Returns the header of the message with the given ID. */
MessageHeader getMessageHeader(MessageId m) throws DbException;
/** Returns the headers of all messages in the given group. */
Collection<MessageHeader> getMessageHeaders(GroupId g) throws DbException;
/** Returns the user's rating for the given author. */
Rating getRating(AuthorId a) throws DbException;
/** Returns true if the given message has been read. */
boolean getReadFlag(MessageId m) throws DbException;
/** Returns all remote transport properties for the given transport. */
Map<ContactId, TransportProperties> getRemoteProperties(TransportId t)
throws DbException;
@@ -165,6 +174,9 @@ public interface DatabaseComponent {
/** Returns all temporary secrets. */
Collection<TemporarySecret> getSecrets() throws DbException;
/** Returns true if the given message has been starred. */
boolean getStarredFlag(MessageId m) throws DbException;
/** Returns the set of groups to which the user subscribes. */
Collection<Group> getSubscriptions() throws DbException;
@@ -251,9 +263,21 @@ public interface DatabaseComponent {
/** Records the user's rating for the given author. */
void setRating(AuthorId a, Rating r) throws DbException;
/**
* Marks the given message read or unread and returns true if it was
* previously read.
*/
boolean setReadFlag(MessageId m, boolean read) throws DbException;
/** Records the given messages as having been seen by the given contact. */
void setSeen(ContactId c, Collection<MessageId> seen) throws DbException;
/**
* Marks the given message starred or unstarred and returns true if it was
* previously starred.
*/
boolean setStarredFlag(MessageId m, boolean starred) throws DbException;
/**
* Makes the given group visible to the given set of contacts and invisible
* to any other contacts.

View File

@@ -0,0 +1,11 @@
package net.sf.briar.api.db;
/**
* Thrown when a database operation is attempted for a message that is not in
* the database. This exception may occur due to concurrent updates and does
* not indicate a database error.
*/
public class NoSuchMessageException extends DbException {
private static final long serialVersionUID = 9191508339698803848L;
}