package api.index;

/**
 * The Class Notifications.
 * Describes the notifications the user has, new messages
 * and new torrent notifications
 * 
 * @author Gwindow
 * @since May 5, 2012 10:37:31 AM
 */
public class Notifications {
	/** Number of new messages. */
	private Number messages;

	/** Number of torrent notifications */
	private Number notifications;

	/**
	 * Get the number of new messages
	 * 
	 * @return number of new messages
	 */
	public Number getMessages() {
		return messages;
	}

	/**
	 * Get the number of torrent notifications
	 * 
	 * @return number of torrent notifications
	 */
	public Number getNotifications() {
		return notifications;
	}

	/**
	 * Check if there are any new messages
	 * 
	 * @return True if there are new messages
	 */
	public boolean hasNewMessages() {
		return (messages.intValue() > 0);
	}

	/**
	 * Check if there are any new torrent notifications
	 * 
	 * @return True if there are any new torrent notifications
	 */
	public boolean hasNewNotifications() {
		return (notifications.intValue() > 0);
    }

	@Override
	public String toString() {
		return "Notifications [getMessages()=" + getMessages() + ", getNotifications()=" + getNotifications()
				+ ", hasNewMessages()=" + hasNewMessages() + ", hasNewNotifications()=" + hasNewNotifications() + "]";
	}

}

@@ -353,24 +353,274 @@
 fications;%0A%0A
+%09/**%0A%09 * If a new announcement has been posted%0A%09 */%0A%09private Boolean newAnnouncement;%0A%0A%09/**%0A%09 * If a new blog has been posted%0A%09 */%0A%09private Boolean newBlog;%0A%0A%09/**%0A%09 * If we have new subscription notifications%0A%09 */%0A%09private Boolean newSubscriptions;%0A%0A
 %09/**%0A%09 * Get
@@ -863,24 +863,31 @@
 c Number get
+Torrent
 Notification
@@ -1033,27 +1033,24 @@
  boolean has
-New
 Messages() %7B
@@ -1059,17 +1059,16 @@
 %09return 
-(
 messages
@@ -1082,17 +1082,16 @@
 ue() %3E 0
-)
 ;%0A%09%7D%0A%0A%09/
@@ -1231,27 +1231,31 @@
  boolean has
-New
+Torrent
 Notification
@@ -1249,33 +1249,32 @@
 tNotifications()
- 
 %7B%0A%09%09return (noti
@@ -1268,17 +1268,16 @@
 %09return 
-(
 notifica
@@ -1300,15 +1300,402 @@
  %3E 0
-);%0A    
+;%0A%09%7D%0A%0A%09/**%0A%09 * True if a new announcement has been posted on the site%0A%09 */%0A%09public Boolean hasNewAnnouncement()%7B%0A%09%09return newAnnouncement;%0A%09%7D%0A%0A%09/**%0A%09 * True if the user has new subscription notifications%0A%09 */%0A%09public Boolean hasNewSubscriptions()%7B%0A%09%09return newSubscriptions;%0A%09%7D%0A%0A%09/**%0A%09 * True if a new blog post has been posted on the site%0A%09 */%0A%09public Boolean hasNewBlog()%7B%0A%09%09return newBlog;%0A%09
 %7D%0A%0A%09
@@ -1729,17 +1729,16 @@
 String()
- 
 %7B%0A%09%09retu
@@ -1815,24 +1815,31 @@
 ns()=%22 + get
+Torrent
 Notification
@@ -1845,17 +1845,16 @@
 ns()%0A%09%09%09
-%09
 + %22, has
@@ -1856,24 +1856,28 @@
 , hasNew
-Messages
+Announcement
 ()=%22 + h
@@ -1881,24 +1881,28 @@
 + hasNew
-Messages
+Announcement
 () + %22, 
@@ -1903,32 +1903,32 @@
  + %22, hasNew
-Notifica
+Subscrip
 tions()=%22 + 
@@ -1933,29 +1933,67 @@
 + hasNew
-Notifications
+Subscriptions()%0A%09%09%09+ %22, hasNewBlog()=%22 + hasNewBlog
 () + %22%5D%22
@@ -1997,11 +1997,10 @@
 %22%5D%22;%0A%09%7D%0A
-%0A
 %7D%0A

Add support for the announcement, blog and subscriptions fields of the index