Class SharingInvite


  • public class SharingInvite
    extends java.lang.Object
    A representation of an invitation to share a resource.
    Author:
    Alex Kalderimis
    • 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 share
        invitee - 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 share
        invitee - the person to share the list with
        token - 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 share
        invitee - the person to share the list with
        token - the User token
        createdAt - date created
        acceptedAt - date accepted
        accepted - true if accepted
    • Method Detail

      • getTableDefinition

        public static java.lang.String getTableDefinition()
        Returns:
        the SQL needed to create the table
      • 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 manager
        inviter - 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-warehouse
        inviter - 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 manager
        bm - bag manager
        inviter - 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.
      • 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 class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object