mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 22:29:53 +01:00
Allow to get a forum from the ForumManager within a transaction
This commit is contained in:
@@ -31,6 +31,9 @@ public interface ForumManager {
|
|||||||
/** Returns the forum with the given ID. */
|
/** Returns the forum with the given ID. */
|
||||||
Forum getForum(GroupId g) throws DbException;
|
Forum getForum(GroupId g) throws DbException;
|
||||||
|
|
||||||
|
/** Returns the forum with the given ID. */
|
||||||
|
Forum getForum(Transaction txn, GroupId g) throws DbException;
|
||||||
|
|
||||||
/** Returns all forums to which the user subscribes. */
|
/** Returns all forums to which the user subscribes. */
|
||||||
Collection<Forum> getForums() throws DbException;
|
Collection<Forum> getForums() throws DbException;
|
||||||
|
|
||||||
|
|||||||
@@ -141,15 +141,21 @@ class ForumManagerImpl implements ForumManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Forum getForum(GroupId g) throws DbException {
|
public Forum getForum(GroupId g) throws DbException {
|
||||||
|
Forum forum;
|
||||||
|
Transaction txn = db.startTransaction(true);
|
||||||
try {
|
try {
|
||||||
Group group;
|
forum = getForum(txn, g);
|
||||||
Transaction txn = db.startTransaction(true);
|
txn.setComplete();
|
||||||
try {
|
} finally {
|
||||||
group = db.getGroup(txn, g);
|
db.endTransaction(txn);
|
||||||
txn.setComplete();
|
}
|
||||||
} finally {
|
return forum;
|
||||||
db.endTransaction(txn);
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public Forum getForum(Transaction txn, GroupId g) throws DbException {
|
||||||
|
try {
|
||||||
|
Group group = db.getGroup(txn, g);
|
||||||
return parseForum(group);
|
return parseForum(group);
|
||||||
} catch (FormatException e) {
|
} catch (FormatException e) {
|
||||||
throw new DbException(e);
|
throw new DbException(e);
|
||||||
|
|||||||
Reference in New Issue
Block a user