net.anidb.udp
Class UdpNotificationFactory

java.lang.Object
  extended by net.anidb.udp.UdpNotificationFactory

public class UdpNotificationFactory
extends java.lang.Object

A factory for notifications.

Version:
1.0, 14.01.2010
Author:
grizzlyxp (http://anidb.net/perl-bin/animedb.pl?show=userpage&uid=63935)

Method Summary
 void acknowledgeNotification(NotificationListEntry listEntry)
          Acknowledges the notification for the given list entry.
 void acknowledgeNotification(java.lang.String type, long id)
          Acknowledges the notification for the given type and Id.
static UdpNotificationFactory getInstance(UdpConnection conn)
          Returns an instance of this class.
 Notification getNotification(NotificationListEntry listEntry)
          Returns the notification for the given list entry.
 Notification getNotification(java.lang.String type, long id)
          Returns the notification for the given type and Id.
 java.util.List<NotificationListEntry> getNotifyList()
          Returns a list of entries of all pending (not acknowledged) new private message and new file notifications.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static UdpNotificationFactory getInstance(UdpConnection conn)
Returns an instance of this class.

Parameters:
conn - The connection.
Returns:
The instance.
Throws:
java.lang.IllegalArgumentException - If the connection is null.

getNotifyList

public java.util.List<NotificationListEntry> getNotifyList()
                                                    throws UdpConnectionException,
                                                           AniDbException

Returns a list of entries of all pending (not acknowledged) new private message and new file notifications.

Buddy events cannot be acknowledged.

Returns:
The list.
Throws:
UdpConnectionException - If a connection problem occured.
AniDbException - If a problem with AniDB occured.

getNotification

public Notification getNotification(NotificationListEntry listEntry)
                             throws UdpConnectionException,
                                    AniDbException
Returns the notification for the given list entry.

Parameters:
listEntry - The list entry.
Returns:
The notification.
Throws:
java.lang.IllegalArgumentException - If the list entry is null.
UdpConnectionException - If a connection problem occured.
AniDbException - If a problem with AniDB occured.
See Also:
UdpReturnCodes.NO_SUCH_MESSAGE, UdpReturnCodes.NO_SUCH_NOTIFY

getNotification

public Notification getNotification(java.lang.String type,
                                    long id)
                             throws UdpConnectionException,
                                    AniDbException
Returns the notification for the given type and Id.

Parameters:
type - The type.
id - The Id.
Returns:
The notification.
Throws:
java.lang.IllegalArgumentException - If the type is null or the given type isn't supported.
UdpConnectionException - If a connection problem occured.
AniDbException - If a problem with AniDB occured.
See Also:
UdpReturnCodes.NO_SUCH_MESSAGE, UdpReturnCodes.NO_SUCH_NOTIFY

acknowledgeNotification

public void acknowledgeNotification(NotificationListEntry listEntry)
                             throws UdpConnectionException,
                                    AniDbException
Acknowledges the notification for the given list entry.

Parameters:
listEntry - The list entry.
Throws:
java.lang.IllegalArgumentException - If the list entry is null.
UdpConnectionException - If a connection problem occured.
AniDbException - If a problem with AniDB occured.
See Also:
UdpReturnCodes.NO_SUCH_ENTRY_M, UdpReturnCodes.NO_SUCH_ENTRY_N

acknowledgeNotification

public void acknowledgeNotification(java.lang.String type,
                                    long id)
                             throws UdpConnectionException,
                                    AniDbException
Acknowledges the notification for the given type and Id.

Parameters:
type - The type.
id - The Id.
Throws:
java.lang.IllegalArgumentException - If the type is null or the given type isn't supported.
UdpConnectionException - If a connection problem occured.
AniDbException - If a problem with AniDB occured.
See Also:
UdpReturnCodes.NO_SUCH_ENTRY_M, UdpReturnCodes.NO_SUCH_ENTRY_N