private ConfigurationRequest getConfigurationRequest ( Map < String , String > userNames ) { ConfigurationRequest configurationRequest = new ConfigurationRequest ( ) ; configurationRequest . addField ( new TextField ( "sender" , "Sender" , "graylog@example.org" , "The sender of sent out mail alerts" , ConfigurationField . Optional . OPTIONAL ) ) ; configurationRequest . addField ( new TextField ( "subject" , "E-Mail Subject" , "Graylog alert for stream: ${stream.title}: ${check_result.resultDescription}" , "The subject of sent out mail alerts" , ConfigurationField . Optional . NOT_OPTIONAL ) ) ; configurationRequest . addField ( new TextField ( "body" , "E-Mail Body" , FormattedEmailAlertSender . bodyTemplate , "The template to generate the body from" , ConfigurationField . Optional . OPTIONAL , TextField . Attribute . TEXTAREA ) ) ; configurationRequest . addField ( new ListField ( CK_USER_RECEIVERS , "User Receivers" , Collections . emptyList ( ) , userNames , "Graylog usernames that should receive this alert" , ConfigurationField . Optional . OPTIONAL ) ) ; configurationRequest . addField ( new ListField ( CK_EMAIL_RECEIVERS , "E-Mail Receivers" , Collections . emptyList ( ) , Collections . emptyMap ( ) , "E-Mail addresses that should receive this alert" , ConfigurationField . Optional . OPTIONAL , ListField . Attribute . ALLOW_CREATE ) ) ; return configurationRequest ; }
I am truly sorry about this but leaking the user list is not okay ...