Updated group-related events and exceptions.

This commit is contained in:
akwizgran
2016-01-27 17:29:17 +00:00
parent 9d537dce00
commit 3837efca6b
23 changed files with 159 additions and 226 deletions

View File

@@ -45,11 +45,8 @@ public interface DatabaseComponent {
*/
ContactId addContact(Author remote, AuthorId local) throws DbException;
/**
* Subscribes to a group, or returns false if the user already has the
* maximum number of subscriptions.
*/
boolean addGroup(Group g) throws DbException;
/** Stores a group. */
void addGroup(Group g) throws DbException;
/** Stores a local pseudonym. */
void addLocalAuthor(LocalAuthor a) throws DbException;
@@ -120,16 +117,13 @@ public interface DatabaseComponent {
/** Returns the unique ID for this device. */
DeviceId getDeviceId() throws DbException;
/** Returns the group with the given ID, if the user subscribes to it. */
/** Returns the group with the given ID. */
Group getGroup(GroupId g) throws DbException;
/** Returns the metadata for the given group. */
Metadata getGroupMetadata(GroupId g) throws DbException;
/**
* Returns all groups belonging to the given client to which the user
* subscribes.
*/
/** Returns all groups belonging to the given client. */
Collection<Group> getGroups(ClientId c) throws DbException;
/** Returns the local pseudonym with the given ID. */
@@ -221,10 +215,7 @@ public interface DatabaseComponent {
/** Removes a contact (and all associated state) from the database. */
void removeContact(ContactId c) throws DbException;
/**
* Unsubscribes from a group. Any messages belonging to the group
* are deleted from the database.
*/
/** Removes a group (and all associated state) from the database. */
void removeGroup(Group g) throws DbException;
/**
@@ -232,10 +223,7 @@ public interface DatabaseComponent {
*/
void removeLocalAuthor(AuthorId a) throws DbException;
/**
* Removes a transport (and any associated configuration and local
* properties) from the database.
*/
/** Removes a transport (and all associated state) from the database. */
void removeTransport(TransportId t) throws DbException;
/** Sets the status of the given contact. */

View File

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

View File

@@ -1,12 +0,0 @@
package org.briarproject.api.db;
/**
* Thrown when a database operation is attempted for a group to which the user
* does not subscribe. This exception may occur due to concurrent updates and
* does not indicate a database error.
*/
public class NoSuchSubscriptionException extends DbException {
private static final long serialVersionUID = -5494178507342571697L;
}