Class UserNotificationRulesManager
- java.lang.Object
-
- jetbrains.buildServer.notification.impl.AbstractNotificationRulesManager<Long,SUser>
-
- jetbrains.buildServer.notification.impl.UserNotificationRulesManager
-
- All Implemented Interfaces:
EventListener
,NotificationRulesListener<Long>
public class UserNotificationRulesManager extends AbstractNotificationRulesManager<Long,SUser>
- Author:
- Maxim Podkolzine (maxim.podkolzine@jetbrains.com)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jetbrains.buildServer.notification.impl.AbstractNotificationRulesManager
AbstractNotificationRulesManager.DBWatchType
-
-
Field Summary
-
Fields inherited from class jetbrains.buildServer.notification.impl.AbstractNotificationRulesManager
DELETE_ALL_NOTIFICATION_EVENTS_QUERY, DELETE_ALL_WATCHED_BUILDS_QUERY, DELETE_NOTIFICATION_DATA_QUERY, myIdSequences, myProjectManager, myRulesFactory, mySecurityContext, mySQLRunner
-
-
Constructor Summary
Constructors Constructor Description UserNotificationRulesManager(ProjectManager projectManager, SecurityContextEx securityContext, NotificationRuleFactory rulesFactory, SQLRunnerEx sqlRunner, NumericIdSequences idSequences, UserModelEx userModel, NotificationRuleIdProvider ruleIdProvider, EventDispatcher<ProjectsImportListener> projectImportListenerEventDispatcher, ServerResponsibility serverResponsibility, MultiNodesEvents multiNodesEvents)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkHolderExists(Long holderId)
Same as previous, but throws an exception if holder does not exist.protected NotificationRuleInit
createRuleForProjectsAndBuildTypes(Long holderId, Collection<SProject> projects, Collection<SBuildType> buildTypes, Collection<NotificationRule.Event> events, Map<String,String> additionalData)
protected SUser
findHolder(Long holderId)
Possible implementations:protected long
getNextRuleId()
protected String
instantiateTemplate(String sql)
Implement this method with your specifications of the DB column name and table prefix.protected void
notifyHolderChanged(Long holderId)
Notify other nodes that notification rules holder with given Id was changedprotected Long
retrieveHolderId(ResultSet rs, int columnIndex)
Possible implementations:-
Methods inherited from class jetbrains.buildServer.notification.impl.AbstractNotificationRulesManager
addListener, addNewRule, applyOrder, buildTypeCopied, buildTypesCopied, clearCaches, findConflictingRules, findRuleById, findRulesByNotificatorType, findRulesByNotificatorType, findRulesByNotificatorType, getListeners, getNotificationRules, instantiateTemplate, isRulesWithEventsConfigured, notificationRulesChanged, removeRule, removeRule, setNotificationRules, updateNotificationRule
-
-
-
-
Constructor Detail
-
UserNotificationRulesManager
public UserNotificationRulesManager(@NotNull ProjectManager projectManager, @NotNull SecurityContextEx securityContext, @NotNull NotificationRuleFactory rulesFactory, @NotNull SQLRunnerEx sqlRunner, @NotNull NumericIdSequences idSequences, @NotNull UserModelEx userModel, @NotNull NotificationRuleIdProvider ruleIdProvider, @NotNull EventDispatcher<ProjectsImportListener> projectImportListenerEventDispatcher, @NotNull ServerResponsibility serverResponsibility, @NotNull MultiNodesEvents multiNodesEvents)
-
-
Method Detail
-
notifyHolderChanged
protected void notifyHolderChanged(@Nullable Long holderId)
Description copied from class:AbstractNotificationRulesManager
Notify other nodes that notification rules holder with given Id was changed- Specified by:
notifyHolderChanged
in classAbstractNotificationRulesManager<Long,SUser>
- Parameters:
holderId
- id of notification rules holder
-
retrieveHolderId
@NotNull protected Long retrieveHolderId(ResultSet rs, int columnIndex) throws SQLException
Description copied from class:AbstractNotificationRulesManager
Possible implementations:return rs.getLong(columnIndex);
orreturn rs.getString(columnIndex);
- Specified by:
retrieveHolderId
in classAbstractNotificationRulesManager<Long,SUser>
- Parameters:
rs
- result setcolumnIndex
- the column- Returns:
- the id
- Throws:
SQLException
- if database error occured
-
createRuleForProjectsAndBuildTypes
@Nullable protected NotificationRuleInit createRuleForProjectsAndBuildTypes(@NotNull Long holderId, @NotNull Collection<SProject> projects, @NotNull Collection<SBuildType> buildTypes, @NotNull Collection<NotificationRule.Event> events, @NotNull Map<String,String> additionalData)
- Specified by:
createRuleForProjectsAndBuildTypes
in classAbstractNotificationRulesManager<Long,SUser>
-
findHolder
protected SUser findHolder(@NotNull Long holderId)
Description copied from class:AbstractNotificationRulesManager
Possible implementations:return myUserModel.findUserById(holderId);
orreturn myUserGroupsManager.findUserGroupByCode(holderId);
- Specified by:
findHolder
in classAbstractNotificationRulesManager<Long,SUser>
- Parameters:
holderId
- holder id- Returns:
- the holder, or null
-
checkHolderExists
protected void checkHolderExists(@NotNull Long holderId) throws RuntimeException
Description copied from class:AbstractNotificationRulesManager
Same as previous, but throws an exception if holder does not exist.- Specified by:
checkHolderExists
in classAbstractNotificationRulesManager<Long,SUser>
- Parameters:
holderId
- holder id- Throws:
RuntimeException
- exception to throw
-
instantiateTemplate
@NotNull protected String instantiateTemplate(String sql)
Description copied from class:AbstractNotificationRulesManager
Implement this method with your specifications of the DB column name and table prefix. UseAbstractNotificationRulesManager.instantiateTemplate(String, String, String)
method below.- Specified by:
instantiateTemplate
in classAbstractNotificationRulesManager<Long,SUser>
- Parameters:
sql
- the sql template- Returns:
- sql query
-
getNextRuleId
protected long getNextRuleId()
- Specified by:
getNextRuleId
in classAbstractNotificationRulesManager<Long,SUser>
-
-