Revision 36945
Added by Antonis Lempesis over 9 years ago
modules/uoa-goldoa-service/trunk/src/main/java/eu/dnetlib/goldoa/service/utils/EmailUtils.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.goldoa.service.utils; |
2 | 2 |
|
3 | 3 |
import eu.dnetlib.goldoa.domain.*; |
4 |
import eu.dnetlib.goldoa.service.dao.PersonDAO; |
|
4 | 5 |
import org.apache.log4j.Logger; |
6 |
import org.springframework.beans.factory.annotation.Autowired; |
|
5 | 7 |
|
6 | 8 |
import javax.mail.MessagingException; |
7 | 9 |
import java.io.PrintWriter; |
... | ... | |
15 | 17 |
public class EmailUtils { |
16 | 18 |
private static Logger logger = Logger.getLogger(EmailUtils.class); |
17 | 19 |
|
20 |
@Autowired |
|
21 |
PersonDAO personDAO; |
|
22 |
|
|
18 | 23 |
private MailLibrary mailLibrary; |
19 | 24 |
private String baseAddress; |
20 | 25 |
private String termsOfAgreementUrl; |
... | ... | |
250 | 255 |
} |
251 | 256 |
|
252 | 257 |
public void sendUserRoleAcceptedEmail(Person person, Role role) throws MessagingException { |
253 |
String subject = "Role granted";
|
|
258 |
String subject = "[OpenAIRE-FP7-Gold-OA-Pilot] " + role.getName() + " status granted";
|
|
254 | 259 |
|
255 |
String text = "Hello " + person.getName() + ",\n" + |
|
256 |
" You have been granted the role " + role.getName() + "\n" + |
|
257 |
" The OpenAIRE Gold Open Access team."; |
|
260 |
String text = "Dear " + person.getName() + " " + person.getLastname() + ",\n" + |
|
261 |
"\n" + |
|
262 |
"You have been upgraded/granted to the " + role.getName() + " status.\n" + |
|
263 |
"\n" + |
|
264 |
"Best,\n" + |
|
265 |
"The OpenAIRE team"; |
|
258 | 266 |
|
259 | 267 |
mailLibrary.sendEmail(new String[] {person.getEmail()}, subject, text); |
260 | 268 |
} |
261 | 269 |
|
262 | 270 |
public void sendModeratorRoleAcceptedEmail(Person moderator, Person user, Role role) throws MessagingException { |
263 |
String subject = "Role granted";
|
|
271 |
String subject = "[OpenAIRE-FP7-Gold-OA-Pilot] " + role.getName() + " status granted to user " + user.getName() + " " + user.getLastname();
|
|
264 | 272 |
|
265 |
String text = "Hello " + moderator.getName() + ",\n" + |
|
266 |
" User " + user.getName() + " " + user.getLastname() + " has been granted the role + " + role.getName() + "\n" + |
|
267 |
" The OpenAIRE Gold Open Access team."; |
|
273 |
String text = "Dear moderator,\n" + |
|
274 |
"\n" + |
|
275 |
"User " + user.getName() + " " + user.getLastname(); |
|
276 |
if (user.getAffiliations().size() > 0 && user.getAffiliations().get(0).getOrganization() != null && user.getAffiliations().get(0).getOrganization().getName() != null) |
|
277 |
text += " from organization " + user.getAffiliations().get(0).getOrganization().getName(); |
|
278 |
text += "has been upgraded/granted the {XXXX} status.\n" + |
|
279 |
" \n" + |
|
280 |
"Best,\n" + |
|
281 |
"The OpenAIRE team"; |
|
268 | 282 |
|
269 | 283 |
mailLibrary.sendEmail(new String[] {moderator.getEmail()}, subject, text); |
270 | 284 |
} |
271 | 285 |
|
272 | 286 |
public void sendUserRoleRejectedEmail(Person person, Role role) throws MessagingException { |
273 |
String subject = "Role denied"; |
|
287 |
String subject = "[OpenAIRE-FP7-Gold-OA-Pilot] " + role.getName() + " status not granted"; |
|
288 |
// TODO use contact us link when ready |
|
289 |
String link = baseAddress + "/#home"; |
|
274 | 290 |
|
275 |
String text = "Hello " + person.getName() + ",\n" + |
|
276 |
" Your request for the role " + role.getName() + " has been denied.\n" + |
|
277 |
" The OpenAIRE Gold Open Access team."; |
|
291 |
String text = "Dear " + person.getName() + " " + person.getLastname() + ",\n" + |
|
292 |
"\n" + |
|
293 |
"You have not been upgraded/granted the " + role.getName() + " status.\n" + |
|
294 |
"\n" + |
|
295 |
"Contact us at " + link + " if you need further information.\n" + |
|
296 |
" \n" + |
|
297 |
"Best,\n" + |
|
298 |
"The OpenAIRE team"; |
|
278 | 299 |
|
279 | 300 |
mailLibrary.sendEmail(new String[] {person.getEmail()}, subject, text); |
280 | 301 |
} |
281 | 302 |
|
282 | 303 |
public void sendModeratorRoleRejectedEmail(Person moderator, Person user, Role role) throws MessagingException { |
283 |
String subject = "Role denied";
|
|
304 |
String subject = "[OpenAIRE-FP7-Gold-OA-Pilot] " + role.getName() + " status NOT granted to user " + user.getName() + " " + user.getLastname();
|
|
284 | 305 |
|
285 |
String text = "Hello " + moderator.getName() + ",\n" + |
|
286 |
" User " + user.getName() + " " + user.getLastname() + " has been denied the role + " + role.getName() + "\n" + |
|
287 |
" The OpenAIRE Gold Open Access team."; |
|
306 |
String text = "Dear moderator,\n" + |
|
307 |
"\n" + |
|
308 |
"User " + user.getName() + " " + user.getLastname(); |
|
309 |
if (user.getAffiliations().size() > 0 && user.getAffiliations().get(0).getOrganization() != null && user.getAffiliations().get(0).getOrganization().getName() != null) |
|
310 |
text += " from organization " + user.getAffiliations().get(0).getOrganization().getName(); |
|
311 |
text += "has not been upgraded/granted the {XXXX} status.\n" + |
|
312 |
" \n" + |
|
313 |
"Best,\n" + |
|
314 |
"The OpenAIRE team"; |
|
288 | 315 |
|
289 | 316 |
mailLibrary.sendEmail(new String[]{moderator.getEmail()}, subject, text); |
290 | 317 |
} |
291 | 318 |
|
292 | 319 |
public void sendUserRoleRequestedEmail(Person person, List<Role> roles) throws MessagingException { |
293 |
String subject = "Your requested role(s)"; |
|
320 |
String subject = "[OpenAIRE-FP7-Gold-OA-Pilot] "; |
|
321 |
for (Role role:roles) { |
|
322 |
subject += role.getName() + ", "; |
|
323 |
} |
|
324 |
subject = subject.substring(0, subject.length() - 2); |
|
325 |
subject += " status upgrade requested"; |
|
326 |
// TODO use contact us link when ready |
|
327 |
String link = baseAddress + "/#home"; |
|
294 | 328 |
|
295 |
String text = "Hello " + person.getName() + ",\n" +
|
|
296 |
" Your request from the following roles: ";
|
|
297 |
|
|
329 |
String text = "Dear " + person.getName() + " " + person.getLastname() + ",\n" +
|
|
330 |
"\n" +
|
|
331 |
"You have requested to upgrade your status to "; |
|
298 | 332 |
for (Role role:roles) { |
299 | 333 |
text += role.getName() + ", "; |
300 | 334 |
} |
335 |
text = text.substring(0, text.length() - 2); |
|
336 |
text += "\n" + |
|
337 |
"We will process your request asap.\n" + |
|
338 |
"\n" + |
|
339 |
"If you don't hear us from us within the next few days, or need further information do not hesitate to contact us at " + link + ".\n" + |
|
340 |
" \n" + |
|
341 |
"Best,\n" + |
|
342 |
"The OpenAIRE team"; |
|
301 | 343 |
|
302 |
text = text.substring(0, text.length() - 2); |
|
303 |
text += " will be processed soon.\n" + |
|
304 |
"The OpenAIRE Gold Open Access team."; |
|
305 |
|
|
306 | 344 |
mailLibrary.sendEmail(new String[] {person.getEmail()}, subject, text); |
307 | 345 |
} |
308 | 346 |
|
309 | 347 |
public void sendModeratorRoleRequestedEmail(Person moderator, Person user, List<Role> roles) throws MessagingException { |
310 |
String subject = "Role(s) requested"; |
|
348 |
String subject = "[OpenAIRE-FP7-Gold-OA-Pilot] "; |
|
349 |
for (Role role:roles) { |
|
350 |
subject += role.getName() + ", "; |
|
351 |
} |
|
352 |
subject = subject.substring(0, subject.length() - 2); |
|
353 |
subject += " status upgrade requested by user " + user.getName() + " " + user.getLastname(); |
|
311 | 354 |
|
312 |
String text = "Hello " + moderator.getName() + ",\n" + |
|
313 |
" User " + user.getName() + " " + user.getLastname() + " has requested the following role(s): "; |
|
314 |
|
|
355 |
String text = "Dear moderator,\n" + |
|
356 |
"\n" + |
|
357 |
"User " + user.getName() + " " + user.getLastname(); |
|
358 |
if (user.getAffiliations().size() > 0 && user.getAffiliations().get(0).getOrganization() != null && user.getAffiliations().get(0).getOrganization().getName() != null) |
|
359 |
text += " from organization " + user.getAffiliations().get(0).getOrganization().getName(); |
|
360 |
text += "has requested to upgraded/be granted the "; |
|
315 | 361 |
for (Role role : roles) { |
316 | 362 |
text += role.getName() + ", "; |
317 | 363 |
} |
318 |
|
|
319 | 364 |
text = text.substring(0, text.length() - 2); |
320 |
text += "\nThe OpenAIRE Gold Open Access team."; |
|
365 |
text += " status.\n\n" + |
|
366 |
"Best,\n" + |
|
367 |
"The OpenAIRE team"; |
|
321 | 368 |
|
322 | 369 |
mailLibrary.sendEmail(new String[]{moderator.getEmail()}, subject, text); |
323 | 370 |
} |
324 | 371 |
|
325 | 372 |
public void sendRequesterInvoiceNotification(RequestInfo requestInfo) throws MessagingException { |
326 |
String subject = "Invoice missing for request " + requestInfo.getId(); |
|
327 |
String text = "Hello " + requestInfo.getUser().getName() + ",\n"; |
|
373 |
String subject = "[OpenAIRE-FP7-Gold-OA-Pilot] Your funding request " + requestInfo.getId() + " - missing invoice"; |
|
374 |
// TODO use contact us link when ready |
|
375 |
String contactLink = baseAddress + "/#home"; |
|
376 |
String requestLink = baseAddress + "/#existingFundingRequests"; |
|
328 | 377 |
|
329 |
text += "Your request with id " + requestInfo.getId() + " is missing an invoice. Please, upload one before it is processed.\n"; |
|
330 |
text += "\nThe OpenAIRE Gold Open Access team."; |
|
378 |
String text = "Dear " + requestInfo.getUser().getName() + " " + requestInfo.getUser().getLastname() + ",\n" + |
|
379 |
"\n" + |
|
380 |
"The following request has been approved for funding but we are missing the invoice:\n" + |
|
381 |
"\n" + |
|
382 |
"Project: " + requestInfo.getProject().getAcronym() + " - " + requestInfo.getProject().getGrant() + "\n" + |
|
383 |
"Publication: " + requestInfo.getPublication().getTitle() + "\n"; // TODO add authors |
|
331 | 384 |
|
385 |
if (requestInfo.getPublication().getJournal() != null) |
|
386 |
text += "Journal: " + requestInfo.getPublication().getJournal().getTitle() + " , " + requestInfo.getPublication().getJournal().getPublisher().getName() + "\n"; |
|
387 |
else |
|
388 |
text += "Publisher: " + requestInfo.getPublication().getPublisher().getName() + "\n"; |
|
389 |
|
|
390 |
text += "Requested funding: " + requestInfo.getFundingRequested() + " " + requestInfo.getCurrency().getName() + "\n" + |
|
391 |
"\n" + |
|
392 |
"Please make sure that either you or the publisher uploads the invoice in our system. Unless you do so, the request will be left in a pending state.\n" + |
|
393 |
"\n" + |
|
394 |
"All invoices must be addressed to: \n" + |
|
395 |
"\"\"Athena\"\" Research Centre\n" + |
|
396 |
"Artemidos 6 & Epidavrou\n" + |
|
397 |
"GR-151 25, Athens - GREECE\n" + |
|
398 |
"Phone: +30 210 6875 300 Fax +30 210 6875 485\n" + |
|
399 |
"VAT NUMBER: EL999723442\n" + |
|
400 |
"\n"; |
|
401 |
|
|
402 |
if (requestInfo.getComment() != null) |
|
403 |
text += requestInfo.getComment() + "\n\n"; |
|
404 |
|
|
405 |
text += "Click on the link below at any time to follow the status of your request:\n" + |
|
406 |
requestLink + "\n" + |
|
407 |
"\n" + |
|
408 |
"Feel free to contact us at " + contactLink + " if you need further information.\n" + |
|
409 |
" \n" + |
|
410 |
"Best,\n" + |
|
411 |
"The OpenAIRE team"; |
|
412 |
|
|
332 | 413 |
mailLibrary.sendEmail(new String[]{requestInfo.getUser().getEmail()}, subject, text); |
333 | 414 |
} |
334 | 415 |
|
335 | 416 |
public void sendPublisherInvoiceNotification(RequestInfo requestInfo) throws MessagingException { |
336 |
String subject = "Invoice missing for request " + requestInfo.getId(); |
|
337 | 417 |
Publisher publisher = requestInfo.getPublication().getPublisher() != null?requestInfo.getPublication().getPublisher():requestInfo.getPublication().getJournal().getPublisher(); |
338 | 418 |
|
339 | 419 |
if (publisher != null && publisher.getEmail() != null) { |
340 |
String text = "Hello " + publisher.getContact() + ",\n"; |
|
420 |
String subject = "[OpenAIRE-FP7-Gold-OA-Pilot] Funding request " + requestInfo.getId() + " - missing invoice"; |
|
421 |
// TODO use contact us link when ready |
|
422 |
String contactLink = baseAddress + "/#home"; |
|
423 |
String requestLink = baseAddress + "/#existingFundingRequests"; |
|
424 |
Person contact; |
|
425 |
String text; |
|
341 | 426 |
|
342 |
text += "The request with id " + requestInfo.getId() + " is missing an invoice. Please, upload one before it is processed.\n"; |
|
343 |
text += "\nThe OpenAIRE Gold Open Access team."; |
|
427 |
if (publisher.getContact() != null && publisher.getContact().getId() != null) { |
|
428 |
contact = personDAO.getPersonById(publisher.getContact().getId()); |
|
429 |
text = "Dear " + contact.getName() + " " + contact.getLastname() + ",\n"; |
|
430 |
} else { |
|
431 |
text = "Dear Madame/Sir,\n"; |
|
432 |
} |
|
344 | 433 |
|
434 |
text += "The following request by " + requestInfo.getUser().getName() + " " + requestInfo.getUser().getLastname() + " has been approved for funding but we are missing the invoice:\n" + |
|
435 |
"\n" + |
|
436 |
"Project: " + requestInfo.getProject().getAcronym() + " - " + requestInfo.getProject().getGrant() + "\n" + |
|
437 |
"Publication: " + requestInfo.getPublication().getTitle() + "\n"; // TODO add authors |
|
438 |
|
|
439 |
if (requestInfo.getPublication().getJournal() != null) |
|
440 |
text += "Journal: " + requestInfo.getPublication().getJournal().getTitle() + " , " + requestInfo.getPublication().getJournal().getPublisher().getName() + "\n"; |
|
441 |
else |
|
442 |
text += "Publisher: " + requestInfo.getPublication().getPublisher().getName() + "\n"; |
|
443 |
|
|
444 |
text += "Requested funding: " + requestInfo.getFundingRequested() + " " + requestInfo.getCurrency().getName() + "\n" + |
|
445 |
"\n" + |
|
446 |
"If you haven't done so already, sign in our system and see how to upload the invoice. Unless you or do so, the request will be left in a pending state.\n" + |
|
447 |
"\n" + |
|
448 |
"All invoices must be addressed to: \n" + |
|
449 |
"\"\"Athena\"\" Research Centre\n" + |
|
450 |
"Artemidos 6 & Epidavrou\n" + |
|
451 |
"GR-151 25, Athens - GREECE\n" + |
|
452 |
"Phone: +30 210 6875 300 Fax +30 210 6875 485\n" + |
|
453 |
"VAT NUMBER: EL999723442\n" + |
|
454 |
"\n"; |
|
455 |
|
|
456 |
if (requestInfo.getComment() != null) |
|
457 |
text += requestInfo.getComment() + "\n\n"; |
|
458 |
|
|
459 |
text += "Click on the link below at any time to follow the status of this request:\n" + |
|
460 |
requestLink + "\n" + |
|
461 |
"\n" + |
|
462 |
"Feel free to contact us at " + contactLink + " if you need further information.\n" + |
|
463 |
" \n" + |
|
464 |
"Best,\n" + |
|
465 |
"The OpenAIRE team"; |
|
466 |
|
|
345 | 467 |
mailLibrary.sendEmail(new String[]{publisher.getEmail()}, subject, text); |
346 | 468 |
} |
347 | 469 |
} |
348 | 470 |
|
349 | 471 |
public void sendAccountingRequestApprovedEmail(Person person, RequestInfo requestInfo) throws MessagingException { |
350 |
String subject = "Funding request " + requestInfo.getId() + " completed"; |
|
351 |
String text = "Hello " + person.getName() + ",\n"; |
|
472 |
String subject = "[OpenAIRE-FP7-Gold-OA-Pilot] Funding request \" + requestInfo.getId() + \" completed"; |
|
473 |
// TODO use contact us link when ready |
|
474 |
String requestLink = baseAddress + "/#accountingMonitorFundingRequests"; |
|
352 | 475 |
|
353 |
text += "A request with id " + requestInfo.getId() + " is complete and waiting payment. Please, pay!.\n"; |
|
354 |
text += "\nThe OpenAIRE Gold Open Access team."; |
|
476 |
String text = "Dear Accounting Officer,\n" + |
|
477 |
"\n" + |
|
478 |
"The following request has been approved for funding:\n" + |
|
479 |
"\n" + |
|
480 |
"Project: " + requestInfo.getProject().getAcronym() + " - " + requestInfo.getProject().getGrant() + "\n" + |
|
481 |
"Publication: " + requestInfo.getPublication().getTitle() + "\n"; // TODO add authors |
|
355 | 482 |
|
483 |
if (requestInfo.getPublication().getJournal() != null) |
|
484 |
text += "Journal: " + requestInfo.getPublication().getJournal().getTitle() + " , " + requestInfo.getPublication().getJournal().getPublisher().getName() + "\n"; |
|
485 |
else |
|
486 |
text += "Publisher: " + requestInfo.getPublication().getPublisher().getName() + "\n"; |
|
487 |
|
|
488 |
text += "Requested funding: " + requestInfo.getFundingRequested() + " " + requestInfo.getCurrency().getName() + "\n" + |
|
489 |
"\n"; |
|
490 |
text += "Click on the link below to visit the publication data and related accounting info:\n" + |
|
491 |
requestLink + "\n" + |
|
492 |
"\n" + |
|
493 |
"Best,\n" + |
|
494 |
"The OpenAIRE team"; |
|
495 |
|
|
356 | 496 |
mailLibrary.sendEmail(new String[]{person.getEmail()}, subject, text); |
357 | 497 |
} |
358 | 498 |
|
359 | 499 |
public void sendRequesterPaidEmail(RequestInfo requestInfo) throws MessagingException { |
360 |
String subject = "Your request " + requestInfo.getId() + " has been paid"; |
|
500 |
String subject = "[OpenAIRE-FP7-Gold-OA-Pilot] Your funding request " + requestInfo.getId() + " has been paid"; |
|
501 |
String contactLink = baseAddress + "/#home"; |
|
361 | 502 |
|
362 |
String text = "Hello " + requestInfo.getUser().getName() + ",\n"; |
|
503 |
String text = "Dear " + requestInfo.getUser().getName() + " " + requestInfo.getUser().getLastname() + ",\n" + |
|
504 |
"\n" + |
|
505 |
"The following request has been completed and APCs have been paid:\n" + |
|
506 |
"\n" + |
|
507 |
"Project: " + requestInfo.getProject().getAcronym() + " - " + requestInfo.getProject().getGrant() + "\n" + |
|
508 |
"Publication: " + requestInfo.getPublication().getTitle() + "\n"; // TODO add authors |
|
363 | 509 |
|
364 |
text += "The request with id " + requestInfo.getId() + " has been paid.\n"; |
|
365 |
text += "\nThe OpenAIRE Gold Open Access team."; |
|
510 |
if (requestInfo.getPublication().getJournal() != null) |
|
511 |
text += "Journal: " + requestInfo.getPublication().getJournal().getTitle() + " , " + requestInfo.getPublication().getJournal().getPublisher().getName() + "\n"; |
|
512 |
else |
|
513 |
text += "Publisher: " + requestInfo.getPublication().getPublisher().getName() + "\n"; |
|
366 | 514 |
|
515 |
text += "Requested funding: " + requestInfo.getFundingRequested() + " " + requestInfo.getCurrency().getName() + "\n" + |
|
516 |
"\n"; |
|
517 |
text += "Please make sure that you or the researcher\n" + |
|
518 |
"1. update the DOI in our system, and \n" + |
|
519 |
"2. deposit the final manuscript in an OpenAIRE compliant repository (see list here)\n" + |
|
520 |
"\n"; |
|
521 |
if (requestInfo.getComment() != null) |
|
522 |
text += requestInfo.getComment() + "\n\n"; |
|
523 |
|
|
524 |
text += "Feel free to contact us at " + contactLink + " if you need further information.\n\n" + |
|
525 |
"Best,\n" + |
|
526 |
"The OpenAIRE team"; |
|
527 |
|
|
367 | 528 |
mailLibrary.sendEmail(new String[]{requestInfo.getUser().getEmail()}, subject, text); |
368 | 529 |
} |
369 | 530 |
|
370 | 531 |
public void sendPublisherPaidEmail(RequestInfo requestInfo) throws MessagingException { |
371 |
String subject = "Request " + requestInfo.getId() + " has been paid"; |
|
372 | 532 |
Publisher publisher = requestInfo.getPublication().getPublisher() != null?requestInfo.getPublication().getPublisher():requestInfo.getPublication().getJournal().getPublisher(); |
373 | 533 |
|
374 | 534 |
if (publisher != null && publisher.getEmail() != null) { |
375 |
String text = "Hello " + publisher.getContact() + ",\n"; |
|
535 |
String subject = "[OpenAIRE-FP7-Gold-OA-Pilot] Funding request " + requestInfo.getId() + " for invoice " + requestInfo.getInvoice().getNumber() + " has been paid"; |
|
536 |
String contactLink = baseAddress + "/#home"; |
|
537 |
String text; |
|
538 |
Person contact; |
|
376 | 539 |
|
377 |
text += "The request with id " + requestInfo.getId() + " has been paid.\n"; |
|
378 |
text += "\nThe OpenAIRE Gold Open Access team."; |
|
540 |
if (publisher.getContact() != null && publisher.getContact().getId() != null) { |
|
541 |
contact = personDAO.getPersonById(publisher.getContact().getId()); |
|
542 |
text = "Dear " + contact.getName() + " " + contact.getLastname() + ",\n"; |
|
543 |
} else { |
|
544 |
text = "Dear Madame/Sir,\n"; |
|
545 |
} |
|
379 | 546 |
|
547 |
text += "\n" + |
|
548 |
"The following request has been completed and APCs have been paid:\n" + |
|
549 |
"\n" + |
|
550 |
"Invoice #: " + requestInfo.getInvoice().getNumber() + "\n" + |
|
551 |
"Project: " + requestInfo.getProject().getAcronym() + " - " + requestInfo.getProject().getGrant() + "\n" + |
|
552 |
"Publication: " + requestInfo.getPublication().getTitle() + "\n"; // TODO add authors |
|
553 |
|
|
554 |
if (requestInfo.getPublication().getJournal() != null) |
|
555 |
text += "Journal: " + requestInfo.getPublication().getJournal().getTitle() + " , " + requestInfo.getPublication().getJournal().getPublisher().getName() + "\n"; |
|
556 |
else |
|
557 |
text += "Publisher: " + requestInfo.getPublication().getPublisher().getName() + "\n"; |
|
558 |
|
|
559 |
text += "Requested funding: " + requestInfo.getFundingRequested() + " " + requestInfo.getCurrency().getName() + "\n" + |
|
560 |
"\n"; |
|
561 |
text += "Please make sure that you or the researcher\n" + |
|
562 |
"1. update the DOI in our system, and \n" + |
|
563 |
"2. deposit the final manuscript in an OpenAIRE compliant repository (see list here)\n" + |
|
564 |
"\n"; |
|
565 |
if (requestInfo.getComment() != null) |
|
566 |
text += requestInfo.getComment() + "\n\n"; |
|
567 |
|
|
568 |
text += "Feel free to contact us at " + contactLink + " if you need further information.\n\n" + |
|
569 |
"Best,\n" + |
|
570 |
"The OpenAIRE team"; |
|
571 |
|
|
380 | 572 |
mailLibrary.sendEmail(new String[]{publisher.getEmail()}, subject, text); |
381 | 573 |
} |
382 | 574 |
} |
383 | 575 |
|
384 | 576 |
public void sendRequesterOnHoldEmail(RequestInfo requestInfo) throws MessagingException { |
385 |
String subject = "Your request " + requestInfo.getId() + " is on hold"; |
|
577 |
String subject = "[OpenAIRE-FP7-Gold-OA-Pilot] Your funding request " + requestInfo.getId() + " has been put on hold"; |
|
578 |
String contactLink = baseAddress + "/#home"; |
|
579 |
String requestLink = baseAddress + "/#existingFundingRequests"; |
|
386 | 580 |
|
387 |
String text = "Hello " + requestInfo.getUser().getName() + ",\n"; |
|
581 |
String text = "Dear " + requestInfo.getUser().getName() + " " + requestInfo.getUser().getLastname() + ",\n" + |
|
582 |
"\n" + |
|
583 |
"The following request has been put on hold by our accounting office:\n" + |
|
584 |
"\n" + |
|
585 |
"Project: " + requestInfo.getProject().getAcronym() + " - " + requestInfo.getProject().getGrant() + "\n" + |
|
586 |
"Publication: " + requestInfo.getPublication().getTitle() + "\n"; // TODO add authors |
|
388 | 587 |
|
389 |
text += "The request with id " + requestInfo.getId() + " is on hold.\n"; |
|
390 |
text += "The comments from the Gold Open Access administrator is: \n" + requestInfo.getComment(); |
|
391 |
text += "\nThe OpenAIRE Gold Open Access team."; |
|
588 |
if (requestInfo.getPublication().getJournal() != null) |
|
589 |
text += "Journal: " + requestInfo.getPublication().getJournal().getTitle() + " , " + requestInfo.getPublication().getJournal().getPublisher().getName() + "\n"; |
|
590 |
else |
|
591 |
text += "Publisher: " + requestInfo.getPublication().getPublisher().getName() + "\n"; |
|
392 | 592 |
|
593 |
text += "Requested funding: " + requestInfo.getFundingRequested() + " " + requestInfo.getCurrency().getName() + "\n" + |
|
594 |
"\n"; |
|
595 |
if (requestInfo.getComment() != null) |
|
596 |
text += requestInfo.getComment() + "\n\n"; |
|
597 |
|
|
598 |
text += "Click on the link below at any time to follow the status of your request:\n" + |
|
599 |
requestLink + "\n" + |
|
600 |
"\n" + |
|
601 |
"Feel free to contact us at " + contactLink + " if you need further information.\n\n" + |
|
602 |
"Best,\n" + |
|
603 |
"The OpenAIRE team"; |
|
604 |
|
|
393 | 605 |
mailLibrary.sendEmail(new String[]{requestInfo.getUser().getEmail()}, subject, text); |
394 | 606 |
} |
395 | 607 |
|
396 | 608 |
public void sendPublisherOnHoldEmail(RequestInfo requestInfo) throws MessagingException { |
397 |
String subject = "Request " + requestInfo.getId() + " is on hold"; |
|
398 | 609 |
Publisher publisher = requestInfo.getPublication().getPublisher() != null?requestInfo.getPublication().getPublisher():requestInfo.getPublication().getJournal().getPublisher(); |
399 | 610 |
|
400 | 611 |
if (publisher != null && publisher.getEmail() != null) { |
401 |
String text = "Hello " + publisher.getContact() + ",\n"; |
|
612 |
String subject = "[OpenAIRE-FP7-Gold-OA-Pilot] Funding request " + requestInfo.getId() + " for invoice " + requestInfo.getInvoice().getNumber() + " has been put on hold"; |
|
613 |
String contactLink = baseAddress + "/#home"; |
|
614 |
String requestLink = baseAddress + "/#existingFundingRequests"; |
|
615 |
String text; |
|
616 |
Person contact; |
|
402 | 617 |
|
403 |
text += "The request with id " + requestInfo.getId() + " is on hold.\n"; |
|
404 |
text += "The comments from the Gold Open Access administrator is: \n" + requestInfo.getComment(); |
|
405 |
text += "\nThe OpenAIRE Gold Open Access team."; |
|
618 |
if (publisher.getContact() != null && publisher.getContact().getId() != null) { |
|
619 |
contact = personDAO.getPersonById(publisher.getContact().getId()); |
|
620 |
text = "Dear " + contact.getName() + " " + contact.getLastname() + ",\n"; |
|
621 |
} else { |
|
622 |
text = "Dear Madame/Sir,\n"; |
|
623 |
} |
|
406 | 624 |
|
625 |
text += "\n" + |
|
626 |
"The following request has been put on hold by our accounting office:\n" + |
|
627 |
"\n" + |
|
628 |
"Invoice #: " + requestInfo.getInvoice().getNumber() + "\n" + |
|
629 |
"Project: " + requestInfo.getProject().getAcronym() + " - " + requestInfo.getProject().getGrant() + "\n" + |
|
630 |
"Publication: " + requestInfo.getPublication().getTitle() + "\n"; // TODO add authors |
|
631 |
|
|
632 |
if (requestInfo.getPublication().getJournal() != null) |
|
633 |
text += "Journal: " + requestInfo.getPublication().getJournal().getTitle() + " , " + requestInfo.getPublication().getJournal().getPublisher().getName() + "\n"; |
|
634 |
else |
|
635 |
text += "Publisher: " + requestInfo.getPublication().getPublisher().getName() + "\n"; |
|
636 |
|
|
637 |
text += "Requested funding: " + requestInfo.getFundingRequested() + " " + requestInfo.getCurrency().getName() + "\n" + |
|
638 |
"\n"; |
|
639 |
if (requestInfo.getComment() != null) |
|
640 |
text += requestInfo.getComment() + "\n\n"; |
|
641 |
|
|
642 |
text += "Click on the link below at any time to follow the status of your request:\n" + |
|
643 |
requestLink + "\n" + |
|
644 |
"\n" + |
|
645 |
"Feel free to contact us at " + contactLink + " if you need further information.\n\n" + |
|
646 |
"Best,\n" + |
|
647 |
"The OpenAIRE team"; |
|
648 |
|
|
407 | 649 |
mailLibrary.sendEmail(new String[]{publisher.getEmail()}, subject, text); |
408 | 650 |
} |
409 | 651 |
} |
410 | 652 |
|
411 | 653 |
public void sendRequesterDeniedEmail(RequestInfo requestInfo) throws MessagingException { |
412 |
String subject = "Your request " + requestInfo.getId() + " has been denied"; |
|
654 |
String subject = "[OpenAIRE-FP7-Gold-OA-Pilot] Your funding request " + requestInfo.getId() + " has been denied payment"; |
|
655 |
String contactLink = baseAddress + "/#home"; |
|
656 |
String requestLink = baseAddress + "/#existingFundingRequests"; |
|
413 | 657 |
|
414 |
String text = "Hello " + requestInfo.getUser().getName() + ",\n"; |
|
658 |
String text = "Dear " + requestInfo.getUser().getName() + " " + requestInfo.getUser().getLastname() + ",\n" + |
|
659 |
"\n" + |
|
660 |
"The following request has been denied payment by our accounting office:\n" + |
|
661 |
"\n" + |
|
662 |
"Project: " + requestInfo.getProject().getAcronym() + " - " + requestInfo.getProject().getGrant() + "\n" + |
|
663 |
"Publication: " + requestInfo.getPublication().getTitle() + "\n"; // TODO add authors |
|
415 | 664 |
|
416 |
text += "The request with id " + requestInfo.getId() + " has been denied.\n"; |
|
417 |
text += "The comments from the Gold Open Access administrator is: \n" + requestInfo.getComment(); |
|
418 |
text += "\nThe OpenAIRE Gold Open Access team."; |
|
665 |
if (requestInfo.getPublication().getJournal() != null) |
|
666 |
text += "Journal: " + requestInfo.getPublication().getJournal().getTitle() + " , " + requestInfo.getPublication().getJournal().getPublisher().getName() + "\n"; |
|
667 |
else |
|
668 |
text += "Publisher: " + requestInfo.getPublication().getPublisher().getName() + "\n"; |
|
419 | 669 |
|
670 |
text += "Requested funding: " + requestInfo.getFundingRequested() + " " + requestInfo.getCurrency().getName() + "\n" + |
|
671 |
"\n"; |
|
672 |
if (requestInfo.getComment() != null) |
|
673 |
text += requestInfo.getComment() + "\n\n"; |
|
674 |
|
|
675 |
text += "Click on the link below at any time to follow the status of your request:\n" + |
|
676 |
requestLink + "\n" + |
|
677 |
"\n" + |
|
678 |
"Feel free to contact us at " + contactLink + " if you need further information.\n\n" + |
|
679 |
"Best,\n" + |
|
680 |
"The OpenAIRE team"; |
|
681 |
|
|
420 | 682 |
mailLibrary.sendEmail(new String[]{requestInfo.getUser().getEmail()}, subject, text); |
421 | 683 |
} |
422 | 684 |
|
423 | 685 |
public void sendPublisherDeniedEmail(RequestInfo requestInfo) throws MessagingException { |
424 |
String subject = "Request " + requestInfo.getId() + " has been denied";
|
|
425 |
Publisher publisher = requestInfo.getPublication().getPublisher() != null?requestInfo.getPublication().getPublisher():requestInfo.getPublication().getJournal().getPublisher();
|
|
686 |
//
|
|
687 |
}
|
|
426 | 688 |
|
427 |
if (publisher != null && publisher.getEmail() != null) { |
|
428 |
String text = "Hello " + publisher.getContact() + ",\n"; |
|
689 |
public void sendCoordinatorRequestSubmittedEmail(Person coordinator, RequestInfo requestInfo) throws MessagingException { |
|
690 |
String subject = "[OpenAIRE-FP7-Gold-OA-Pilot] A new funding request (" + requestInfo.getId() + ") has been submitted"; |
|
691 |
String contactLink = baseAddress + "/#home"; |
|
429 | 692 |
|
430 |
text += "The request with id " + requestInfo.getId() + " has been denied.\n";
|
|
431 |
text += "The comments from the Gold Open Access administrator is: \n" + requestInfo.getComment();
|
|
432 |
text += "\nThe OpenAIRE Gold Open Access team.";
|
|
693 |
String text = "Dear " + coordinator.getName() + " " + coordinator.getLastname() + ",\n" +
|
|
694 |
"We are contacting you in your capacity of project coordinator for project " + requestInfo.getProject().getAcronym() + ".\n" +
|
|
695 |
"As you may already know your project is eligible for publising funds from the OpenAIRE FP7 post-grant Gold Open Access Pilot " + contactLink + ".\n";
|
|
433 | 696 |
|
434 |
mailLibrary.sendEmail(new String[]{publisher.getEmail()}, subject, text); |
|
697 |
|
|
698 |
if (!requestInfo.getUser().getId().equals(requestInfo.getResearcher().getId())) { |
|
699 |
text += requestInfo.getUser().getName() + " " + requestInfo.getUser().getLastname() + " from " + requestInfo.getUser().getAffiliations().get(0).getOrganization().getName() + |
|
700 |
" has requested on behalf of " + requestInfo.getResearcher().getName() + " " + requestInfo.getResearcher().getLastname() + |
|
701 |
" the funding of the following publication:\n"; |
|
702 |
} else { |
|
703 |
text += requestInfo.getResearcher().getName() + " " + requestInfo.getResearcher().getLastname() + " from " + requestInfo.getUser().getAffiliations().get(0).getOrganization().getName() + |
|
704 |
" has requested the funding of the following publication:\n"; |
|
435 | 705 |
} |
436 |
} |
|
437 | 706 |
|
438 |
public void sendCoordinatorRequestSubmittedEmail(Person coordinator, RequestInfo requestInfo) throws MessagingException {
|
|
439 |
String subject = "A new funding request (" + requestInfo.getId() + ") has been submitted";
|
|
707 |
text += "\n";
|
|
708 |
text += "Publication: " + requestInfo.getPublication().getTitle() + "\n"; // TODO add authors
|
|
440 | 709 |
|
441 |
String text = "Hello " + coordinator.getName() + ",\n" + |
|
442 |
" a funding request has been submitted by " + requestInfo.getUser().getName() + " " + requestInfo.getUser().getLastname() + "."; |
|
710 |
if (requestInfo.getPublication().getJournal() != null) |
|
711 |
text += "Journal: " + requestInfo.getPublication().getJournal().getTitle() + " , " + requestInfo.getPublication().getJournal().getPublisher().getName() + "\n"; |
|
712 |
else |
|
713 |
text += "Publisher: " + requestInfo.getPublication().getPublisher().getName() + "\n"; |
|
443 | 714 |
|
444 |
text += " You may review it...";
|
|
445 |
text += "\nThe OpenAIRE Gold Open Access team.";
|
|
715 |
text += "Requested funding: " + requestInfo.getFundingRequested() + " " + requestInfo.getCurrency().getName() + "\n" +
|
|
716 |
"\n";
|
|
446 | 717 |
|
718 |
text += "As there is a limit of 3 publications from each project from this Pilot and would like to ensure a fair use of the fund. For the project's best interests, please let us know if there is any reason why we should not proceed with the requestd funding within the next 3 working days.\n"; |
|
719 |
text += "Feel free to contact us at " + contactLink + " if you need further information.\n\n" + |
|
720 |
"Best,\n" + |
|
721 |
"The OpenAIRE team"; |
|
722 |
|
|
447 | 723 |
mailLibrary.sendEmail(coordinator.getEmail(), subject, text); |
448 | 724 |
} |
449 | 725 |
|
Also available in: Unified diff
email texts updated