Package org.intermine.api.bag
Class SharingInvite
- java.lang.Object
-
- org.intermine.api.bag.SharingInvite
-
public class SharingInvite extends java.lang.Object
A representation of an invitation to share a resource.- Author:
- Alex Kalderimis
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SharingInvite.IntermediateRepresentation
A structure for holding data we read from the DB.static class
SharingInvite.NotFoundException
Exception thrown when we can't find a shared invitation.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
TABLE_NAME
The DB table that holds the invitations
-
Constructor Summary
Constructors Modifier Constructor Description protected
SharingInvite(InterMineBag bag, java.lang.String invitee)
Constructor.protected
SharingInvite(InterMineBag bag, java.lang.String invitee, java.lang.String token)
Constructor.protected
SharingInvite(InterMineBag bag, java.lang.String invitee, java.lang.String token, java.util.Date createdAt, java.util.Date acceptedAt, java.lang.Boolean accepted)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete()
boolean
equals(java.lang.Object other)
java.lang.Boolean
getAccepted()
java.util.Date
getAcceptedAt()
InterMineBag
getBag()
static SharingInvite
getByToken(InterMineAPI im, java.lang.String token)
java.util.Date
getCreatedAt()
static java.util.Collection<SharingInvite.IntermediateRepresentation>
getInviteData(ProfileManager pm, Profile inviter)
java.lang.String
getInvitee()
static java.util.Collection<SharingInvite>
getInvites(InterMineAPI im, Profile inviter)
Get the invitations this profile has made.static java.util.Collection<SharingInvite>
getInvites(ProfileManager pm, BagManager bm, Profile inviter)
Get the invitations this profile has made.static java.lang.String
getTableDefinition()
java.lang.String
getToken()
int
hashCode()
protected void
save()
protected void
setAccepted(java.lang.Boolean wasAccepted)
java.lang.String
toString()
protected void
unaccept()
-
-
-
Field Detail
-
TABLE_NAME
public static final java.lang.String TABLE_NAME
The DB table that holds the invitations- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SharingInvite
protected SharingInvite(InterMineBag bag, java.lang.String invitee)
Constructor.- Parameters:
bag
- the bag to shareinvitee
- the person to share the list with
-
SharingInvite
protected SharingInvite(InterMineBag bag, java.lang.String invitee, java.lang.String token)
Constructor.- Parameters:
bag
- the bag to shareinvitee
- the person to share the list withtoken
- the User token
-
SharingInvite
protected SharingInvite(InterMineBag bag, java.lang.String invitee, java.lang.String token, java.util.Date createdAt, java.util.Date acceptedAt, java.lang.Boolean accepted)
Constructor.- Parameters:
bag
- the bag to shareinvitee
- the person to share the list withtoken
- the User tokencreatedAt
- date createdacceptedAt
- date acceptedaccepted
- true if accepted
-
-
Method Detail
-
getTableDefinition
public static java.lang.String getTableDefinition()
- Returns:
- the SQL needed to create the table
-
delete
public void delete() throws java.sql.SQLException, SharingInvite.NotFoundException
- Throws:
java.sql.SQLException
- database has wrong modelSharingInvite.NotFoundException
- invite not found
-
setAccepted
protected void setAccepted(java.lang.Boolean wasAccepted) throws java.sql.SQLException
- Parameters:
wasAccepted
- true if accepted- Throws:
java.sql.SQLException
- database has wrong model
-
unaccept
protected void unaccept() throws java.sql.SQLException
- Throws:
java.sql.SQLException
- database has wrong model
-
save
protected void save() throws java.sql.SQLException
- Throws:
java.sql.SQLException
- database has wrong model
-
getInviteData
public static java.util.Collection<SharingInvite.IntermediateRepresentation> getInviteData(ProfileManager pm, Profile inviter) throws java.sql.SQLException
- Parameters:
pm
- profile managerinviter
- user who send the invite- Returns:
- collection of objects holding the invite data
- Throws:
java.sql.SQLException
- userprofile database doesn't have the correct model
-
getInvites
public static java.util.Collection<SharingInvite> getInvites(InterMineAPI im, Profile inviter) throws java.sql.SQLException, ObjectStoreException
Get the invitations this profile has made.- Parameters:
im
- The API of the data-warehouseinviter
- The profile of the user that made the invitations.- Returns:
- A list of invitations
- Throws:
java.sql.SQLException
- If a connection cannot be established, or the SQL is bad.ObjectStoreException
- If the bag referenced by the invitation doesn't exist.
-
getInvites
public static java.util.Collection<SharingInvite> getInvites(ProfileManager pm, BagManager bm, Profile inviter) throws java.sql.SQLException, ObjectStoreException
Get the invitations this profile has made.- Parameters:
pm
- profile managerbm
- bag managerinviter
- The profile of the user that made the invitations.- Returns:
- A list of invitations
- Throws:
java.sql.SQLException
- If a connection cannot be established, or the SQL is bad.ObjectStoreException
- If the bag referenced by the invitation doesn't exist.
-
getByToken
public static SharingInvite getByToken(InterMineAPI im, java.lang.String token) throws java.sql.SQLException, ObjectStoreException, SharingInvite.NotFoundException
- Parameters:
im
- API for databasestoken
- user auth token- Returns:
- object representing the invite
- Throws:
ObjectStoreException
- error storing the datajava.sql.SQLException
- database has wrong modelSharingInvite.NotFoundException
- invite not found
-
getToken
public java.lang.String getToken()
- Returns:
- token
-
getBag
public InterMineBag getBag()
- Returns:
- list being shared
-
getInvitee
public java.lang.String getInvitee()
- Returns:
- user that received the invite
-
getCreatedAt
public java.util.Date getCreatedAt()
- Returns:
- date invite created
-
getAcceptedAt
public java.util.Date getAcceptedAt()
- Returns:
- data invite accepted by recipient
-
getAccepted
public java.lang.Boolean getAccepted()
- Returns:
- true if recipient accepted the invite
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-