com.atlassian.mywork.host.dao.ao
Class AONotificationDao

java.lang.Object
  extended by com.atlassian.mywork.host.dao.ao.AbstractAODao<AONotification,java.lang.Long>
      extended by com.atlassian.mywork.host.dao.ao.AONotificationDao
All Implemented Interfaces:
NotificationDao

public class AONotificationDao
extends AbstractAODao<AONotification,java.lang.Long>
implements NotificationDao


Field Summary
 
Fields inherited from class com.atlassian.mywork.host.dao.ao.AbstractAODao
ao
 
Constructor Summary
AONotificationDao(com.atlassian.activeobjects.external.ActiveObjects ao)
           
 
Method Summary
 int countByGlobalId(java.lang.String username, java.lang.String globalId)
          Returns number of notifications for the given user with a given globalId.
 Notification create(Notification notification)
           
protected  Notification create(Notification notification, java.util.Date date)
           
 Notification delete(long id)
           
 int deleteAll(java.lang.String username)
           
 java.lang.Iterable<Notification> deleteByGlobalId(java.lang.String globalId)
           
 int deleteOldNotifications(int days, boolean read)
          Deletes notifications that are older than the given number of days.
 java.lang.Iterable<Notification> findAll(java.lang.String username)
          Returns all notifications for the given user.
 java.lang.Iterable<Notification> findAllAfter(java.lang.String username, long lastReadNotificationId, long before, int limit)
          Returns all notifications for the given user after a given notification.
 java.lang.Iterable<Notification> findAllUnread(java.lang.String username)
          Returns all unread notifications for the given user.
 java.lang.Iterable<Notification> findAllUnreadAfter(java.lang.String username, long notificationId)
           
 java.lang.Iterable<Notification> findByGlobalId(java.lang.String username, java.lang.String globalId)
          Returns all notifications for the given user with a given globalId.
 Notification get(long id)
           
protected static boolean isMetadataMatch(org.codehaus.jackson.node.ObjectNode metadata, org.codehaus.jackson.node.ObjectNode condition)
           
 void markAllRead(java.lang.String username, long before)
           
 void setRead(java.lang.String username, java.util.List<java.lang.Long> notificationIds)
           
 void setStatusByGlobalId(java.lang.String username, java.lang.String globalId, Status status)
           
 Notification update(Notification notification)
           
protected  Notification update(Notification notification, java.util.Date date)
           
 void updateMetadata(java.lang.String username, java.lang.String globalId, org.codehaus.jackson.node.ObjectNode condition, org.codehaus.jackson.node.ObjectNode newMetadata)
           
 
Methods inherited from class com.atlassian.mywork.host.dao.ao.AbstractAODao
findOnly, findOnly, getAO, streamOnly, toObjectNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AONotificationDao

public AONotificationDao(com.atlassian.activeobjects.external.ActiveObjects ao)
Method Detail

get

public Notification get(long id)
Specified by:
get in interface NotificationDao

create

public Notification create(Notification notification)
Specified by:
create in interface NotificationDao

create

protected Notification create(Notification notification,
                              java.util.Date date)

update

public Notification update(Notification notification)
Specified by:
update in interface NotificationDao

update

protected Notification update(Notification notification,
                              java.util.Date date)

updateMetadata

public void updateMetadata(java.lang.String username,
                           java.lang.String globalId,
                           org.codehaus.jackson.node.ObjectNode condition,
                           org.codehaus.jackson.node.ObjectNode newMetadata)
Specified by:
updateMetadata in interface NotificationDao

isMetadataMatch

protected static boolean isMetadataMatch(org.codehaus.jackson.node.ObjectNode metadata,
                                         org.codehaus.jackson.node.ObjectNode condition)

delete

public Notification delete(long id)
Specified by:
delete in interface NotificationDao

deleteByGlobalId

public java.lang.Iterable<Notification> deleteByGlobalId(java.lang.String globalId)
Specified by:
deleteByGlobalId in interface NotificationDao

deleteAll

public int deleteAll(java.lang.String username)
Specified by:
deleteAll in interface NotificationDao

setStatusByGlobalId

public void setStatusByGlobalId(java.lang.String username,
                                java.lang.String globalId,
                                Status status)
Specified by:
setStatusByGlobalId in interface NotificationDao

findAll

public java.lang.Iterable<Notification> findAll(java.lang.String username)
Description copied from interface: NotificationDao
Returns all notifications for the given user.

Specified by:
findAll in interface NotificationDao
Parameters:
username - username of the user to retrieve notifications for
Returns:
all notifications for the given user.

findAllUnread

public java.lang.Iterable<Notification> findAllUnread(java.lang.String username)
Description copied from interface: NotificationDao
Returns all unread notifications for the given user.

Specified by:
findAllUnread in interface NotificationDao
Parameters:
username - username of the user to retrieve notifications for
Returns:
all unread notifications for the given user.

findAllUnreadAfter

public java.lang.Iterable<Notification> findAllUnreadAfter(java.lang.String username,
                                                           long notificationId)
Specified by:
findAllUnreadAfter in interface NotificationDao

findAllAfter

public java.lang.Iterable<Notification> findAllAfter(java.lang.String username,
                                                     long lastReadNotificationId,
                                                     long before,
                                                     int limit)
Description copied from interface: NotificationDao
Returns all notifications for the given user after a given notification.

Specified by:
findAllAfter in interface NotificationDao
Parameters:
username - username of the user to retrieve notifications for
lastReadNotificationId - notification id to search from
before - notification id to search to
limit - maximum number of results to return
Returns:
all notifications for the given user.

findByGlobalId

public java.lang.Iterable<Notification> findByGlobalId(java.lang.String username,
                                                       java.lang.String globalId)
Description copied from interface: NotificationDao
Returns all notifications for the given user with a given globalId.

Specified by:
findByGlobalId in interface NotificationDao
Parameters:
username - username of the user to retrieve notifications for
Returns:
all notifications for the given user.

countByGlobalId

public int countByGlobalId(java.lang.String username,
                           java.lang.String globalId)
Description copied from interface: NotificationDao
Returns number of notifications for the given user with a given globalId.

Specified by:
countByGlobalId in interface NotificationDao
Parameters:
username - username of the user to retrieve number of notifications for
Returns:
number of notifications for the given user.

deleteOldNotifications

public int deleteOldNotifications(int days,
                                  boolean read)
Description copied from interface: NotificationDao
Deletes notifications that are older than the given number of days. This does not include pinned notifications.

Specified by:
deleteOldNotifications in interface NotificationDao
Parameters:
days - number of days that notifications should be kept for
read - where to delete read or unread
Returns:
number of notifications deleted

markAllRead

public void markAllRead(java.lang.String username,
                        long before)
Specified by:
markAllRead in interface NotificationDao

setRead

public void setRead(java.lang.String username,
                    java.util.List<java.lang.Long> notificationIds)
Specified by:
setRead in interface NotificationDao


Copyright © 2012 Atlassian. All Rights Reserved.