com.atlassian.bamboo.notification
Class NotificationManagerImpl

java.lang.Object
  extended by com.atlassian.bamboo.notification.NotificationManagerImpl
All Implemented Interfaces:
NotificationManager

public class NotificationManagerImpl
extends java.lang.Object
implements NotificationManager


Constructor Summary
NotificationManagerImpl()
           
 
Method Summary
 NotificationSet cloneNotificationSet(NotificationSet oldSet)
          Clone notification set and rules for use when cloning Plan
 NotificationRule createNotificationRule(java.lang.Class<? extends NotificationType> notificationTypeClass, java.lang.String conditionData, java.lang.Class<? extends NotificationRecipient> recipientTypeClass, java.lang.String recipientString)
          Creates a new NotificationRule from the NotificationType and NotificationRecipient specificed.
 NotificationRule createNotificationRule(java.lang.String conditionKey, java.lang.String conditionData, java.lang.String recipientString, java.lang.String recipientType)
          Create notification rule and provide required managers.
 NotificationRule createNotificationRuleFromAction(java.lang.String notificationTypeKey, java.lang.String notificationRecipientKey, java.util.Map<java.lang.String,java.lang.String[]> actionParams)
          Creates a notification rule based on the keys and params passed in from the action
 NotificationRule createNotificationRuleFromAction(java.lang.String notificationTypeKey, java.lang.String notificationRecipientKey, java.util.Map<java.lang.String,java.lang.String[]> actionParams, boolean allowLegacyConditions)
          Deprecated. 
 NotificationSet createOrGetSystemNotificationSet()
          Get the system notification set for this bamboo and if one doesn't exist create it!
 java.util.List<NotificationRecipient> getAllNotificationRecipients()
           
 java.util.List<NotificationType> getAllNotificationTypes()
           
 java.util.List<NotificationType> getChainNotificationTypes()
          Return notification types marked explicitly as "chain" notification in plugin xml description
 NotificationRecipient getNotificationRecipientFromKey(java.lang.String notificationRecipientKey)
           
 NotificationRule getNotificationRuleById(long notificationId)
          Get a specific notification rule
<T extends Plan>
java.util.Set<NotificationRule>
getNotificationRules(T plan)
          Extract notification rules for a plan.
 java.util.List<UsersNotification> getNotificationRulesForUser(BambooUser user)
          Retrieves all notification rules associated with a given user searches for notification rules: * assigned to the user * assigned to a group the user belongs to * assigned to the user's email or user's im address * assigned to watchers of a build the user has marked as their favourite
 java.util.List<NotificationSet> getNotificationSetsForType(NotificationSet.NotificationSetType type)
           
 NotificationType getNotificationTypeFromKey(java.lang.String key)
          Retrieve a specific NotificationType plugin module based on the given key.
 java.util.List<NotificationType> getPlanNotificationTypes()
           
 java.util.List<NotificationType> getSystemNotificationTypes()
           
 boolean isRecipientUserBase(NotificationRule notificationRule)
          Determines whether or not a notification rule recipient evaluates to a bamboo user and therefore comply with the users notification preference.
 void saveNotificationSet(NotificationSet nSet)
          Saves a notification set without requiring a build.
 void saveSystemNotificationRule(NotificationRule notificationRule)
          Do not use this method.
 void setBambooUserManager(BambooUserManager bambooUserManager)
           
 void setLabelManager(LabelManager labelManager)
           
 void setNotificationDao(NotificationDao notificationRuleDao)
           
 void setPluginAccessor(com.atlassian.plugin.PluginAccessor pluginAccessor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NotificationManagerImpl

public NotificationManagerImpl()
Method Detail

saveNotificationSet

public void saveNotificationSet(NotificationSet nSet)
Description copied from interface: NotificationManager
Saves a notification set without requiring a build.

Specified by:
saveNotificationSet in interface NotificationManager
Parameters:
nSet - the notification set to save

createNotificationRule

public NotificationRule createNotificationRule(java.lang.String conditionKey,
                                               java.lang.String conditionData,
                                               java.lang.String recipientString,
                                               java.lang.String recipientType)
Description copied from interface: NotificationManager
Create notification rule and provide required managers.

Specified by:
createNotificationRule in interface NotificationManager
Parameters:
conditionKey - - key representation of the notification type
conditionData - - any data the notification type requires
recipientString - - data the recipient type requires (e.g user or group name)
recipientType - - key representing the type of recipient
Returns:
a newly created notification rule

createNotificationRule

@NotNull
public NotificationRule createNotificationRule(@NotNull
                                                       java.lang.Class<? extends NotificationType> notificationTypeClass,
                                                       @Nullable
                                                       java.lang.String conditionData,
                                                       @NotNull
                                                       java.lang.Class<? extends NotificationRecipient> recipientTypeClass,
                                                       @Nullable
                                                       java.lang.String recipientString)
Description copied from interface: NotificationManager
Creates a new NotificationRule from the NotificationType and NotificationRecipient specificed.

Specified by:
createNotificationRule in interface NotificationManager
Parameters:
notificationTypeClass - NotificationType
conditionData - - any data the notification type requires
recipientTypeClass - NotificationRecipient
recipientString - - data the recipient type requires (e.g user or group name)
Returns:
a newly created notification rule

createNotificationRuleFromAction

@Deprecated
@NotNull
public NotificationRule createNotificationRuleFromAction(java.lang.String notificationTypeKey,
                                                                            java.lang.String notificationRecipientKey,
                                                                            java.util.Map<java.lang.String,java.lang.String[]> actionParams,
                                                                            boolean allowLegacyConditions)
                                                  throws java.lang.IllegalArgumentException
Deprecated. 

Description copied from interface: NotificationManager
Creates a notification rule based on the keys and params passed in from the action

Specified by:
createNotificationRuleFromAction in interface NotificationManager
Parameters:
notificationTypeKey - - the plugin key for the notification type selected
notificationRecipientKey - - the plugin key for the notification recipient type selected
actionParams - - the action params.
allowLegacyConditions - - @deprecated, does nothing
Returns:
a new notification rule
Throws:
java.lang.IllegalArgumentException - if either of the keys provided is invalid

createNotificationRuleFromAction

@NotNull
public NotificationRule createNotificationRuleFromAction(java.lang.String notificationTypeKey,
                                                                 java.lang.String notificationRecipientKey,
                                                                 java.util.Map<java.lang.String,java.lang.String[]> actionParams)
                                                  throws java.lang.IllegalArgumentException
Description copied from interface: NotificationManager
Creates a notification rule based on the keys and params passed in from the action

Specified by:
createNotificationRuleFromAction in interface NotificationManager
Parameters:
notificationTypeKey - - the plugin key for the notification type selected
notificationRecipientKey - - the plugin key for the notification recipient type selected
actionParams - - the action params.
Returns:
a new notification rule
Throws:
java.lang.IllegalArgumentException - if either of the keys provided is invalid

getNotificationRules

@NotNull
public <T extends Plan> java.util.Set<NotificationRule> getNotificationRules(@Nullable
                                                                                     T plan)
Description copied from interface: NotificationManager
Extract notification rules for a plan.

Specified by:
getNotificationRules in interface NotificationManager
Parameters:
plan - to get notifications for
Returns:
a set of notification rules belonging to the given plan.

cloneNotificationSet

public NotificationSet cloneNotificationSet(NotificationSet oldSet)
Description copied from interface: NotificationManager
Clone notification set and rules for use when cloning Plan

Specified by:
cloneNotificationSet in interface NotificationManager
Parameters:
oldSet - - the notification set to clone
Returns:
a new notification set containing the same notifications as in the original set.

getNotificationSetsForType

@NotNull
public java.util.List<NotificationSet> getNotificationSetsForType(NotificationSet.NotificationSetType type)

getAllNotificationTypes

public java.util.List<NotificationType> getAllNotificationTypes()
Specified by:
getAllNotificationTypes in interface NotificationManager
Returns:
a list of all enabled NotificationType plugin modules regardless of scope.

getSystemNotificationTypes

public java.util.List<NotificationType> getSystemNotificationTypes()
Specified by:
getSystemNotificationTypes in interface NotificationManager
Returns:
a list of all enabled NotificationType plugin modules which have the "system" scope

getPlanNotificationTypes

public java.util.List<NotificationType> getPlanNotificationTypes()
Specified by:
getPlanNotificationTypes in interface NotificationManager
Returns:
a list of all enabled NotificationType plugin modules which have the "plan" scope

getChainNotificationTypes

public java.util.List<NotificationType> getChainNotificationTypes()
Description copied from interface: NotificationManager
Return notification types marked explicitly as "chain" notification in plugin xml description

Specified by:
getChainNotificationTypes in interface NotificationManager
Returns:
a list of all enabled NotificationType plugin modules which have the "chain" scope

getAllNotificationRecipients

public java.util.List<NotificationRecipient> getAllNotificationRecipients()
Specified by:
getAllNotificationRecipients in interface NotificationManager
Returns:
a list of all enabled NotificationRecipient plugin modules

getNotificationRecipientFromKey

public NotificationRecipient getNotificationRecipientFromKey(java.lang.String notificationRecipientKey)
Specified by:
getNotificationRecipientFromKey in interface NotificationManager
Parameters:
notificationRecipientKey - represntenting the NotificationRecipient required
Returns:
a specific NotificationRecipient plugin module based on the given key.

getNotificationTypeFromKey

@Nullable
public NotificationType getNotificationTypeFromKey(java.lang.String key)
Description copied from interface: NotificationManager
Retrieve a specific NotificationType plugin module based on the given key.

Specified by:
getNotificationTypeFromKey in interface NotificationManager
Parameters:
key - of the notification type
Returns:
a specific NotificationType plugin module based on the given key.

getNotificationRulesForUser

@NotNull
public java.util.List<UsersNotification> getNotificationRulesForUser(@NotNull
                                                                             BambooUser user)
Description copied from interface: NotificationManager
Retrieves all notification rules associated with a given user searches for notification rules: * assigned to the user * assigned to a group the user belongs to * assigned to the user's email or user's im address * assigned to watchers of a build the user has marked as their favourite

Specified by:
getNotificationRulesForUser in interface NotificationManager
Parameters:
user - BambooUser to look up notifications for
Returns:
all notification rules associated with a given user following the above rules

isRecipientUserBase

public boolean isRecipientUserBase(NotificationRule notificationRule)
Description copied from interface: NotificationManager
Determines whether or not a notification rule recipient evaluates to a bamboo user and therefore comply with the users notification preference.

Specified by:
isRecipientUserBase in interface NotificationManager
Parameters:
notificationRule - to check
Returns:
true if the recipient evaluates to a user

createOrGetSystemNotificationSet

@NotNull
public NotificationSet createOrGetSystemNotificationSet()
Description copied from interface: NotificationManager
Get the system notification set for this bamboo and if one doesn't exist create it!

Specified by:
createOrGetSystemNotificationSet in interface NotificationManager
Returns:

saveSystemNotificationRule

public void saveSystemNotificationRule(@NotNull
                                       NotificationRule notificationRule)
Description copied from interface: NotificationManager
Do not use this method. Use SystemNotificationService.saveSystemNotificationRule(); Save an individual system notification rule.

Specified by:
saveSystemNotificationRule in interface NotificationManager
Parameters:
notificationRule - to be added

getNotificationRuleById

@Nullable
public NotificationRule getNotificationRuleById(long notificationId)
Description copied from interface: NotificationManager
Get a specific notification rule

Specified by:
getNotificationRuleById in interface NotificationManager
Parameters:
notificationId - of the notification to get.
Returns:
the notification rule with the given ID, or null if one doesn't eixst

setNotificationDao

public void setNotificationDao(NotificationDao notificationRuleDao)

setPluginAccessor

public void setPluginAccessor(com.atlassian.plugin.PluginAccessor pluginAccessor)

setBambooUserManager

public void setBambooUserManager(BambooUserManager bambooUserManager)

setLabelManager

public void setLabelManager(LabelManager labelManager)


Copyright © 2011 Atlassian. All Rights Reserved.