com.atlassian.bamboo.notification
Interface NotificationManager

All Known Implementing Classes:
NotificationManagerImpl

public interface NotificationManager

Provide methods to manage notifications.


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 notificationRecipientType, java.util.Map<java.lang.String,java.lang.String[]> actionParameters, boolean allowLegacyConditions)
          Creates a notification rule based on the keys and params passed in from the action
 NotificationSet createOrGetSystemNotificationSet()
          Get the system notification set for this bamboo and if one doesn't exist create it!
 java.util.List<NotificationCondition> getAllConditions()
          Deprecated. 
 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
 NotificationCondition getConditionFromKey(java.lang.String key)
          Deprecated. 
 NotificationRecipient getNotificationRecipientFromKey(java.lang.String notificationRecipientKey)
           
 NotificationRule getNotificationRuleById(long notificationId)
          Get a specific notification rule
 java.util.Set<NotificationRule> getNotificationRules(Plan plan)
          Extract notification rules.
 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
 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.
 

Method Detail

createNotificationRule

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.

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
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)
Creates a new NotificationRule from the NotificationType and NotificationRecipient specificed.

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

NotificationRule createNotificationRuleFromAction(java.lang.String notificationTypeKey,
                                                  java.lang.String notificationRecipientType,
                                                  java.util.Map<java.lang.String,java.lang.String[]> actionParameters,
                                                  boolean allowLegacyConditions)
                                                  throws java.lang.IllegalArgumentException
Creates a notification rule based on the keys and params passed in from the action

Parameters:
notificationTypeKey - - the plugin key for the notification type selected
notificationRecipientType - - the plugin key for the notification recipient type selected
actionParameters - - the action params.
Returns:
a new notification rule
Throws:
java.lang.IllegalArgumentException - if either of the keys provided is invalid

getNotificationRules

@NotNull
java.util.Set<NotificationRule> getNotificationRules(@Nullable
                                                             Plan plan)
Extract notification rules. Currently this just grabs the set from the Plan

Parameters:
plan - to retrieve rules from
Returns:
a set of notification rules belonging to the given plan.

cloneNotificationSet

NotificationSet cloneNotificationSet(NotificationSet oldSet)
Clone notification set and rules for use when cloning Plan

Parameters:
oldSet - - the notification set to clone
Returns:
a new notification set containing the same notifications as in the original set.

getAllConditions

@Deprecated
java.util.List<NotificationCondition> getAllConditions()
Deprecated. 

Returns a list of all enabled NotificationCondition plugin modules. This is deprecated and is only used to keep backward compatability for plugins. Use NotificationType instead.

Returns:
a list of all enabled NotificationCondition plugin modules.

getConditionFromKey

@Deprecated
NotificationCondition getConditionFromKey(java.lang.String key)
Deprecated. 

Retrieve an individual NotificationCondition plugin module based on the given key. This is deprecated and is only used to keep backward compatability for plugins. Use NotificationType instead.

Parameters:
key - - full plugin key for the module to be retrieved
Returns:
an individual NotificationCondition plugin module based on the given key.

getAllNotificationTypes

java.util.List<NotificationType> getAllNotificationTypes()
Returns:
a list of all enabled NotificationType plugin modules regardless of scope.

getSystemNotificationTypes

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

getPlanNotificationTypes

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

getChainNotificationTypes

java.util.List<NotificationType> getChainNotificationTypes()
Return notification types marked explicitly as "chain" notification in plugin xml description

Returns:
a list of all enabled NotificationType plugin modules which have the "chain" scope

getNotificationTypeFromKey

NotificationType getNotificationTypeFromKey(java.lang.String key)
Retrieve a specific NotificationType plugin module based on the given key.

Parameters:
key - of the notification type
Returns:
a specific NotificationType plugin module based on the given key.

getAllNotificationRecipients

java.util.List<NotificationRecipient> getAllNotificationRecipients()
Returns:
a list of all enabled NotificationRecipient plugin modules

getNotificationRecipientFromKey

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

saveNotificationSet

void saveNotificationSet(NotificationSet nSet)
Saves a notification set without requiring a build.

Parameters:
nSet - the notification set to save

getNotificationRulesForUser

@NotNull
java.util.List<UsersNotification> getNotificationRulesForUser(@NotNull
                                                                      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

Parameters:
user - BambooUser to look up notifications for
Returns:
all notification rules associated with a given user following the above rules

isRecipientUserBase

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.

Parameters:
notificationRule - to check
Returns:
true if the recipient evaluates to a user

saveSystemNotificationRule

void saveSystemNotificationRule(@NotNull
                                NotificationRule notificationRule)
Do not use this method. Use SystemNotificationService.saveSystemNotificationRule(); Save an individual system notification rule.

Parameters:
notificationRule - to be added

getNotificationRuleById

@Nullable
NotificationRule getNotificationRuleById(long notificationId)
Get a specific notification rule

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

createOrGetSystemNotificationSet

@NotNull
NotificationSet createOrGetSystemNotificationSet()
Get the system notification set for this bamboo and if one doesn't exist create it!

Returns:


Copyright © 2010 Atlassian. All Rights Reserved.