com.atlassian.confluence.mail.notification
Class DefaultNotificationManager

java.lang.Object
  extended by com.atlassian.confluence.mail.notification.DefaultNotificationManager
All Implemented Interfaces:
NotificationManager

public class DefaultNotificationManager
extends java.lang.Object
implements NotificationManager


Constructor Summary
DefaultNotificationManager()
           
 
Method Summary
 Notification addContentNotification(com.atlassian.user.User user, ContentEntityObject content)
           
 Notification addDailyReportNotfication(com.atlassian.user.User user)
           
 boolean addLabelNotification(com.atlassian.user.User user, Label label)
           
protected  Notification addNotification(com.atlassian.user.User user, Space space, AbstractPage page)
          Adds a page or space notification for a user.
protected  Notification addNotification(com.atlassian.user.User user, Space space, AbstractPage page, ContentTypeEnum type)
           
 Notification addPageNotification(com.atlassian.user.User user, AbstractPage page)
          Deprecated. since 5.3. Use addContentNotification(com.atlassian.user.User, com.atlassian.confluence.core.ContentEntityObject) instead.
 Notification addSpaceNotification(com.atlassian.user.User user, Space space)
           
 Notification addSpaceNotification(com.atlassian.user.User user, Space space, ContentTypeEnum type)
          Add a space notification for a particular content type.
 java.util.List<Notification> findNotificationsByFollowing(com.atlassian.user.User modifier)
          Retrieves the list of Network Notifications for Users who are following the given User.
 java.lang.Iterable<java.lang.Long> findPageAndSpaceNotificationIdsFromSpace(Space space)
          Retrieves ids of all notifications in a space.
 Notification getDailyReportNotificationForUser(com.atlassian.user.User user)
           
 java.util.List<Notification> getDailyReportNotifications()
           
 Notification getNetworkNotificationForUser(com.atlassian.user.User user)
           
 Notification getNotificationByUserAndContent(com.atlassian.user.User user, ContentEntityObject content)
           
 Notification getNotificationByUserAndPage(com.atlassian.user.User user, AbstractPage page)
          Deprecated. since 5.3. Use getNotificationByUserAndContent(com.atlassian.user.User, com.atlassian.confluence.core.ContentEntityObject) instead.
 Notification getNotificationByUserAndSpace(com.atlassian.user.User user, Space space)
          Return a notification if the user is watching the entire space.
 Notification getNotificationByUserAndSpace(com.atlassian.user.User user, java.lang.String spaceKey)
          Return a notification if the user is watching the entire space with the given spaceKey.
 Notification getNotificationByUserAndSpaceAndType(com.atlassian.user.User user, Space space, ContentTypeEnum type)
           
 NotificationDao getNotificationDao()
           
 java.util.List<Notification> getNotificationsByContent(ContentEntityObject content)
           
 java.util.List<Notification> getNotificationsByLabel(Label label)
           
 java.util.List<Notification> getNotificationsByPage(AbstractPage page)
          Deprecated. since 5.3. Use getNotificationsByContent(com.atlassian.confluence.core.ContentEntityObject) instead.
 java.util.List<Notification> getNotificationsBySpace(Space space)
          Deprecated. since 5.3. Use getNotificationsByContent(com.atlassian.confluence.core.ContentEntityObject) instead.
 java.util.List<Notification> getNotificationsBySpaceAndType(Space space, ContentTypeEnum type)
           
 java.util.List<Notification> getNotificationsByUser(com.atlassian.user.User user)
           
 Notification getSiteBlogNotificationForUser(com.atlassian.user.User user)
           
 java.util.List<Notification> getSiteBlogNotifications()
           
 boolean isUserWatchingPageOrSpace(com.atlassian.user.User user, Space space, AbstractPage page)
          Returns true if: a) the user is watching the AbstractPage b) the user is watching the space, or c) the user is watching the contentType of the AbstractPage for the Space This method can be used to check if a user is watching a page directly or indirectly.
 boolean isWatchingContent(com.atlassian.user.User user, ContentEntityObject content)
           
 boolean isWatchingLabel(com.atlassian.user.User user, Label label)
           
 void removeAllNotificationsForSpace(Space space)
          Remove all of the notifications set up for this space.
 void removeAllNotificationsForUser(com.atlassian.user.User user)
          Remove all of the notifications setup for this user.
 void removeContentNotification(com.atlassian.user.User user, ContentEntityObject content)
           
 void removeDailyReportNotification(com.atlassian.user.User user)
           
 void removeLabelNotification(com.atlassian.user.User user, Label label)
           
 void removeNotification(Notification notification)
           
 void setEventManager(com.atlassian.event.EventManager eventManager)
           
 void setNetworkNotificationForUser(com.atlassian.user.User user, boolean watchingNetwork)
           
 void setNotificationDao(NotificationDao notificationDao)
           
 void setSiteBlogNotificationForUser(com.atlassian.user.User user, boolean globalBlogWatchForUser)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultNotificationManager

public DefaultNotificationManager()
Method Detail

setEventManager

public void setEventManager(com.atlassian.event.EventManager eventManager)

getNotificationDao

public NotificationDao getNotificationDao()

setNotificationDao

public void setNotificationDao(NotificationDao notificationDao)

getNotificationsByUser

public java.util.List<Notification> getNotificationsByUser(com.atlassian.user.User user)
Specified by:
getNotificationsByUser in interface NotificationManager

getNotificationByUserAndPage

@Deprecated
public Notification getNotificationByUserAndPage(com.atlassian.user.User user,
                                                            AbstractPage page)
Deprecated. since 5.3. Use getNotificationByUserAndContent(com.atlassian.user.User, com.atlassian.confluence.core.ContentEntityObject) instead.

Specified by:
getNotificationByUserAndPage in interface NotificationManager

getNotificationByUserAndSpace

public Notification getNotificationByUserAndSpace(com.atlassian.user.User user,
                                                  java.lang.String spaceKey)
Description copied from interface: NotificationManager
Return a notification if the user is watching the entire space with the given spaceKey. Note that notifications with specified ContentTypeEnum values will not be returned. Use NotificationManager.getNotificationByUserAndSpaceAndType(com.atlassian.user.User, com.atlassian.confluence.spaces.Space, com.atlassian.confluence.search.service.ContentTypeEnum) instead.

Specified by:
getNotificationByUserAndSpace in interface NotificationManager

getNotificationByUserAndSpace

public Notification getNotificationByUserAndSpace(com.atlassian.user.User user,
                                                  Space space)
Description copied from interface: NotificationManager
Return a notification if the user is watching the entire space. Note that notifications with specified ContentTypeEnum values will not be returned. Use NotificationManager.getNotificationByUserAndSpaceAndType(com.atlassian.user.User, com.atlassian.confluence.spaces.Space, com.atlassian.confluence.search.service.ContentTypeEnum) instead.

Specified by:
getNotificationByUserAndSpace in interface NotificationManager

getNotificationByUserAndSpaceAndType

public Notification getNotificationByUserAndSpaceAndType(com.atlassian.user.User user,
                                                         Space space,
                                                         ContentTypeEnum type)
Specified by:
getNotificationByUserAndSpaceAndType in interface NotificationManager

addPageNotification

@Deprecated
public Notification addPageNotification(com.atlassian.user.User user,
                                                   AbstractPage page)
Deprecated. since 5.3. Use addContentNotification(com.atlassian.user.User, com.atlassian.confluence.core.ContentEntityObject) instead.

Specified by:
addPageNotification in interface NotificationManager

addSpaceNotification

public Notification addSpaceNotification(com.atlassian.user.User user,
                                         Space space)
Specified by:
addSpaceNotification in interface NotificationManager

addContentNotification

public Notification addContentNotification(com.atlassian.user.User user,
                                           ContentEntityObject content)
Specified by:
addContentNotification in interface NotificationManager

removeContentNotification

public void removeContentNotification(com.atlassian.user.User user,
                                      ContentEntityObject content)
Specified by:
removeContentNotification in interface NotificationManager

getNotificationsByContent

public java.util.List<Notification> getNotificationsByContent(ContentEntityObject content)
Specified by:
getNotificationsByContent in interface NotificationManager

getNotificationByUserAndContent

public Notification getNotificationByUserAndContent(com.atlassian.user.User user,
                                                    ContentEntityObject content)
Specified by:
getNotificationByUserAndContent in interface NotificationManager

isWatchingContent

public boolean isWatchingContent(com.atlassian.user.User user,
                                 ContentEntityObject content)
Specified by:
isWatchingContent in interface NotificationManager

addLabelNotification

public boolean addLabelNotification(com.atlassian.user.User user,
                                    Label label)
Specified by:
addLabelNotification in interface NotificationManager

removeLabelNotification

public void removeLabelNotification(com.atlassian.user.User user,
                                    Label label)
Specified by:
removeLabelNotification in interface NotificationManager

isWatchingLabel

public boolean isWatchingLabel(com.atlassian.user.User user,
                               Label label)
Specified by:
isWatchingLabel in interface NotificationManager

getNotificationsByLabel

public java.util.List<Notification> getNotificationsByLabel(Label label)
Specified by:
getNotificationsByLabel in interface NotificationManager

addSpaceNotification

public Notification addSpaceNotification(com.atlassian.user.User user,
                                         Space space,
                                         ContentTypeEnum type)
Description copied from interface: NotificationManager
Add a space notification for a particular content type. For example, watch only blogs in a space.

Specified by:
addSpaceNotification in interface NotificationManager

addNotification

protected Notification addNotification(com.atlassian.user.User user,
                                       Space space,
                                       AbstractPage page)
Adds a page or space notification for a user.

Parameters:
user - The user to add the notification for, should not be null
space - The space to add a watch for or that the page belongs to, can be null if user requests a page that doesn't exist
page - Page to be watched, null if trying to add a Space watch or if user requests a page that doesn't exist
Returns:
The notification that was added, or the existing notification if the watch already existed

addNotification

protected Notification addNotification(com.atlassian.user.User user,
                                       Space space,
                                       AbstractPage page,
                                       ContentTypeEnum type)

removeNotification

public void removeNotification(Notification notification)
Specified by:
removeNotification in interface NotificationManager

isUserWatchingPageOrSpace

public boolean isUserWatchingPageOrSpace(com.atlassian.user.User user,
                                         Space space,
                                         AbstractPage page)
Description copied from interface: NotificationManager
Returns true if: a) the user is watching the AbstractPage b) the user is watching the space, or c) the user is watching the contentType of the AbstractPage for the Space This method can be used to check if a user is watching a page directly or indirectly.

Specified by:
isUserWatchingPageOrSpace in interface NotificationManager

getNotificationsByPage

@Deprecated
public java.util.List<Notification> getNotificationsByPage(AbstractPage page)
Deprecated. since 5.3. Use getNotificationsByContent(com.atlassian.confluence.core.ContentEntityObject) instead.

Specified by:
getNotificationsByPage in interface NotificationManager

getNotificationsBySpace

@Deprecated
public java.util.List<Notification> getNotificationsBySpace(Space space)
Deprecated. since 5.3. Use getNotificationsByContent(com.atlassian.confluence.core.ContentEntityObject) instead.

Description copied from interface: NotificationManager
Return all notifications for a space, regardless of content type.

Specified by:
getNotificationsBySpace in interface NotificationManager

getNotificationsBySpaceAndType

public java.util.List<Notification> getNotificationsBySpaceAndType(Space space,
                                                                   ContentTypeEnum type)
Specified by:
getNotificationsBySpaceAndType in interface NotificationManager

removeAllNotificationsForUser

public void removeAllNotificationsForUser(com.atlassian.user.User user)
Description copied from interface: NotificationManager
Remove all of the notifications setup for this user. This includes space, page and daily report notifications.

Specified by:
removeAllNotificationsForUser in interface NotificationManager

removeAllNotificationsForSpace

public void removeAllNotificationsForSpace(Space space)
Description copied from interface: NotificationManager
Remove all of the notifications set up for this space.

Specified by:
removeAllNotificationsForSpace in interface NotificationManager

getDailyReportNotifications

public java.util.List<Notification> getDailyReportNotifications()
Specified by:
getDailyReportNotifications in interface NotificationManager

getDailyReportNotificationForUser

public Notification getDailyReportNotificationForUser(com.atlassian.user.User user)
Specified by:
getDailyReportNotificationForUser in interface NotificationManager

getSiteBlogNotifications

public java.util.List<Notification> getSiteBlogNotifications()
Specified by:
getSiteBlogNotifications in interface NotificationManager

findNotificationsByFollowing

public java.util.List<Notification> findNotificationsByFollowing(com.atlassian.user.User modifier)
Description copied from interface: NotificationManager
Retrieves the list of Network Notifications for Users who are following the given User. That is, all Notifications that return true from Notification.isNetwork() and belong to somebody who is following modifier via a Connection.

Specified by:
findNotificationsByFollowing in interface NotificationManager
Parameters:
modifier - usually a user who has modified a piece of content.
Returns:
notifications for anybody subscribed to network notifications who follows modifier.
See Also:
Connection

findPageAndSpaceNotificationIdsFromSpace

public java.lang.Iterable<java.lang.Long> findPageAndSpaceNotificationIdsFromSpace(Space space)
Description copied from interface: NotificationManager
Retrieves ids of all notifications in a space. This is useful for large-scale operations such as space exports. The result includes all notifications for the space, including notifications for pages in the space.

Specified by:
findPageAndSpaceNotificationIdsFromSpace in interface NotificationManager
Parameters:
space - a space to find the notifications for
Returns:
ids of all the notifications in the space.

getSiteBlogNotificationForUser

public Notification getSiteBlogNotificationForUser(com.atlassian.user.User user)
Specified by:
getSiteBlogNotificationForUser in interface NotificationManager

getNetworkNotificationForUser

public Notification getNetworkNotificationForUser(com.atlassian.user.User user)
Specified by:
getNetworkNotificationForUser in interface NotificationManager

setSiteBlogNotificationForUser

public void setSiteBlogNotificationForUser(com.atlassian.user.User user,
                                           boolean globalBlogWatchForUser)
Specified by:
setSiteBlogNotificationForUser in interface NotificationManager

setNetworkNotificationForUser

public void setNetworkNotificationForUser(com.atlassian.user.User user,
                                          boolean watchingNetwork)
Specified by:
setNetworkNotificationForUser in interface NotificationManager

addDailyReportNotfication

public Notification addDailyReportNotfication(com.atlassian.user.User user)
Specified by:
addDailyReportNotfication in interface NotificationManager

removeDailyReportNotification

public void removeDailyReportNotification(com.atlassian.user.User user)
Specified by:
removeDailyReportNotification in interface NotificationManager


Copyright © 2003-2014 Atlassian. All Rights Reserved.