Project

General

Profile

« Previous | Next » 

Revision 59190

added the option to send emails to users

View differences:

EmailUtilsImpl.java
256 256
    }
257 257

  
258 258
    @Override
259
    public void sendAdminRegisterInterfaceEmail(Repository repository, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception {
259
    public void sendAdminRegisterInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception {
260 260
        try {
261 261
            String subject = "OpenAIRE new interface registration request started for " +
262 262
                    repository.getDatasourceType() + "[" + repository.getEnglishName() + "]";
......
267 267
                    "Base URL: " + repositoryInterface.getBaseUrl() + "\n" +
268 268
                    "Set: " + repositoryInterface.getAccessSet() + "\n" +
269 269
                    "Guidelines: " + repositoryInterface.getDesiredCompatibilityLevel() + "\n\n" +
270
                    "to " + repository.getDatasourceType() + "[" + repository.getEnglishName() + "].\n" +
271
                    "A validation process for this interface against the OpenAIRE guidelines compatibility " +
270
                    "to " + repository.getDatasourceType() + "[" + repository.getEnglishName() + "].\n";
271

  
272
            if (comment != null)
273
                comment += "\nThe users comment was '" + comment + "'\n";
274

  
275
            message += "A validation process for this interface against the OpenAIRE guidelines compatibility " +
272 276
                    "has been started. You will be informed in another message once the process is finished." +
273 277
                    "\n\n" +
274 278
                    "User Contact: " + authentication.getName() + " (" + ((OIDCAuthenticationToken) authentication).getUserInfo().getEmail() + ")" +
......
287 291
    }
288 292

  
289 293
    @Override
290
    public void sendUserRegisterInterfaceEmail(Repository repository, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception {
294
    public void sendUserRegisterInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception {
291 295
        try {
292 296
            String subject = "OpenAIRE new interface registration request started for " +
293 297
                    repository.getDatasourceType() + "[" + repository.getEnglishName() + "]";
294

  
295
//            String message = "Dear " + ((OIDCAuthenticationToken) authentication).getUserInfo().getName() + ",\n" +
298
            
296 299
            String message = "Dear "+SecurityContextHolder.getContext().getAuthentication().getName()+",\n" +
297 300
                    "\n" +
298 301
                    "We received a request to add the following interface: \n\n" +
299 302
                    "Base URL: " + repositoryInterface.getBaseUrl() + "\n" +
300 303
                    "Set: " + repositoryInterface.getAccessSet() + "\n" +
301 304
                    "Guidelines: " + repositoryInterface.getDesiredCompatibilityLevel() + "\n\n" +
302
                    "to " + repository.getDatasourceType() + "[" + repository.getEnglishName() + "].\n" +
303
                    "A validation process for this interface against the OpenAIRE guidelines compatibility " +
305
                    "to " + repository.getDatasourceType() + "[" + repository.getEnglishName() + "].\n";
306

  
307
            if (comment != null) {
308
                comment += "\n Your comment was '" + comment + "'\n";
309
            }
310

  
311
            message += "A validation process for this interface against the OpenAIRE guidelines compatibility " +
304 312
                    "has been started. You will be informed in another message once the process is finished." +
305 313
                    "\n\n" +
306 314
                    "Please do not reply to this message\n" +
......
688 696
    }
689 697

  
690 698
    @Override
691
    public void sendAdminUpdateInterfaceEmail(Repository repository, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception {
699
    public void sendAdminUpdateInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception {
692 700
        try {
693 701
            String subject = "OpenAIRE interface update request started for " +
694 702
                    repository.getDatasourceType() + "[" + repository.getEnglishName() + "]";
......
699 707
                    "Base URL: " + repositoryInterface.getBaseUrl() + "\n" +
700 708
                    "Set: " + repositoryInterface.getAccessSet() + "\n" +
701 709
                    "Guidelines: " + repositoryInterface.getDesiredCompatibilityLevel() + "\n\n" +
702
                    "for " + repository.getDatasourceType() + "[" + repository.getEnglishName() + "].\n" +
703
                    "A new iteration process of the validation against the OpenAIRE guidelines compatibility has been started.\n\n" +
710
                    "for " + repository.getDatasourceType() + "[" + repository.getEnglishName() + "].\n";
711

  
712
            if (comment != null)
713
                comment += "\nThe users comment was '" + comment + "'\n";
714

  
715
            message += "A new iteration process of the validation against the OpenAIRE guidelines compatibility has been started.\n\n" +
704 716
                    "User Contact: " + authentication.getName() + " (" + ((OIDCAuthenticationToken) authentication).getUserInfo().getEmail() + ")" +
705 717
                    "\n\n" +
706 718
                    "Please do not reply to this message\n" +
......
717 729
    }
718 730

  
719 731
    @Override
720
    public void sendUserUpdateInterfaceEmail(Repository repository, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception {
732
    public void sendUserUpdateInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception {
721 733
        try {
722 734
            String subject = "OpenAIRE interface update request started for " +
723 735
                    repository.getDatasourceType() + "[" + repository.getEnglishName() + "]";
......
729 741
                    "Base URL: " + repositoryInterface.getBaseUrl() + "\n" +
730 742
                    "Set: " + repositoryInterface.getAccessSet() + "\n" +
731 743
                    "Guidelines: " + repositoryInterface.getDesiredCompatibilityLevel() + "\n\n" +
732
                    "for " + repository.getDatasourceType() + "[" + repository.getEnglishName() + "].\n" +
733
                    "A new iteration process of the validation against the OpenAIRE guidelines compatibility has been started.\n\n" +
744
                    "for " + repository.getDatasourceType() + "[" + repository.getEnglishName() + "].\n";
745

  
746
            if (comment != null) {
747
                comment += "\n Your comment was '" + comment + "'\n";
748
            }
749

  
750
            message += "A new iteration process of the validation against the OpenAIRE guidelines compatibility has been started.\n\n" +
734 751
                    "Please do not reply to this message\n" +
735 752
                    "This message has been generated automatically.\n\n" +
736 753
                    "If you have any questions, write to 'helpdesk@openaire.eu'. \n\n" +

Also available in: Unified diff