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 NotificationaddContentNotification(com.atlassian.user.User user, ContentEntityObject content)NotificationaddDailyReportNotfication(com.atlassian.user.User user)NotificationaddDailyReportNotification(ConfluenceUser user)booleanaddLabelNotification(com.atlassian.user.User user, Label label)@Nullable NotificationaddSpaceNotification(com.atlassian.user.User user, Space space)@Nullable NotificationaddSpaceNotification(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.NotificationgetDailyReportNotificationForUser(com.atlassian.user.User user)List<Notification>getDailyReportNotifications()NotificationgetNetworkNotificationForUser(com.atlassian.user.User user)NotificationgetNotificationById(long id)NotificationgetNotificationByUserAndContent(com.atlassian.user.User user, ContentEntityObject content)NotificationgetNotificationByUserAndSpace(com.atlassian.user.User user, Space space)Return a notification if the user is watching the entire space.NotificationgetNotificationByUserAndSpace(com.atlassian.user.User user, String spaceKey)Return a notification if the user is watching the entire space with the given spaceKey.NotificationgetNotificationByUserAndSpaceAndType(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)NotificationgetSiteBlogNotificationForUser(com.atlassian.user.User user)List<Notification>getSiteBlogNotifications()booleanisUserWatchingPageOrSpace(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 SpacebooleanisWatchingContent(@Nullable com.atlassian.user.User user, @Nullable ContentEntityObject content)Returns true if the given user is directly watching the given content.booleanisWatchingLabel(com.atlassian.user.User user, Label label)voidremoveAllNotificationsForSpace(Space space)Remove all of the notifications set up for this space.voidremoveAllNotificationsForUser(com.atlassian.user.User user)Remove all of the notifications setup for this user.voidremoveContentNotification(com.atlassian.user.User user, ContentEntityObject content)voidremoveDailyReportNotification(com.atlassian.user.User user)voidremoveLabelNotification(com.atlassian.user.User user, Label label)voidremoveNotification(Notification notification)voidremoveSpaceNotification(com.atlassian.user.User user, Space space)voidsetNetworkNotificationForUser(ConfluenceUser user, boolean watchingNetwork)voidsetNetworkNotificationForUser(com.atlassian.user.User user, boolean watchingNetwork)voidsetSiteBlogNotificationForUser(ConfluenceUser user, boolean globalBlogWatchForUser)voidsetSiteBlogNotificationForUser(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:
getNotificationsByUserin interfaceNotificationManager
-
getNotificationByUserAndSpace
public Notification getNotificationByUserAndSpace(com.atlassian.user.User user, String spaceKey)
Description copied from interface:NotificationManagerReturn 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:
getNotificationByUserAndSpacein interfaceNotificationManager
-
getNotificationByUserAndSpace
public Notification getNotificationByUserAndSpace(com.atlassian.user.User user, Space space)
Description copied from interface:NotificationManagerReturn 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:
getNotificationByUserAndSpacein interfaceNotificationManager
-
getNotificationByUserAndSpaceAndType
public Notification getNotificationByUserAndSpaceAndType(com.atlassian.user.User user, Space space, ContentTypeEnum type)
- Specified by:
getNotificationByUserAndSpaceAndTypein interfaceNotificationManager
-
addSpaceNotification
public @Nullable Notification addSpaceNotification(com.atlassian.user.User user, Space space)
- Specified by:
addSpaceNotificationin interfaceNotificationManager
-
removeSpaceNotification
public void removeSpaceNotification(com.atlassian.user.User user, Space space)- Specified by:
removeSpaceNotificationin interfaceNotificationManager
-
addContentNotification
public @Nullable Notification addContentNotification(com.atlassian.user.User user, ContentEntityObject content)
- Specified by:
addContentNotificationin interfaceNotificationManager
-
removeContentNotification
public void removeContentNotification(com.atlassian.user.User user, ContentEntityObject content)- Specified by:
removeContentNotificationin interfaceNotificationManager
-
getNotificationsByContent
public List<Notification> getNotificationsByContent(ContentEntityObject content)
- Specified by:
getNotificationsByContentin interfaceNotificationManager
-
getNotificationsByContents
public List<Notification> getNotificationsByContents(List<ContentEntityObject> contents)
- Specified by:
getNotificationsByContentsin interfaceNotificationManager
-
getNotificationByUserAndContent
public Notification getNotificationByUserAndContent(com.atlassian.user.User user, ContentEntityObject content)
- Specified by:
getNotificationByUserAndContentin interfaceNotificationManager
-
isWatchingContent
public boolean isWatchingContent(@Nullable com.atlassian.user.User user, @Nullable ContentEntityObject content)Description copied from interface:NotificationManagerReturns true if the given user is directly watching the given content.Returns false if either the user or the content is null.
- Specified by:
isWatchingContentin 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:
addLabelNotificationin interfaceNotificationManager
-
removeLabelNotification
public void removeLabelNotification(com.atlassian.user.User user, Label label)- Specified by:
removeLabelNotificationin interfaceNotificationManager
-
isWatchingLabel
public boolean isWatchingLabel(com.atlassian.user.User user, Label label)- Specified by:
isWatchingLabelin interfaceNotificationManager
-
getNotificationsByLabel
public List<Notification> getNotificationsByLabel(Label label)
- Specified by:
getNotificationsByLabelin interfaceNotificationManager
-
addSpaceNotification
public @Nullable Notification addSpaceNotification(com.atlassian.user.User user, Space space, ContentTypeEnum type)
Description copied from interface:NotificationManagerAdd a space notification for a particular content type. For example, watch only blogs in a space.- Specified by:
addSpaceNotificationin interfaceNotificationManager
-
removeNotification
public void removeNotification(Notification notification)
- Specified by:
removeNotificationin interfaceNotificationManager
-
isUserWatchingPageOrSpace
public boolean isUserWatchingPageOrSpace(com.atlassian.user.User user, Space space, AbstractPage page)Description copied from interface:NotificationManagerReturns 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:
isUserWatchingPageOrSpacein interfaceNotificationManager
-
getNotificationsBySpaceAndType
public List<Notification> getNotificationsBySpaceAndType(Space space, ContentTypeEnum type)
- Specified by:
getNotificationsBySpaceAndTypein interfaceNotificationManager
-
getNotificationsBySpacesAndType
public List<Notification> getNotificationsBySpacesAndType(List<Space> spaces, ContentTypeEnum type)
- Specified by:
getNotificationsBySpacesAndTypein interfaceNotificationManager
-
removeAllNotificationsForUser
public void removeAllNotificationsForUser(com.atlassian.user.User user)
Description copied from interface:NotificationManagerRemove all of the notifications setup for this user. This includes space, page and daily report notifications.- Specified by:
removeAllNotificationsForUserin interfaceNotificationManager
-
removeAllNotificationsForSpace
public void removeAllNotificationsForSpace(Space space)
Description copied from interface:NotificationManagerRemove all of the notifications set up for this space.- Specified by:
removeAllNotificationsForSpacein interfaceNotificationManager
-
getDailyReportNotifications
public List<Notification> getDailyReportNotifications()
- Specified by:
getDailyReportNotificationsin interfaceNotificationManager
-
getDailyReportNotificationForUser
public Notification getDailyReportNotificationForUser(com.atlassian.user.User user)
- Specified by:
getDailyReportNotificationForUserin interfaceNotificationManager
-
getSiteBlogNotifications
public List<Notification> getSiteBlogNotifications()
- Specified by:
getSiteBlogNotificationsin interfaceNotificationManager
-
findNotificationsByFollowing
public List<Notification> findNotificationsByFollowing(com.atlassian.user.User modifier)
Description copied from interface:NotificationManagerRetrieves the list of NetworkNotifications forUsers who are following the givenUser. That is, allNotifications that returntruefromNotification.isNetwork()and belong to somebody who is followingmodifiervia aConnection.- Specified by:
findNotificationsByFollowingin 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:NotificationManagerRetrieves 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:
findPageAndSpaceNotificationIdsFromSpacein 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:
getSiteBlogNotificationForUserin interfaceNotificationManager
-
getNetworkNotificationForUser
public Notification getNetworkNotificationForUser(com.atlassian.user.User user)
- Specified by:
getNetworkNotificationForUserin interfaceNotificationManager
-
getNotificationById
public Notification getNotificationById(long id)
- Specified by:
getNotificationByIdin interfaceNotificationManager
-
setSiteBlogNotificationForUser
public void setSiteBlogNotificationForUser(com.atlassian.user.User user, boolean globalBlogWatchForUser)- Specified by:
setSiteBlogNotificationForUserin interfaceNotificationManager
-
setSiteBlogNotificationForUser
public void setSiteBlogNotificationForUser(ConfluenceUser user, boolean globalBlogWatchForUser)
- Specified by:
setSiteBlogNotificationForUserin interfaceNotificationManager
-
setNetworkNotificationForUser
public void setNetworkNotificationForUser(com.atlassian.user.User user, boolean watchingNetwork)- Specified by:
setNetworkNotificationForUserin interfaceNotificationManager
-
setNetworkNotificationForUser
public void setNetworkNotificationForUser(ConfluenceUser user, boolean watchingNetwork)
- Specified by:
setNetworkNotificationForUserin interfaceNotificationManager
-
addDailyReportNotfication
public Notification addDailyReportNotfication(com.atlassian.user.User user)
- Specified by:
addDailyReportNotficationin interfaceNotificationManager
-
addDailyReportNotification
public Notification addDailyReportNotification(ConfluenceUser user)
- Specified by:
addDailyReportNotificationin interfaceNotificationManager
-
removeDailyReportNotification
public void removeDailyReportNotification(com.atlassian.user.User user)
- Specified by:
removeDailyReportNotificationin interfaceNotificationManager
-
-