Class DefaultNotificationManager
- java.lang.Object
-
- com.atlassian.confluence.mail.notification.DefaultNotificationManager
-
- All Implemented Interfaces:
NotificationManager
public class DefaultNotificationManager extends Object implements NotificationManager
-
-
Constructor Summary
Constructors Constructor Description DefaultNotificationManager(NotificationDao notificationDao, com.atlassian.event.api.EventPublisher eventPublisher)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable Notification
addContentNotification(com.atlassian.user.User user, ContentEntityObject content)
Notification
addDailyReportNotfication(com.atlassian.user.User user)
Notification
addDailyReportNotification(ConfluenceUser user)
boolean
addLabelNotification(com.atlassian.user.User user, Label label)
@Nullable Notification
addSpaceNotification(com.atlassian.user.User user, Space space)
@Nullable Notification
addSpaceNotification(com.atlassian.user.User user, Space space, ContentTypeEnum type)
Add a space notification for a particular content type.List<Notification>
findNotificationsByFollowing(com.atlassian.user.User modifier)
Iterable<Long>
findPageAndSpaceNotificationIdsFromSpace(Space space)
Retrieves ids of all notifications in a space.Notification
getDailyReportNotificationForUser(com.atlassian.user.User user)
List<Notification>
getDailyReportNotifications()
Notification
getNetworkNotificationForUser(com.atlassian.user.User user)
Notification
getNotificationById(long id)
Notification
getNotificationByUserAndContent(com.atlassian.user.User user, ContentEntityObject content)
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, 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)
List<Notification>
getNotificationsByContent(ContentEntityObject content)
List<Notification>
getNotificationsByContents(List<ContentEntityObject> contents)
List<Notification>
getNotificationsByLabel(Label label)
List<Notification>
getNotificationsBySpaceAndType(Space space, ContentTypeEnum type)
List<Notification>
getNotificationsBySpacesAndType(List<Space> spaces, ContentTypeEnum type)
List<Notification>
getNotificationsByUser(com.atlassian.user.User user)
Notification
getSiteBlogNotificationForUser(com.atlassian.user.User user)
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 Spaceboolean
isWatchingContent(@Nullable com.atlassian.user.User user, @Nullable ContentEntityObject content)
Returns true if the given user is directly watching the given 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
removeSpaceNotification(com.atlassian.user.User user, Space space)
void
setNetworkNotificationForUser(ConfluenceUser user, boolean watchingNetwork)
void
setNetworkNotificationForUser(com.atlassian.user.User user, boolean watchingNetwork)
void
setSiteBlogNotificationForUser(ConfluenceUser user, boolean globalBlogWatchForUser)
void
setSiteBlogNotificationForUser(com.atlassian.user.User user, boolean globalBlogWatchForUser)
-
-
-
Constructor Detail
-
DefaultNotificationManager
public DefaultNotificationManager(NotificationDao notificationDao, com.atlassian.event.api.EventPublisher eventPublisher)
-
-
Method Detail
-
getNotificationsByUser
public List<Notification> getNotificationsByUser(com.atlassian.user.User user)
- Specified by:
getNotificationsByUser
in interfaceNotificationManager
-
getNotificationByUserAndSpace
public Notification getNotificationByUserAndSpace(com.atlassian.user.User user, 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 interfaceNotificationManager
-
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 interfaceNotificationManager
-
getNotificationByUserAndSpaceAndType
public Notification getNotificationByUserAndSpaceAndType(com.atlassian.user.User user, Space space, ContentTypeEnum type)
- Specified by:
getNotificationByUserAndSpaceAndType
in interfaceNotificationManager
-
addSpaceNotification
public @Nullable Notification addSpaceNotification(com.atlassian.user.User user, Space space)
- Specified by:
addSpaceNotification
in interfaceNotificationManager
-
removeSpaceNotification
public void removeSpaceNotification(com.atlassian.user.User user, Space space)
- Specified by:
removeSpaceNotification
in interfaceNotificationManager
-
addContentNotification
public @Nullable Notification addContentNotification(com.atlassian.user.User user, ContentEntityObject content)
- Specified by:
addContentNotification
in interfaceNotificationManager
-
removeContentNotification
public void removeContentNotification(com.atlassian.user.User user, ContentEntityObject content)
- Specified by:
removeContentNotification
in interfaceNotificationManager
-
getNotificationsByContent
public List<Notification> getNotificationsByContent(ContentEntityObject content)
- Specified by:
getNotificationsByContent
in interfaceNotificationManager
-
getNotificationsByContents
public List<Notification> getNotificationsByContents(List<ContentEntityObject> contents)
- Specified by:
getNotificationsByContents
in interfaceNotificationManager
-
getNotificationByUserAndContent
public Notification getNotificationByUserAndContent(com.atlassian.user.User user, ContentEntityObject content)
- Specified by:
getNotificationByUserAndContent
in interfaceNotificationManager
-
isWatchingContent
public boolean isWatchingContent(@Nullable com.atlassian.user.User user, @Nullable ContentEntityObject content)
Description copied from interface:NotificationManager
Returns true if the given user is directly watching the given content.Returns false if either the user or the content is null.
- Specified by:
isWatchingContent
in interfaceNotificationManager
- Parameters:
user
- user to checkcontent
- content to check- Returns:
- true if the given user is directly watching the given content
-
addLabelNotification
public boolean addLabelNotification(com.atlassian.user.User user, Label label)
- Specified by:
addLabelNotification
in interfaceNotificationManager
-
removeLabelNotification
public void removeLabelNotification(com.atlassian.user.User user, Label label)
- Specified by:
removeLabelNotification
in interfaceNotificationManager
-
isWatchingLabel
public boolean isWatchingLabel(com.atlassian.user.User user, Label label)
- Specified by:
isWatchingLabel
in interfaceNotificationManager
-
getNotificationsByLabel
public List<Notification> getNotificationsByLabel(Label label)
- Specified by:
getNotificationsByLabel
in interfaceNotificationManager
-
addSpaceNotification
public @Nullable 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 interfaceNotificationManager
-
removeNotification
public void removeNotification(Notification notification)
- Specified by:
removeNotification
in interfaceNotificationManager
-
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 SpaceThis method can be used to check if a user is watching a page directly or indirectly.
- Specified by:
isUserWatchingPageOrSpace
in interfaceNotificationManager
-
getNotificationsBySpaceAndType
public List<Notification> getNotificationsBySpaceAndType(Space space, ContentTypeEnum type)
- Specified by:
getNotificationsBySpaceAndType
in interfaceNotificationManager
-
getNotificationsBySpacesAndType
public List<Notification> getNotificationsBySpacesAndType(List<Space> spaces, ContentTypeEnum type)
- Specified by:
getNotificationsBySpacesAndType
in interfaceNotificationManager
-
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 interfaceNotificationManager
-
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 interfaceNotificationManager
-
getDailyReportNotifications
public List<Notification> getDailyReportNotifications()
- Specified by:
getDailyReportNotifications
in interfaceNotificationManager
-
getDailyReportNotificationForUser
public Notification getDailyReportNotificationForUser(com.atlassian.user.User user)
- Specified by:
getDailyReportNotificationForUser
in interfaceNotificationManager
-
getSiteBlogNotifications
public List<Notification> getSiteBlogNotifications()
- Specified by:
getSiteBlogNotifications
in interfaceNotificationManager
-
findNotificationsByFollowing
public List<Notification> findNotificationsByFollowing(com.atlassian.user.User modifier)
Description copied from interface:NotificationManager
Retrieves the list of NetworkNotification
s forUser
s who are following the givenUser
. That is, allNotification
s that returntrue
fromNotification.isNetwork()
and belong to somebody who is followingmodifier
via aConnection
.- Specified by:
findNotificationsByFollowing
in interfaceNotificationManager
- 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 Iterable<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 interfaceNotificationManager
- 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 interfaceNotificationManager
-
getNetworkNotificationForUser
public Notification getNetworkNotificationForUser(com.atlassian.user.User user)
- Specified by:
getNetworkNotificationForUser
in interfaceNotificationManager
-
getNotificationById
public Notification getNotificationById(long id)
- Specified by:
getNotificationById
in interfaceNotificationManager
-
setSiteBlogNotificationForUser
public void setSiteBlogNotificationForUser(com.atlassian.user.User user, boolean globalBlogWatchForUser)
- Specified by:
setSiteBlogNotificationForUser
in interfaceNotificationManager
-
setSiteBlogNotificationForUser
public void setSiteBlogNotificationForUser(ConfluenceUser user, boolean globalBlogWatchForUser)
- Specified by:
setSiteBlogNotificationForUser
in interfaceNotificationManager
-
setNetworkNotificationForUser
public void setNetworkNotificationForUser(com.atlassian.user.User user, boolean watchingNetwork)
- Specified by:
setNetworkNotificationForUser
in interfaceNotificationManager
-
setNetworkNotificationForUser
public void setNetworkNotificationForUser(ConfluenceUser user, boolean watchingNetwork)
- Specified by:
setNetworkNotificationForUser
in interfaceNotificationManager
-
addDailyReportNotfication
public Notification addDailyReportNotfication(com.atlassian.user.User user)
- Specified by:
addDailyReportNotfication
in interfaceNotificationManager
-
addDailyReportNotification
public Notification addDailyReportNotification(ConfluenceUser user)
- Specified by:
addDailyReportNotification
in interfaceNotificationManager
-
removeDailyReportNotification
public void removeDailyReportNotification(com.atlassian.user.User user)
- Specified by:
removeDailyReportNotification
in interfaceNotificationManager
-
-