public class NotificationManagerImpl extends Object implements NotificationManager
| Modifier and Type | Field and Description |
|---|---|
static String |
COMMITTER_RECIPIENT |
static String |
FAILED_CHAIN_NOTIFICATION |
static String |
USER_RECIPIENT |
static String |
WATCHER_RECIPIENT |
static String |
WEBHOOK_RECIPIENT |
| Constructor and Description |
|---|
NotificationManagerImpl() |
| Modifier and Type | Method and Description |
|---|---|
NotificationSet |
cloneNotificationSet(NotificationSet oldSet)
Clone notification set and rules for use when cloning
Plan |
@NotNull NotificationRule |
createNotificationRule(@NotNull Class<? extends NotificationType> notificationTypeClass,
@Nullable String conditionData,
@NotNull Class<? extends NotificationRecipient> recipientTypeClass,
@Nullable String recipientString)
|
NotificationRule |
createNotificationRule(String conditionKey,
String conditionData,
String recipientString,
String recipientType)
Create notification rule and provide required managers.
|
@NotNull NotificationRule |
createNotificationRuleFromAction(String notificationTypeKey,
String notificationRecipientKey,
Map<String,String[]> actionParams)
Creates a notification rule based on the keys and params passed in from the action
|
@NotNull NotificationSet |
createOrGetSystemNotificationSet()
Get the system notification set for this bamboo and if one doesn't exist create it!
|
List<NotificationRecipient> |
getAllNotificationRecipients() |
List<NotificationType> |
getAllNotificationTypes() |
List<NotificationType> |
getChainNotificationTypes()
Return notification types marked explicitly as "chain" notification in plugin xml description
|
List<NotificationType> |
getDeploymentNotificationTypes() |
@Nullable NotificationRecipient |
getNotificationRecipient(NotificationRule rule)
Instantiate and populate notification recipient from a rule.
|
NotificationRecipient |
getNotificationRecipientFromKey(String notificationRecipientKey) |
@Nullable NotificationRule |
getNotificationRuleById(long notificationId)
Get a specific notification rule
|
@NotNull Set<NotificationRule> |
getNotificationRules(@Nullable ImmutablePlan plan)
Extract notification rules for a plan.
|
Set<NotificationRule> |
getNotificationRules(@Nullable Plan plan) |
@NotNull 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
|
@Nullable NotificationSet |
getNotificationSetById(long notificationSetId)
Get a specific notification set
|
@NotNull List<NotificationSet> |
getNotificationSetsForType(NotificationSet.NotificationSetType type) |
@Nullable NotificationType |
getNotificationType(NotificationRule rule)
Instantiate and populate notification type from a rule.
|
@Nullable NotificationType |
getNotificationTypeFromKey(String key)
Retrieve a specific
NotificationType plugin module based on the given key. |
List<NotificationType> |
getPlanNotificationTypes() |
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 |
replaceNotificationRule(@NotNull NotificationSet notificationSet,
long existingNotificationId,
@NotNull NotificationRule newNotificationRule)
Replaces a notification rule with the new definition.
|
void |
saveNotificationSet(NotificationSet notificationSet)
Saves a notification set without requiring a build.
|
void |
saveSystemNotificationRule(@NotNull NotificationRule notificationRule)
Do not use this method.
|
void |
setNotificationDao(NotificationDao notificationRuleDao) |
void |
setPluginAccessor(com.atlassian.plugin.PluginAccessor pluginAccessor) |
public static final String USER_RECIPIENT
public static final String COMMITTER_RECIPIENT
public static final String WATCHER_RECIPIENT
public static final String WEBHOOK_RECIPIENT
public static final String FAILED_CHAIN_NOTIFICATION
public void saveNotificationSet(NotificationSet notificationSet)
NotificationManagersaveNotificationSet in interface NotificationManagernotificationSet - the notification set to savepublic NotificationRule createNotificationRule(String conditionKey, String conditionData, String recipientString, String recipientType)
NotificationManagercreateNotificationRule in interface NotificationManagerconditionKey - - key representation of the notification typeconditionData - - any data the notification type requiresrecipientString - - data the recipient type requires (e.g user or group name)recipientType - - key representing the type of recipient@NotNull public @NotNull NotificationRule createNotificationRule(@NotNull @NotNull Class<? extends NotificationType> notificationTypeClass, @Nullable @Nullable String conditionData, @NotNull @NotNull Class<? extends NotificationRecipient> recipientTypeClass, @Nullable @Nullable String recipientString)
NotificationManagercreateNotificationRule in interface NotificationManagernotificationTypeClass - NotificationTypeconditionData - - any data the notification type requiresrecipientTypeClass - NotificationRecipientrecipientString - - data the recipient type requires (e.g user or group name)@NotNull public @NotNull NotificationRule createNotificationRuleFromAction(String notificationTypeKey, String notificationRecipientKey, Map<String,String[]> actionParams) throws IllegalArgumentException
NotificationManagercreateNotificationRuleFromAction in interface NotificationManagernotificationTypeKey - - the plugin key for the notification type selectednotificationRecipientKey - - the plugin key for the notification recipient type selectedactionParams - - the action params.IllegalArgumentException - if either of the keys provided is invalidpublic Set<NotificationRule> getNotificationRules(@Nullable @Nullable Plan plan)
getNotificationRules in interface NotificationManager@NotNull public @NotNull Set<NotificationRule> getNotificationRules(@Nullable @Nullable ImmutablePlan plan)
NotificationManagergetNotificationRules in interface NotificationManagerplan - to get notifications forpublic NotificationSet cloneNotificationSet(NotificationSet oldSet)
NotificationManagerPlancloneNotificationSet in interface NotificationManageroldSet - - the notification set to clone@NotNull public @NotNull List<NotificationSet> getNotificationSetsForType(NotificationSet.NotificationSetType type)
public List<NotificationType> getAllNotificationTypes()
getAllNotificationTypes in interface NotificationManagerNotificationType plugin modules regardless of scope.public List<NotificationType> getSystemNotificationTypes()
getSystemNotificationTypes in interface NotificationManagerNotificationType plugin modules which have the "system" scopepublic List<NotificationType> getDeploymentNotificationTypes()
getDeploymentNotificationTypes in interface NotificationManagerNotificationType plugin modules which have the "deployment" scopepublic List<NotificationType> getPlanNotificationTypes()
getPlanNotificationTypes in interface NotificationManagerNotificationType plugin modules which have the "plan" scopepublic List<NotificationType> getChainNotificationTypes()
NotificationManagergetChainNotificationTypes in interface NotificationManagerNotificationType plugin modules which have the "chain" scopepublic List<NotificationRecipient> getAllNotificationRecipients()
getAllNotificationRecipients in interface NotificationManagerNotificationRecipient plugin modulespublic NotificationRecipient getNotificationRecipientFromKey(String notificationRecipientKey)
getNotificationRecipientFromKey in interface NotificationManagernotificationRecipientKey - representing the NotificationRecipient requiredNotificationRecipient plugin module based on the given key.@Nullable public @Nullable NotificationRecipient getNotificationRecipient(NotificationRule rule)
NotificationManagergetNotificationRecipient in interface NotificationManager@Nullable public @Nullable NotificationType getNotificationType(NotificationRule rule)
NotificationManagergetNotificationType in interface NotificationManager@Nullable public @Nullable NotificationType getNotificationTypeFromKey(String key)
NotificationManagerNotificationType plugin module based on the given key.getNotificationTypeFromKey in interface NotificationManagerkey - of the notification typeNotificationType plugin module based on the given key.@NotNull public @NotNull List<UsersNotification> getNotificationRulesForUser(@NotNull @NotNull BambooUser user)
NotificationManagergetNotificationRulesForUser in interface NotificationManageruser - BambooUser to look up notifications forpublic boolean isRecipientUserBase(NotificationRule notificationRule)
NotificationManagerisRecipientUserBase in interface NotificationManagernotificationRule - to checkpublic void replaceNotificationRule(@NotNull
@NotNull NotificationSet notificationSet,
long existingNotificationId,
@NotNull
@NotNull NotificationRule newNotificationRule)
NotificationManagerNotificationSet manually.
Reason: as of current Hibernate, queries which modify collections (such as NotificationSet) are batched
and executed in a specific order. In particular, inserts are executed before deletes. Due to constraints on the
NotificationRule class/table this may lead to database constraint violations, resulting in unsuccessful
updates and exceptions.replaceNotificationRule in interface NotificationManagernotificationSet - notification set on which the operation should be executedexistingNotificationId - id of the existing notification rulenewNotificationRule - new notification rule to replace the existing one@NotNull public @NotNull NotificationSet createOrGetSystemNotificationSet()
NotificationManagercreateOrGetSystemNotificationSet in interface NotificationManagerpublic void saveSystemNotificationRule(@NotNull
@NotNull NotificationRule notificationRule)
NotificationManagersaveSystemNotificationRule in interface NotificationManagernotificationRule - to be added@Nullable public @Nullable NotificationRule getNotificationRuleById(long notificationId)
NotificationManagergetNotificationRuleById in interface NotificationManagernotificationId - of the notification to get.@Nullable public @Nullable NotificationSet getNotificationSetById(long notificationSetId)
NotificationManagergetNotificationSetById in interface NotificationManagernotificationSetId - of the notification set to get.public void setNotificationDao(NotificationDao notificationRuleDao)
public void setPluginAccessor(com.atlassian.plugin.PluginAccessor pluginAccessor)
Copyright © 2022 Atlassian Software Systems Pty Ltd. All rights reserved.