Add a stub for a GroupInvitationManager

This commit is contained in:
Torsten Grote
2016-10-17 10:35:29 -02:00
parent 8eeaf4e347
commit a33d7d1663
14 changed files with 372 additions and 24 deletions

View File

@@ -1,32 +1,36 @@
package org.briarproject.api.sharing;
import org.briarproject.api.contact.Contact;
import org.briarproject.api.nullsafety.NotNullByDefault;
import org.briarproject.api.sync.GroupId;
import java.util.Collection;
import javax.annotation.concurrent.ThreadSafe;
public class InvitationItem {
@ThreadSafe
@NotNullByDefault
public abstract class InvitationItem {
private final Shareable shareable;
private final boolean subscribed;
private final Collection<Contact> newSharers;
public InvitationItem(Shareable shareable, boolean subscribed,
Collection<Contact> newSharers) {
public InvitationItem(Shareable shareable, boolean subscribed) {
this.shareable = shareable;
this.subscribed = subscribed;
this.newSharers = newSharers;
}
public Shareable getShareable() {
return shareable;
}
public GroupId getId() {
return shareable.getId();
}
public String getName() {
return shareable.getName();
}
public boolean isSubscribed() {
return subscribed;
}
public Collection<Contact> getNewSharers() {
return newSharers;
}
}

View File

@@ -8,4 +8,7 @@ public interface Shareable {
GroupId getId();
Group getGroup();
String getName();
}

View File

@@ -0,0 +1,22 @@
package org.briarproject.api.sharing;
import org.briarproject.api.contact.Contact;
import java.util.Collection;
public class SharingInvitationItem extends InvitationItem {
private final Collection<Contact> newSharers;
public SharingInvitationItem(Shareable shareable, boolean subscribed,
Collection<Contact> newSharers) {
super(shareable, subscribed);
this.newSharers = newSharers;
}
public Collection<Contact> getNewSharers() {
return newSharers;
}
}

View File

@@ -38,7 +38,7 @@ public interface SharingManager<S extends Shareable> extends MessageTracker {
/**
* Returns all invitations to groups.
*/
Collection<InvitationItem> getInvitations() throws DbException;
Collection<SharingInvitationItem> getInvitations() throws DbException;
/**
* Returns all contacts who are sharing the given group with us.