Beispiel #1
0
 @Override
 public int compareTo(Identifiable i) {
   if (i instanceof Group) {
     Group j = (Group) i;
     if (this.getID().compareTo(j.getID()) < 0) {
       return -1;
     } else if (this.getID().compareTo(j.getID()) > 0) {
       return 1;
     } else {
       return 0;
     }
   } else {
     return (this.getID().compareTo(i.getID()));
   }
 }
Beispiel #2
0
 /**
  * Converts the contents of the GroupInvite to a {@link java.lang.String} in order to save it to
  * file. The toString method will save the invite as follows: Sender: senderID Receiver:
  * receiverID Text: text ID : groupID
  */
 public String toString() {
   return ("Type:"
       + type
       + "\nSender:"
       + sender.getID()
       + "\nReceiver:"
       + receiver.getID()
       + "\nGroup:"
       + group.getID()
       + "\nText:"
       + text
       + "\n"); // Just for compile
 }
Beispiel #3
0
 GroupInvite(User sender, User receiver, Group group) {
   this.sender = sender;
   this.receiver = receiver;
   this.group = group;
   this.text =
       "<a href = profile.jsp?ID="
           + sender.getID()
           + ">"
           + sender.getDisplayName()
           + "</a>"
           + " has invited you to join "
           + "<a href profile.jsp?ID="
           + group.getID()
           + ">"
           + group.getDisplayName()
           + "</a>";
   type = "GroupInvite";
 }
Beispiel #4
0
 private void update() {
   try {
     group.subscribeTo(receiver);
     receiver.addGroup(group);
     Date date = new Date();
     receiver.post(
         "<a href = profile.jsp?ID="
             + receiver.getID()
             + ">"
             + receiver.getDisplayName()
             + "</a>"
             + " joined "
             + "<a href = profile.jsp?ID="
             + group.getID()
             + ">"
             + group.getDisplayName()
             + "</a>",
         receiver,
         date);
   } catch (Exception e) { // Fix to later return some sort of bs
     e.printStackTrace();
   }
 }