Class FeatureProviderNotificationRulesHolder
- java.lang.Object
-
- jetbrains.buildServer.notification.FeatureProviderNotificationRulesHolder
-
- All Implemented Interfaces:
NotificationRulesHolder
public class FeatureProviderNotificationRulesHolder extends Object implements NotificationRulesHolder
Allows storing notification rules in [FeatureProvider] Stores each rule in separate build feature
-
-
Field Summary
Fields Modifier and Type Field Description static String
FEATURE_NAME
static String
NOTIFIER
-
Constructor Summary
Constructors Constructor Description FeatureProviderNotificationRulesHolder(FeatureProvider featureProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
addNewRule(String notifierType, NotificationRule rule)
Adds new rule to the rules of specified user for specified notifier type.void
applyOrder(String notifierType, long[] ruleIds)
Sorts the notification rules in the specified order.Collection<Long>
findConflictingRules(String notifierType, WatchedBuilds watch)
Searches for rules which intersect with specified watched builds.NotificationRule
findRuleById(long ruleId)
Searches for a rule with specified id.List<NotificationRulesHolder>
getAllParentRulesHolders()
Returns all (direct and inherited) parent notification rules holdersString
getId()
List<NotificationRule>
getNotificationRules(String notifierType)
Returns the notification rules for specified notifier for this holder (user or group).List<NotificationRulesHolder>
getParentRulesHolders()
Returns direct parent notification rules holdersString
getType()
void
removeRule(long ruleId)
Removes the rule with specified id.void
removeRule(NotificationRule rule)
Removes the rule.void
setNotificationRules(String notifierType, List<NotificationRule> rules)
Sets the notification rules for specified notifier.
-
-
-
Field Detail
-
FEATURE_NAME
public static final String FEATURE_NAME
- See Also:
- Constant Field Values
-
NOTIFIER
public static final String NOTIFIER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FeatureProviderNotificationRulesHolder
public FeatureProviderNotificationRulesHolder(FeatureProvider featureProvider)
-
-
Method Detail
-
getNotificationRules
@NotNull public List<NotificationRule> getNotificationRules(@NotNull String notifierType)
Description copied from interface:NotificationRulesHolder
Returns the notification rules for specified notifier for this holder (user or group).- Specified by:
getNotificationRules
in interfaceNotificationRulesHolder
- Parameters:
notifierType
- type of the notifier- Returns:
- list of notification rules for specified notifier
-
setNotificationRules
public void setNotificationRules(@NotNull String notifierType, @NotNull List<NotificationRule> rules)
Description copied from interface:NotificationRulesHolder
Sets the notification rules for specified notifier.- Specified by:
setNotificationRules
in interfaceNotificationRulesHolder
- Parameters:
notifierType
- type of the notifierrules
- rules to save
-
applyOrder
public void applyOrder(@NotNull String notifierType, @NotNull long[] ruleIds)
Description copied from interface:NotificationRulesHolder
Sorts the notification rules in the specified order.- Specified by:
applyOrder
in interfaceNotificationRulesHolder
- Parameters:
notifierType
- type of the notifierruleIds
- ids of the rules in the required order
-
removeRule
public void removeRule(long ruleId)
Description copied from interface:NotificationRulesHolder
Removes the rule with specified id.- Specified by:
removeRule
in interfaceNotificationRulesHolder
- Parameters:
ruleId
- id of the rule
-
findConflictingRules
@Nullable public Collection<Long> findConflictingRules(@NotNull String notifierType, @NotNull WatchedBuilds watch)
Description copied from interface:NotificationRulesHolder
Searches for rules which intersect with specified watched builds.- Specified by:
findConflictingRules
in interfaceNotificationRulesHolder
- Parameters:
notifierType
- type of the notifierwatch
- watched builds- Returns:
- list of conflicting rules ids
-
removeRule
public void removeRule(@NotNull NotificationRule rule)
Description copied from interface:NotificationRulesHolder
Removes the rule. ThrowsNotificationRuleChangedException
if notification rule with same id was already changed. Does nothing if notification rule doesn't exist.- Specified by:
removeRule
in interfaceNotificationRulesHolder
- Parameters:
rule
- rule to remove
-
getParentRulesHolders
@NotNull public List<NotificationRulesHolder> getParentRulesHolders()
Description copied from interface:NotificationRulesHolder
Returns direct parent notification rules holders- Specified by:
getParentRulesHolders
in interfaceNotificationRulesHolder
- Returns:
- direct parent notification rules holders
-
getAllParentRulesHolders
@NotNull public List<NotificationRulesHolder> getAllParentRulesHolders()
Description copied from interface:NotificationRulesHolder
Returns all (direct and inherited) parent notification rules holders- Specified by:
getAllParentRulesHolders
in interfaceNotificationRulesHolder
- Returns:
- all (direct and inherited) parent notification rules holders
-
addNewRule
public long addNewRule(@NotNull String notifierType, @NotNull NotificationRule rule) throws DuplicateNotificationRuleException
Description copied from interface:NotificationRulesHolder
Adds new rule to the rules of specified user for specified notifier type.- Specified by:
addNewRule
in interfaceNotificationRulesHolder
- Parameters:
notifierType
- type of the notifierrule
- rule to add- Returns:
- the id of the newly created rule
- Throws:
DuplicateNotificationRuleException
- if similar rule already exists
-
findRuleById
@Nullable public NotificationRule findRuleById(long ruleId)
Description copied from interface:NotificationRulesHolder
Searches for a rule with specified id.- Specified by:
findRuleById
in interfaceNotificationRulesHolder
- Parameters:
ruleId
- id of the rule- Returns:
- a found rule, or null
-
getId
@NotNull public String getId()
-
getType
@NotNull public String getType()
-
-