mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
Refactor doesExist() method.
This commit is contained in:
@@ -4,17 +4,17 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.sync.GroupId;
|
||||
import org.briarproject.bramble.api.sync.MessageId;
|
||||
import org.briarproject.briar.api.client.SessionId;
|
||||
import org.briarproject.briar.api.messaging.PrivateRequest;
|
||||
import org.briarproject.briar.api.sharing.InvitationRequest;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@NotNullByDefault
|
||||
public class BlogInvitationRequest extends PrivateRequest<Blog> {
|
||||
public class BlogInvitationRequest extends InvitationRequest<Blog> {
|
||||
|
||||
public BlogInvitationRequest(MessageId id, GroupId groupId, long time,
|
||||
boolean local, boolean sent, boolean seen, boolean read,
|
||||
SessionId sessionId, Blog blog,
|
||||
@Nullable String message, boolean available, boolean canBeOpened) {
|
||||
SessionId sessionId, Blog blog, @Nullable String message,
|
||||
boolean available, boolean canBeOpened) {
|
||||
super(id, groupId, time, local, sent, seen, read, sessionId, blog,
|
||||
message, available, canBeOpened);
|
||||
}
|
||||
|
||||
@@ -4,19 +4,19 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.sync.GroupId;
|
||||
import org.briarproject.bramble.api.sync.MessageId;
|
||||
import org.briarproject.briar.api.client.SessionId;
|
||||
import org.briarproject.briar.api.messaging.PrivateRequest;
|
||||
import org.briarproject.briar.api.sharing.InvitationRequest;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
||||
@Immutable
|
||||
@NotNullByDefault
|
||||
public class ForumInvitationRequest extends PrivateRequest<Forum> {
|
||||
public class ForumInvitationRequest extends InvitationRequest<Forum> {
|
||||
|
||||
public ForumInvitationRequest(MessageId id, GroupId groupId, long time,
|
||||
boolean local, boolean sent, boolean seen, boolean read,
|
||||
SessionId sessionId, Forum forum,
|
||||
@Nullable String message, boolean available, boolean canBeOpened) {
|
||||
SessionId sessionId, Forum forum, @Nullable String message,
|
||||
boolean available, boolean canBeOpened) {
|
||||
super(id, groupId, time, local, sent, seen, read, sessionId, forum,
|
||||
message, available, canBeOpened);
|
||||
}
|
||||
|
||||
@@ -13,12 +13,18 @@ import javax.annotation.concurrent.Immutable;
|
||||
@NotNullByDefault
|
||||
public class IntroductionRequest extends PrivateRequest<Introduction> {
|
||||
|
||||
private final boolean contact;
|
||||
|
||||
public IntroductionRequest(MessageId messageId, GroupId groupId,
|
||||
long time, boolean local, boolean sent, boolean seen, boolean read,
|
||||
SessionId sessionId, Introduction introduction,
|
||||
@Nullable String message, boolean answered, boolean exists) {
|
||||
@Nullable String message, boolean answered, boolean contact) {
|
||||
super(messageId, groupId, time, local, sent, seen, read, sessionId,
|
||||
introduction, message, answered, exists);
|
||||
introduction, message, answered);
|
||||
this.contact = contact;
|
||||
}
|
||||
|
||||
public boolean isContact() {
|
||||
return contact;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,18 +16,17 @@ public class PrivateRequest<N extends Nameable> extends PrivateMessageHeader {
|
||||
private final N nameable;
|
||||
@Nullable
|
||||
private final String message;
|
||||
private final boolean answered, exists;
|
||||
private final boolean answered;
|
||||
|
||||
public PrivateRequest(MessageId messageId, GroupId groupId, long time,
|
||||
boolean local, boolean sent, boolean seen, boolean read,
|
||||
SessionId sessionId, N nameable, @Nullable String message,
|
||||
boolean answered, boolean exists) {
|
||||
boolean answered) {
|
||||
super(messageId, groupId, time, local, sent, seen, read);
|
||||
this.sessionId = sessionId;
|
||||
this.nameable = nameable;
|
||||
this.message = message;
|
||||
this.answered = answered;
|
||||
this.exists = exists;
|
||||
}
|
||||
|
||||
public SessionId getSessionId() {
|
||||
@@ -50,8 +49,4 @@ public class PrivateRequest<N extends Nameable> extends PrivateMessageHeader {
|
||||
public boolean wasAnswered() {
|
||||
return answered;
|
||||
}
|
||||
|
||||
public boolean doesExist() {
|
||||
return exists;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,15 +4,15 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.sync.GroupId;
|
||||
import org.briarproject.bramble.api.sync.MessageId;
|
||||
import org.briarproject.briar.api.client.SessionId;
|
||||
import org.briarproject.briar.api.messaging.PrivateRequest;
|
||||
import org.briarproject.briar.api.privategroup.PrivateGroup;
|
||||
import org.briarproject.briar.api.sharing.InvitationRequest;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
||||
@Immutable
|
||||
@NotNullByDefault
|
||||
public class GroupInvitationRequest extends PrivateRequest<PrivateGroup> {
|
||||
public class GroupInvitationRequest extends InvitationRequest<PrivateGroup> {
|
||||
|
||||
public GroupInvitationRequest(MessageId id, GroupId groupId, long time,
|
||||
boolean local, boolean sent, boolean seen, boolean read,
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.briarproject.briar.api.sharing;
|
||||
|
||||
import org.briarproject.bramble.api.sync.GroupId;
|
||||
import org.briarproject.bramble.api.sync.MessageId;
|
||||
import org.briarproject.briar.api.client.SessionId;
|
||||
import org.briarproject.briar.api.messaging.PrivateRequest;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public abstract class InvitationRequest<S extends Shareable> extends
|
||||
PrivateRequest<S> {
|
||||
|
||||
private final boolean canBeOpened;
|
||||
|
||||
public InvitationRequest(MessageId messageId, GroupId groupId, long time,
|
||||
boolean local, boolean sent, boolean seen, boolean read,
|
||||
SessionId sessionId, S object, @Nullable String message,
|
||||
boolean answered, boolean canBeOpened) {
|
||||
super(messageId, groupId, time, local, sent, seen, read, sessionId,
|
||||
object, message, answered);
|
||||
this.canBeOpened = canBeOpened;
|
||||
}
|
||||
|
||||
public boolean canBeOpened() {
|
||||
return canBeOpened;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user