Revision 61441
Added by Antonis Lempesis almost 3 years ago
EmailUtilsImpl.java | ||
---|---|---|
33 | 33 |
private boolean override = false, logonly = false; |
34 | 34 |
private String overrideEmail = null, from = null; |
35 | 35 |
|
36 |
@Autowired |
|
37 |
private MailLibrary mailLibrary; |
|
36 |
private final MailLibrary mailLibrary; |
|
37 |
private final CascadingPropertyLoader pLoader; |
|
38 |
private final RepositoryService repositoryService; |
|
38 | 39 |
|
39 |
@Autowired |
|
40 |
private CascadingPropertyLoader pLoader; |
|
41 |
|
|
42 | 40 |
@Value("${services.repo-manager.baseUrl}") |
43 | 41 |
private String baseUrl; |
44 | 42 |
|
... | ... | |
55 | 53 |
private String valBaseUrl; |
56 | 54 |
|
57 | 55 |
@Autowired |
58 |
private RepositoryService repositoryService; |
|
56 |
EmailUtilsImpl(MailLibrary mailLibrary, CascadingPropertyLoader pLoader, |
|
57 |
RepositoryService repositoryService) { |
|
58 |
this.mailLibrary = mailLibrary; |
|
59 |
this.pLoader = pLoader; |
|
60 |
this.repositoryService = repositoryService; |
|
61 |
} |
|
59 | 62 |
|
60 | 63 |
|
61 | 64 |
@PostConstruct |
... | ... | |
207 | 210 |
public void sendAdminRegistrationEmail(Repository repository, Authentication authentication) throws Exception { |
208 | 211 |
try { |
209 | 212 |
String subject = "OpenAIRE content provider registration for " + |
210 |
repository.getDatasourceType() + "[" + repository.getEnglishName() + "]";
|
|
213 |
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
|
211 | 214 |
|
212 | 215 |
String message = "Dear administrator" + ",\n" + |
213 | 216 |
"\n" + |
214 |
"We received a request to register the " + repository.getDatasourceType() + "[" + repository.getEnglishName() + "]" +
|
|
217 |
"We received a request to register the " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "]" +
|
|
215 | 218 |
" to the OpenAIRE compliant list of content providers. " + |
216 | 219 |
"\n\n" + |
217 | 220 |
"User Contact: " + authentication.getName() + " (" + ((OIDCAuthenticationToken) authentication).getUserInfo().getEmail() + ")" + |
... | ... | |
233 | 236 |
public void sendUserRegistrationEmail(Repository repository, Authentication authentication) throws Exception { |
234 | 237 |
try { |
235 | 238 |
String subject = "OpenAIRE content provider registration for " + |
236 |
repository.getDatasourceType() + "[" + repository.getEnglishName() + "]";
|
|
239 |
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
|
237 | 240 |
|
238 | 241 |
// String message = "Dear " + ((OIDCAuthenticationToken) authentication).getUserInfo().getName() + ",\n" + |
239 | 242 |
String message = "Dear "+SecurityContextHolder.getContext().getAuthentication().getName()+",\n" + |
240 | 243 |
"\n" + |
241 |
"We received a request to register the " + repository.getDatasourceType() + "[" + repository.getEnglishName() + "]" +
|
|
244 |
"We received a request to register the " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "]" +
|
|
242 | 245 |
" to the OpenAIRE compliant list of content providers. " + |
243 | 246 |
"\n\n" + |
244 | 247 |
"Please do not reply to this message\n" + |
... | ... | |
259 | 262 |
public void sendAdminRegisterInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception { |
260 | 263 |
try { |
261 | 264 |
String subject = "OpenAIRE new interface registration request started for " + |
262 |
repository.getDatasourceType() + "[" + repository.getEnglishName() + "]";
|
|
265 |
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
|
263 | 266 |
|
264 | 267 |
String message = "Dear administrator" + ",\n" + |
265 | 268 |
"\n" + |
... | ... | |
267 | 270 |
"Base URL: " + repositoryInterface.getBaseUrl() + "\n" + |
268 | 271 |
"Set: " + repositoryInterface.getAccessSet() + "\n" + |
269 | 272 |
"Guidelines: " + repositoryInterface.getDesiredCompatibilityLevel() + "\n\n" + |
270 |
"to " + repository.getDatasourceType() + "[" + repository.getEnglishName() + "].\n";
|
|
273 |
"to " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "].\n";
|
|
271 | 274 |
|
272 | 275 |
if (comment != null) |
273 | 276 |
message += "\nThe users comment was '" + comment + "'\n"; |
... | ... | |
294 | 297 |
public void sendUserRegisterInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception { |
295 | 298 |
try { |
296 | 299 |
String subject = "OpenAIRE new interface registration request started for " + |
297 |
repository.getDatasourceType() + "[" + repository.getEnglishName() + "]";
|
|
300 |
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
|
298 | 301 |
|
299 | 302 |
String message = "Dear "+SecurityContextHolder.getContext().getAuthentication().getName()+",\n" + |
300 | 303 |
"\n" + |
... | ... | |
302 | 305 |
"Base URL: " + repositoryInterface.getBaseUrl() + "\n" + |
303 | 306 |
"Set: " + repositoryInterface.getAccessSet() + "\n" + |
304 | 307 |
"Guidelines: " + repositoryInterface.getDesiredCompatibilityLevel() + "\n\n" + |
305 |
"to " + repository.getDatasourceType() + "[" + repository.getEnglishName() + "].\n";
|
|
308 |
"to " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "].\n";
|
|
306 | 309 |
|
307 | 310 |
if (comment != null) { |
308 | 311 |
message += "\n Your comment was '" + comment + "'\n"; |
... | ... | |
328 | 331 |
public void sendUserRegistrationResultsSuccessEmail(String issuerEmail, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception { |
329 | 332 |
try { |
330 | 333 |
String subject = "OpenAIRE new interface registration request - results (success) for " + |
331 |
repository.getDatasourceType() + "[" + repository.getEnglishName() + "]";
|
|
334 |
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
|
332 | 335 |
|
333 | 336 |
// String message = "Dear " + ((OIDCAuthenticationToken) authentication).getUserInfo().getName() + ",\n" + |
334 | 337 |
String message = "Dear user,\n" + |
335 | 338 |
"\n" + |
336 |
"the compatibility test on " + "[" + repository.getEnglishName() + "]" +
|
|
339 |
"the compatibility test on " + "[" + repository.getOfficialName() + "]" +
|
|
337 | 340 |
" was successful and the datasource type \""+ repository.getDatasourceType() + "\" will be prepared for aggregation in OpenAIRE."+ |
338 | 341 |
"\n\n" + |
339 | 342 |
"Please note that it usually takes about 3-4 weeks until a data source is indexed and it’s metadata visible on openaire.eu.\n\n" + |
... | ... | |
361 | 364 |
public void sendAdminRegistrationResultsSuccessEmail(String issuerEmail, String jobId,RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception { |
362 | 365 |
try { |
363 | 366 |
String subject = "OpenAIRE new interface registration request - results (success) for " + |
364 |
repository.getDatasourceType() + "[" + repository.getEnglishName() + "]";
|
|
367 |
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
|
365 | 368 |
|
366 | 369 |
String message = "Dear admin ,\n" + |
367 | 370 |
"\n" + |
368 |
"the compatibility test on " + "[" + repository.getEnglishName() + "]" +
|
|
371 |
"the compatibility test on " + "[" + repository.getOfficialName() + "]" +
|
|
369 | 372 |
" was successful and the datasource type \""+ repository.getDatasourceType() + "\" will be prepared for aggregation in OpenAIRE."+ |
370 | 373 |
"\n\n" + |
371 | 374 |
"Please note that it usually takes about 3-4 weeks until a data source is indexed and it’s metadata visible on openaire.eu.\n\n" + |
... | ... | |
394 | 397 |
public void sendUserRegistrationResultsFailureEmail(String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception { |
395 | 398 |
try { |
396 | 399 |
String subject = "OpenAIRE new interface registration request - results (failure) for " + |
397 |
repository.getDatasourceType() + "[" + repository.getEnglishName() + "]";
|
|
400 |
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
|
398 | 401 |
// String message = "Dear " + ((OIDCAuthenticationToken) authentication).getUserInfo().getName() + ",\n" + |
399 | 402 |
String message = "Dear user,\n" + |
400 | 403 |
"\n" + |
401 |
"the compatibility test on " + "[" + repository.getEnglishName() + "]" +
|
|
404 |
"the compatibility test on " + "[" + repository.getOfficialName() + "]" +
|
|
402 | 405 |
" was not successful and the registration process was interrupted."+ |
403 | 406 |
"\n\n" + |
404 | 407 |
"We will check what caused the problem and get back to you within a couple of days.\n\n" + |
... | ... | |
426 | 429 |
public void sendAdminRegistrationResultsFailureEmail(String issuerEmail, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception { |
427 | 430 |
try { |
428 | 431 |
String subject = "OpenAIRE new interface registration request - results (failure) for " + |
429 |
repository.getDatasourceType() + "[" + repository.getEnglishName() + "]";
|
|
432 |
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
|
430 | 433 |
|
431 | 434 |
String message = "Dear admin,\n" + |
432 | 435 |
"\n" + |
433 |
"the compatibility test on " + "[" + repository.getEnglishName() + "]" +
|
|
436 |
"the compatibility test on " + "[" + repository.getOfficialName() + "]" +
|
|
434 | 437 |
" was not successful and the registration process was interrupted."+ |
435 | 438 |
"\n\n" + |
436 | 439 |
"We will check what caused the problem and get back to you within a couple of days.\n\n" + |
... | ... | |
459 | 462 |
public void sendUserUpdateResultsSuccessEmail(String issuer, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception { |
460 | 463 |
try { |
461 | 464 |
String subject = "OpenAIRE interface update request - results (success) for " + |
462 |
repository.getDatasourceType() + "[" + repository.getEnglishName() + "]";
|
|
465 |
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
|
463 | 466 |
|
464 | 467 |
// String message = "Dear " + ((OIDCAuthenticationToken) authentication).getUserInfo().getName() + ",\n" + |
465 | 468 |
String message = "Dear user,\n" + |
466 | 469 |
"\n" + |
467 |
"the compatibility test on [" + repository.getEnglishName()+"] has been successful\n\n" +
|
|
470 |
"the compatibility test on [" + repository.getOfficialName()+"] has been successful\n\n" +
|
|
468 | 471 |
"We will check your transmitted information and adjust the aggregation settings accordingly. Please note that it usually takes about 3-4 weeks until the changes are visible on openaire.eu."+"\n\n" + |
469 | 472 |
"Registration identifier in OpenAIRE: "+ repository.getNamespacePrefix()+ |
470 | 473 |
"\nOfficial Name:" + repository.getOfficialName() + |
... | ... | |
490 | 493 |
public void sendAdminUpdateResultsSuccessEmail(String issuerEmail, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception { |
491 | 494 |
try { |
492 | 495 |
String subject = "OpenAIRE interface update request - results (success) for " + |
493 |
repository.getDatasourceType() + "[" + repository.getEnglishName() + "]";
|
|
496 |
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
|
494 | 497 |
|
495 | 498 |
String message = "Dear admin,\n" + |
496 | 499 |
"\n" + |
497 |
"the compatibility test on [" + repository.getEnglishName()+"] has been successful\n\n" +
|
|
500 |
"the compatibility test on [" + repository.getOfficialName()+"] has been successful\n\n" +
|
|
498 | 501 |
"We will check your transmitted information and adjust the aggregation settings accordingly. Please note that it usually takes about 3-4 weeks until the changes are visible on openaire.eu."+"\n\n" + |
499 | 502 |
"Registration identifier in OpenAIRE: "+ repository.getNamespacePrefix()+ |
500 | 503 |
"\nOfficial Name:" + repository.getOfficialName() + |
... | ... | |
521 | 524 |
public void sendUserUpdateResultsFailureEmail(String issuer, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception { |
522 | 525 |
try { |
523 | 526 |
String subject = "OpenAIRE interface update request - results (failure) for " + |
524 |
repository.getDatasourceType() + "[" + repository.getEnglishName() + "]";
|
|
527 |
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
|
525 | 528 |
|
526 | 529 |
// String message = "Dear " + ((OIDCAuthenticationToken) authentication).getUserInfo().getName() + ",\n" + |
527 | 530 |
String message = "Dear user,\n" + |
528 | 531 |
"\n" + |
529 |
"the compatibility test on " + "[" + repository.getEnglishName() + "]" +
|
|
532 |
"the compatibility test on " + "[" + repository.getOfficialName() + "]" +
|
|
530 | 533 |
" was not successful."+ |
531 | 534 |
"\n\n" + |
532 | 535 |
"WWe will check your transmitted information to see what caused the problem and get back to you within a couple of days.\n\n" + |
... | ... | |
554 | 557 |
public void sendAdminUpdateResultsFailureEmail(String issuerEmail, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception { |
555 | 558 |
try { |
556 | 559 |
String subject = "OpenAIRE interface update request - results (failure) for " + |
557 |
repository.getDatasourceType() + "[" + repository.getEnglishName() + "]";
|
|
560 |
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
|
558 | 561 |
|
559 | 562 |
String message = "Dear admin,\n" + |
560 | 563 |
"\n" + |
561 |
"the compatibility test on " + "[" + repository.getEnglishName() + "]" +
|
|
564 |
"the compatibility test on " + "[" + repository.getOfficialName() + "]" +
|
|
562 | 565 |
" was not successful."+ |
563 | 566 |
"\n\n" + |
564 | 567 |
"WWe will check your transmitted information to see what caused the problem and get back to you within a couple of days.\n\n" + |
... | ... | |
653 | 656 |
public void sendAdminUpdateRepositoryInfoEmail(Repository repository, Authentication authentication) throws Exception { |
654 | 657 |
try { |
655 | 658 |
String subject = "OpenAIRE content provider update information for " + |
656 |
repository.getDatasourceType() + "[" + repository.getEnglishName() + "]";
|
|
659 |
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
|
657 | 660 |
|
658 | 661 |
String message = "Dear administrator" + ",\n" + |
659 | 662 |
"\n" + |
660 |
"We received a request to update the basic information for " + repository.getDatasourceType() + "[" + repository.getEnglishName() + "].\n\n" +
|
|
663 |
"We received a request to update the basic information for " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "].\n\n" +
|
|
661 | 664 |
"Please do not reply to this message\n" + |
662 | 665 |
"This message has been generated automatically.\n\n" + |
663 | 666 |
"Regards,\n" + |
... | ... | |
675 | 678 |
public void sendUserUpdateRepositoryInfoEmail(Repository repository, Authentication authentication) throws Exception { |
676 | 679 |
try { |
677 | 680 |
String subject = "OpenAIRE content provider update information for " + |
678 |
repository.getDatasourceType() + "[" + repository.getEnglishName() + "]";
|
|
681 |
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
|
679 | 682 |
|
680 | 683 |
// String message = "Dear " + ((OIDCAuthenticationToken) authentication).getUserInfo().getName() + ",\n" + |
681 | 684 |
String message = "Dear user,\n" + |
682 | 685 |
"\n" + |
683 |
"We received a request to update the basic information for " + repository.getDatasourceType() + "[" + repository.getEnglishName() + "].\n\n" +
|
|
686 |
"We received a request to update the basic information for " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "].\n\n" +
|
|
684 | 687 |
"Please do not reply to this message\n" + |
685 | 688 |
"This message has been generated automatically.\n\n" + |
686 | 689 |
"If you have any questions, write to 'helpdesk@openaire.eu'. \n\n" + |
... | ... | |
699 | 702 |
public void sendAdminUpdateInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception { |
700 | 703 |
try { |
701 | 704 |
String subject = "OpenAIRE interface update request started for " + |
702 |
repository.getDatasourceType() + "[" + repository.getEnglishName() + "]";
|
|
705 |
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
|
703 | 706 |
|
704 | 707 |
String message = "Dear administrator" + ",\n" + |
705 | 708 |
"\n" + |
... | ... | |
707 | 710 |
"Base URL: " + repositoryInterface.getBaseUrl() + "\n" + |
708 | 711 |
"Set: " + repositoryInterface.getAccessSet() + "\n" + |
709 | 712 |
"Guidelines: " + repositoryInterface.getDesiredCompatibilityLevel() + "\n\n" + |
710 |
"for " + repository.getDatasourceType() + "[" + repository.getEnglishName() + "].\n";
|
|
713 |
"for " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "].\n";
|
|
711 | 714 |
|
712 | 715 |
if (comment != null) |
713 | 716 |
message += "\nThe users comment was '" + comment + "'\n"; |
... | ... | |
732 | 735 |
public void sendUserUpdateInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception { |
733 | 736 |
try { |
734 | 737 |
String subject = "OpenAIRE interface update request started for " + |
735 |
repository.getDatasourceType() + "[" + repository.getEnglishName() + "]";
|
|
738 |
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
|
736 | 739 |
|
737 | 740 |
// String message = "Dear " + ((OIDCAuthenticationToken) authentication).getUserInfo().getName() + ",\n" + |
738 | 741 |
String message = "Dear user,\n" + |
... | ... | |
741 | 744 |
"Base URL: " + repositoryInterface.getBaseUrl() + "\n" + |
742 | 745 |
"Set: " + repositoryInterface.getAccessSet() + "\n" + |
743 | 746 |
"Guidelines: " + repositoryInterface.getDesiredCompatibilityLevel() + "\n\n" + |
744 |
"for " + repository.getDatasourceType() + "[" + repository.getEnglishName() + "].\n";
|
|
747 |
"for " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "].\n";
|
|
745 | 748 |
|
746 | 749 |
if (comment != null) { |
747 | 750 |
message += "\n Your comment was '" + comment + "'\n"; |
Also available in: Unified diff
merged branch aai_roles_new to trunk