public interface NotificationManager
Modifier and Type | Method and Description |
---|---|
NotificationSet |
cloneNotificationSet(NotificationSet oldSet)
Clone notification set and rules for use when cloning
Plan |
NotificationRule |
createNotificationRule(Class<? extends NotificationType> notificationTypeClass,
String conditionData,
Class<? extends NotificationRecipient> recipientTypeClass,
String recipientString)
|
NotificationRule |
createNotificationRule(String conditionKey,
String conditionData,
String recipientString,
String recipientType)
Create notification rule and provide required managers.
|
NotificationRule |
createNotificationRuleFromAction(String notificationTypeKey,
String notificationRecipientType,
Map<String,String[]> actionParameters)
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!
|
List<NotificationRecipient> |
getAllNotificationRecipients() |
List<NotificationType> |
getAllNotificationTypes() |
List<NotificationType> |
getChainNotificationTypes()
Return notification types marked explicitly as "chain" notification in plugin xml description
|
List<NotificationType> |
getDeploymentNotificationTypes() |
NotificationRecipient |
getNotificationRecipient(NotificationRule rule)
Instantiate and populate notification recipient from a rule.
|
NotificationRecipient |
getNotificationRecipientFromKey(String notificationRecipientKey) |
NotificationRule |
getNotificationRuleById(long notificationId)
Get a specific notification rule
|
Set<NotificationRule> |
getNotificationRules(ImmutablePlan plan)
Extract notification rules for a plan.
|
Set<NotificationRule> |
getNotificationRules(Plan plan)
Deprecated.
since 5.4 use
getNotificationRules(com.atlassian.bamboo.plan.cache.ImmutablePlan) instead |
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 |
getNotificationType(NotificationRule rule)
Instantiate and populate notification type from a rule.
|
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(NotificationSet notificationSet,
long existingNotificationId,
NotificationRule newNotificationRule)
Replaces a notification rule with the new definition.
|
void |
saveNotificationSet(NotificationSet nSet)
Saves a notification set without requiring a build.
|
void |
saveSystemNotificationRule(NotificationRule notificationRule)
Do not use this method.
|
NotificationRule createNotificationRule(String conditionKey, String conditionData, String recipientString, String recipientType)
conditionKey
- - 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 NotificationRule createNotificationRule(@NotNull Class<? extends NotificationType> notificationTypeClass, @Nullable String conditionData, @NotNull Class<? extends NotificationRecipient> recipientTypeClass, @Nullable String recipientString)
notificationTypeClass
- NotificationType
conditionData
- - any data the notification type requiresrecipientTypeClass
- NotificationRecipient
recipientString
- - data the recipient type requires (e.g user or group name)NotificationRule createNotificationRuleFromAction(String notificationTypeKey, String notificationRecipientType, Map<String,String[]> actionParameters) throws IllegalArgumentException
notificationTypeKey
- - the plugin key for the notification type selectednotificationRecipientType
- - the plugin key for the notification recipient type selectedactionParameters
- - the action params.IllegalArgumentException
- if either of the keys provided is invalid@NotNull Set<NotificationRule> getNotificationRules(@Nullable ImmutablePlan plan)
plan
- to get notifications for@Deprecated Set<NotificationRule> getNotificationRules(@Nullable Plan plan)
getNotificationRules(com.atlassian.bamboo.plan.cache.ImmutablePlan)
insteadNotificationSet cloneNotificationSet(NotificationSet oldSet)
Plan
oldSet
- - the notification set to cloneList<NotificationType> getAllNotificationTypes()
NotificationType
plugin modules regardless of scope.List<NotificationType> getSystemNotificationTypes()
NotificationType
plugin modules which have the "system" scopeList<NotificationType> getDeploymentNotificationTypes()
NotificationType
plugin modules which have the "deployment" scopeList<NotificationType> getPlanNotificationTypes()
NotificationType
plugin modules which have the "plan" scopeList<NotificationType> getChainNotificationTypes()
NotificationType
plugin modules which have the "chain" scope@Nullable NotificationType getNotificationTypeFromKey(String key)
NotificationType
plugin module based on the given key.key
- of the notification typeNotificationType
plugin module based on the given key.List<NotificationRecipient> getAllNotificationRecipients()
NotificationRecipient
plugin modulesNotificationRecipient getNotificationRecipientFromKey(String notificationRecipientKey)
notificationRecipientKey
- representing the NotificationRecipient requiredNotificationRecipient
plugin module based on the given key.@Nullable NotificationRecipient getNotificationRecipient(NotificationRule rule)
@Nullable NotificationType getNotificationType(NotificationRule rule)
void saveNotificationSet(NotificationSet nSet)
nSet
- the notification set to save@NotNull List<UsersNotification> getNotificationRulesForUser(@NotNull BambooUser user)
user
- BambooUser to look up notifications forboolean isRecipientUserBase(NotificationRule notificationRule)
notificationRule
- to checkvoid replaceNotificationRule(@NotNull NotificationSet notificationSet, long existingNotificationId, @NotNull NotificationRule newNotificationRule)
NotificationSet
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.notificationSet
- notification set on which the operation should be executedexistingNotificationId
- id of the existing notification rulenewNotificationRule
- new notification rule to replace the existing onevoid saveSystemNotificationRule(@NotNull NotificationRule notificationRule)
notificationRule
- to be added@Nullable NotificationRule getNotificationRuleById(long notificationId)
notificationId
- of the notification to get.@NotNull NotificationSet createOrGetSystemNotificationSet()
Copyright © 2019 Atlassian Software Systems Pty Ltd. All rights reserved.