jetbrains.buildServer.notification
Interface UserGroupNotificationRulesManager


public interface UserGroupNotificationRulesManager

Manages group notification rules.

Since:
4.5
Author:
Maxim Podkolzine (maxim.podkolzine@jetbrains.com)
See Also:
NotificationRulesManager

Method Summary
 long addNewRule(java.lang.String groupCode, java.lang.String notifierType, NotificationRule rule)
          Adds a new rule to the rules of the specified group for the specified notifier type.
 void applyOrder(java.lang.String groupCode, java.lang.String notifierType, long[] ruleIds)
          Sorts the notification rules in the specified order
 java.util.Collection<java.lang.Long> findConflictingRules(java.lang.String groupCode, java.lang.String notifierType, WatchedBuilds watch)
          Searches for the conflicting rules with the specified watched builds and the notifier type.
 NotificationRule findRuleById(java.lang.String groupCode, long ruleId)
          Searches for a rule with specified id among rules of the specified group.
 java.util.List<NotificationRule> getDefaultRules()
          Returns the list of default notification rules.
 java.util.List<NotificationRule> getGroupNotificationRules(java.lang.String groupCode, java.lang.String notifierType)
          Returns user group notification rules for the specified notifier.
 void removeRule(java.lang.String groupCode, long ruleId)
          Removes the rule with specified id from the list of rules accosiated with specified group.
 void setGroupNotificationRules(java.lang.String groupCode, java.lang.String notifierType, java.util.List<NotificationRule> rules)
          Sets the group notification rules for the specified notifier.
 

Method Detail

getGroupNotificationRules

@NotNull
java.util.List<NotificationRule> getGroupNotificationRules(@NotNull
                                                                   java.lang.String groupCode,
                                                                   @NotNull
                                                                   java.lang.String notifierType)
                                                           throws UserGroupException
Returns user group notification rules for the specified notifier.

Parameters:
groupCode - the group code
notifierType - type of the notifier
Returns:
list of notification rules
Throws:
UserGroupException - if user group with the given code does not exist

setGroupNotificationRules

void setGroupNotificationRules(@NotNull
                               java.lang.String groupCode,
                               @NotNull
                               java.lang.String notifierType,
                               @NotNull
                               java.util.List<NotificationRule> rules)
                               throws UserGroupException
Sets the group notification rules for the specified notifier.

Parameters:
groupCode - the group code
notifierType - type of the notifier
rules - the rules to set
Throws:
UserGroupException - if user group with the given code does not exist

removeRule

void removeRule(@NotNull
                java.lang.String groupCode,
                long ruleId)
                throws UserGroupException
Removes the rule with specified id from the list of rules accosiated with specified group.

Parameters:
groupCode - the group code
ruleId - id of the rule
Throws:
UserGroupException - if user group with the given code does not exist

applyOrder

void applyOrder(@NotNull
                java.lang.String groupCode,
                @NotNull
                java.lang.String notifierType,
                @NotNull
                long[] ruleIds)
Sorts the notification rules in the specified order

Parameters:
groupCode - the group code
notifierType - type of the notifier
ruleIds - ids of the rules in the required order

addNewRule

long addNewRule(@NotNull
                java.lang.String groupCode,
                @NotNull
                java.lang.String notifierType,
                @NotNull
                NotificationRule rule)
                throws UserGroupException,
                       DuplicateNotificationRuleException
Adds a new rule to the rules of the specified group for the specified notifier type.

Parameters:
groupCode - the group code
notifierType - type of the notifier
rule - rule to add
Returns:
id of a newly created rule
Throws:
UserGroupException - if user group with the given code does not exist
DuplicateNotificationRuleException - if similar rule already exists

findConflictingRules

@Nullable
java.util.Collection<java.lang.Long> findConflictingRules(@NotNull
                                                                   java.lang.String groupCode,
                                                                   @NotNull
                                                                   java.lang.String notifierType,
                                                                   @NotNull
                                                                   WatchedBuilds watch)
                                                          throws UserGroupException
Searches for the conflicting rules with the specified watched builds and the notifier type.

Parameters:
groupCode - the group code
notifierType - type of the notifier
watch - watched builds
Returns:
list of conflicting rules ids
Throws:
UserGroupException - if user group with the given code does not exist

findRuleById

@Nullable
NotificationRule findRuleById(@NotNull
                                       java.lang.String groupCode,
                                       long ruleId)
                              throws UserGroupException
Searches for a rule with specified id among rules of the specified group.

Parameters:
groupCode - the group code
ruleId - id of the rule
Returns:
a found rule, or null
Throws:
UserGroupException - if user group with the given code does not exist

getDefaultRules

@NotNull
java.util.List<NotificationRule> getDefaultRules()
Returns the list of default notification rules.

Returns:
the list of default notification rules