Package org.graylog.events.notifications
Class NotificationResourceHandler
java.lang.Object
org.graylog.events.notifications.NotificationResourceHandler
-
Constructor Summary
ConstructorDescriptionNotificationResourceHandler
(DBNotificationService notificationService, DBJobDefinitionService jobDefinitionService, DBEventDefinitionService eventDefinitionService, Map<String, EventNotification.Factory> eventNotificationFactories) -
Method Summary
Modifier and TypeMethodDescriptioncreate
(NotificationDto unsavedDto, Optional<User> user) Creates a new notification definition and a corresponding scheduler job definition.boolean
Deletes an existing notification definition and its corresponding scheduler job definition and trigger.void
test
(NotificationDto notificationDto, String userName) Tests a notification definition by executing it with a dummy event.update
(NotificationDto updatedDto) Updates an existing notification definition and its corresponding scheduler job definition.
-
Constructor Details
-
NotificationResourceHandler
@Inject public NotificationResourceHandler(DBNotificationService notificationService, DBJobDefinitionService jobDefinitionService, DBEventDefinitionService eventDefinitionService, Map<String, EventNotification.Factory> eventNotificationFactories)
-
-
Method Details
-
create
Creates a new notification definition and a corresponding scheduler job definition.- Parameters:
unsavedDto
- the notification definition to saveuser
-- Returns:
- the created event definition
-
update
Updates an existing notification definition and its corresponding scheduler job definition.- Parameters:
updatedDto
- the notification definition to update- Returns:
- the updated notification definition
-
delete
Deletes an existing notification definition and its corresponding scheduler job definition and trigger.- Parameters:
dtoId
- the notification definition to delete- Returns:
- true if the notification definition got deleted, false otherwise
-
test
public void test(NotificationDto notificationDto, String userName) throws javax.ws.rs.NotFoundException, javax.ws.rs.InternalServerErrorException Tests a notification definition by executing it with a dummy event.- Parameters:
notificationDto
- the notification definition to testuserName
- the name of the user that triggered the test- Throws:
javax.ws.rs.NotFoundException
- if the notification definition or the notification factory cannot be foundjavax.ws.rs.InternalServerErrorException
- if the notification definition failed to be executed
-