mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
Refactor Author.Status into dedicated AuthorInfo class and add alias
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package org.briarproject.briar.api.blog;
|
||||
|
||||
import org.briarproject.bramble.api.identity.Author;
|
||||
import org.briarproject.bramble.api.identity.Author.Status;
|
||||
import org.briarproject.bramble.api.identity.AuthorInfo;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.sync.GroupId;
|
||||
import org.briarproject.bramble.api.sync.MessageId;
|
||||
@@ -23,10 +23,10 @@ public class BlogCommentHeader extends BlogPostHeader {
|
||||
public BlogCommentHeader(MessageType type, GroupId groupId,
|
||||
@Nullable String comment, BlogPostHeader parent, MessageId id,
|
||||
long timestamp, long timeReceived, Author author,
|
||||
Status authorStatus, boolean read) {
|
||||
AuthorInfo authorInfo, boolean read) {
|
||||
|
||||
super(type, groupId, id, parent.getId(), timestamp,
|
||||
timeReceived, author, authorStatus, false, read);
|
||||
timeReceived, author, authorInfo, false, read);
|
||||
|
||||
if (type != COMMENT && type != WRAPPED_COMMENT)
|
||||
throw new IllegalArgumentException("Incompatible Message Type");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.briarproject.briar.api.blog;
|
||||
|
||||
import org.briarproject.bramble.api.identity.Author;
|
||||
import org.briarproject.bramble.api.identity.Author.Status;
|
||||
import org.briarproject.bramble.api.identity.AuthorInfo;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.sync.GroupId;
|
||||
import org.briarproject.bramble.api.sync.MessageId;
|
||||
@@ -21,8 +21,8 @@ public class BlogPostHeader extends PostHeader {
|
||||
|
||||
public BlogPostHeader(MessageType type, GroupId groupId, MessageId id,
|
||||
@Nullable MessageId parentId, long timestamp, long timeReceived,
|
||||
Author author, Status authorStatus, boolean rssFeed, boolean read) {
|
||||
super(id, parentId, timestamp, author, authorStatus, read);
|
||||
Author author, AuthorInfo authorInfo, boolean rssFeed, boolean read) {
|
||||
super(id, parentId, timestamp, author, authorInfo, read);
|
||||
this.type = type;
|
||||
this.groupId = groupId;
|
||||
this.timeReceived = timeReceived;
|
||||
@@ -31,9 +31,9 @@ public class BlogPostHeader extends PostHeader {
|
||||
|
||||
public BlogPostHeader(MessageType type, GroupId groupId, MessageId id,
|
||||
long timestamp, long timeReceived, Author author,
|
||||
Status authorStatus, boolean rssFeed, boolean read) {
|
||||
AuthorInfo authorInfo, boolean rssFeed, boolean read) {
|
||||
this(type, groupId, id, null, timestamp, timeReceived, author,
|
||||
authorStatus, rssFeed, read);
|
||||
authorInfo, rssFeed, read);
|
||||
}
|
||||
|
||||
public MessageType getType() {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package org.briarproject.briar.api.client;
|
||||
|
||||
import org.briarproject.bramble.api.identity.Author;
|
||||
import org.briarproject.bramble.api.identity.Author.Status;
|
||||
import org.briarproject.bramble.api.identity.AuthorInfo;
|
||||
import org.briarproject.bramble.api.identity.AuthorInfo.Status;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.sync.MessageId;
|
||||
|
||||
@@ -17,16 +18,16 @@ public abstract class PostHeader {
|
||||
private final MessageId parentId;
|
||||
private final long timestamp;
|
||||
private final Author author;
|
||||
private final Status authorStatus;
|
||||
private final AuthorInfo authorInfo;
|
||||
private final boolean read;
|
||||
|
||||
public PostHeader(MessageId id, @Nullable MessageId parentId,
|
||||
long timestamp, Author author, Status authorStatus, boolean read) {
|
||||
long timestamp, Author author, AuthorInfo authorInfo, boolean read) {
|
||||
this.id = id;
|
||||
this.parentId = parentId;
|
||||
this.timestamp = timestamp;
|
||||
this.author = author;
|
||||
this.authorStatus = authorStatus;
|
||||
this.authorInfo = authorInfo;
|
||||
this.read = read;
|
||||
}
|
||||
|
||||
@@ -39,7 +40,11 @@ public abstract class PostHeader {
|
||||
}
|
||||
|
||||
public Status getAuthorStatus() {
|
||||
return authorStatus;
|
||||
return authorInfo.getStatus();
|
||||
}
|
||||
|
||||
public AuthorInfo getAuthorInfo() {
|
||||
return authorInfo;
|
||||
}
|
||||
|
||||
public long getTimestamp() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.briarproject.briar.api.forum;
|
||||
|
||||
import org.briarproject.bramble.api.identity.Author;
|
||||
import org.briarproject.bramble.api.identity.AuthorInfo;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.sync.MessageId;
|
||||
import org.briarproject.briar.api.client.PostHeader;
|
||||
@@ -13,9 +14,9 @@ import javax.annotation.concurrent.Immutable;
|
||||
public class ForumPostHeader extends PostHeader {
|
||||
|
||||
public ForumPostHeader(MessageId id, @Nullable MessageId parentId,
|
||||
long timestamp, Author author, Author.Status authorStatus,
|
||||
long timestamp, Author author, AuthorInfo authorInfo,
|
||||
boolean read) {
|
||||
super(id, parentId, timestamp, author, authorStatus, read);
|
||||
super(id, parentId, timestamp, author, authorInfo, read);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package org.briarproject.briar.api.privategroup;
|
||||
|
||||
import org.briarproject.bramble.api.contact.ContactId;
|
||||
import org.briarproject.bramble.api.identity.Author;
|
||||
import org.briarproject.bramble.api.identity.Author.Status;
|
||||
import org.briarproject.bramble.api.identity.AuthorInfo;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -13,16 +13,16 @@ import javax.annotation.concurrent.Immutable;
|
||||
public class GroupMember {
|
||||
|
||||
private final Author author;
|
||||
private final Status status;
|
||||
private final AuthorInfo authorInfo;
|
||||
private final boolean isCreator;
|
||||
@Nullable
|
||||
private final ContactId contactId;
|
||||
private final Visibility visibility;
|
||||
|
||||
public GroupMember(Author author, Status status, boolean isCreator,
|
||||
public GroupMember(Author author, AuthorInfo status, boolean isCreator,
|
||||
@Nullable ContactId contactId, Visibility visibility) {
|
||||
this.author = author;
|
||||
this.status = status;
|
||||
this.authorInfo = status;
|
||||
this.isCreator = isCreator;
|
||||
this.contactId = contactId;
|
||||
this.visibility = visibility;
|
||||
@@ -32,8 +32,8 @@ public class GroupMember {
|
||||
return author;
|
||||
}
|
||||
|
||||
public Status getStatus() {
|
||||
return status;
|
||||
public AuthorInfo getAuthorInfo() {
|
||||
return authorInfo;
|
||||
}
|
||||
|
||||
public boolean isCreator() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.briarproject.briar.api.privategroup;
|
||||
|
||||
import org.briarproject.bramble.api.identity.Author;
|
||||
import org.briarproject.bramble.api.identity.Author.Status;
|
||||
import org.briarproject.bramble.api.identity.AuthorInfo;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.sync.GroupId;
|
||||
import org.briarproject.bramble.api.sync.MessageId;
|
||||
@@ -18,8 +18,8 @@ public class GroupMessageHeader extends PostHeader {
|
||||
|
||||
public GroupMessageHeader(GroupId groupId, MessageId id,
|
||||
@Nullable MessageId parentId, long timestamp,
|
||||
Author author, Status authorStatus, boolean read) {
|
||||
super(id, parentId, timestamp, author, authorStatus, read);
|
||||
Author author, AuthorInfo authorInfo, boolean read) {
|
||||
super(id, parentId, timestamp, author, authorInfo, read);
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public class JoinMessageHeader extends GroupMessageHeader {
|
||||
public JoinMessageHeader(GroupMessageHeader h, Visibility visibility,
|
||||
boolean isInitial) {
|
||||
super(h.getGroupId(), h.getId(), h.getParentId(), h.getTimestamp(),
|
||||
h.getAuthor(), h.getAuthorStatus(), h.isRead());
|
||||
h.getAuthor(), h.getAuthorInfo(), h.isRead());
|
||||
this.visibility = visibility;
|
||||
this.isInitial = isInitial;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user