Revision 58702
Added by Argiro Kokogiannaki almost 4 years ago
modules/uoa-claims/trunk/src/main/java/eu/dnetlib/data/emailSender/EmailScheduler.java | ||
---|---|---|
50 | 50 |
logger.debug("Initializing EmailScheduler with beautySleep " + beautySleep + " and begin time " + targetHour + ":" + targetMinute + ":" + targetSecond + " and email sender " + emailSender); |
51 | 51 |
delay = getInitialDelaySeconds(Integer.parseInt(targetHour), Integer.parseInt(targetMinute), Integer.parseInt(targetSecond)); |
52 | 52 |
logger.debug("EmailScheduler will wait " + delay + " seconds"); |
53 |
|
|
53 |
logger.debug("Send mail to community managers: " +this.emailSender.isNotifyCommunityManagers()); |
|
54 |
logger.debug("Send mail to project managers: " +this.emailSender.isNotifyProjectManagers()); |
|
54 | 55 |
final ScheduledFuture<?> resetHandle = scheduler.scheduleAtFixedRate(emailSender, delay, Integer.parseInt(beautySleep), SECONDS); |
55 | 56 |
} else { |
56 | 57 |
logger.debug("Shutting down EmailScheduler for claim notifications"); |
modules/uoa-claims/trunk/src/main/java/eu/dnetlib/data/emailSender/EmailSender.java | ||
---|---|---|
48 | 48 |
private static String contactMail; |
49 | 49 |
private static String specialRecipients; |
50 | 50 |
private static String enabledCommunities; |
51 |
private static boolean notifyCommunityManagers; |
|
52 |
private static boolean notifyProjectManagers; |
|
51 | 53 |
|
52 | 54 |
@Override |
53 | 55 |
public void run() { |
... | ... | |
58 | 60 |
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
59 | 61 |
Date date = new Date(); |
60 | 62 |
String dateTo = (format.format(date)); |
61 |
|
|
63 |
if(notifyCommunityManagers){ |
|
64 |
defaultEmails_For_CommunityClaims(dateTo, format); // daily for managers not in notification table |
|
65 |
notificationEmails_For_CommunityClaims(dateTo, format); |
|
66 |
} |
|
67 |
if(notifyProjectManagers) { |
|
62 | 68 |
// defaultEmails_For_ProjectClaims(dateTo, format); // daily for managers not in notification table |
63 |
// defaultEmails_For_CommunityClaims(dateTo, format); // daily for managers not in notification table |
|
64 |
|
|
65 | 69 |
// notificationEmails_For_ProjectClaims(dateTo, format); |
66 |
// notificationEmails_For_CommunityClaims(dateTo, format);
|
|
70 |
}
|
|
67 | 71 |
} |
68 | 72 |
|
69 | 73 |
public void defaultEmails_For_ProjectClaims(String dateTo, SimpleDateFormat format) { |
... | ... | |
529 | 533 |
public void setEnabledCommunities(String enabledCommunities) { |
530 | 534 |
EmailSender.enabledCommunities = enabledCommunities; |
531 | 535 |
} |
536 |
|
|
537 |
public static boolean isNotifyCommunityManagers() { |
|
538 |
return notifyCommunityManagers; |
|
539 |
} |
|
540 |
|
|
541 |
public static void setNotifyCommunityManagers(boolean notifyCommunityManagers) { |
|
542 |
EmailSender.notifyCommunityManagers = notifyCommunityManagers; |
|
543 |
} |
|
544 |
|
|
545 |
public static boolean isNotifyProjectManagers() { |
|
546 |
return notifyProjectManagers; |
|
547 |
} |
|
548 |
|
|
549 |
public static void setNotifyProjectManagers(boolean notifyProjectManagers) { |
|
550 |
EmailSender.notifyProjectManagers = notifyProjectManagers; |
|
551 |
} |
|
532 | 552 |
} |
modules/uoa-claims/trunk/src/main/resources/eu/dnetlib/data/claims/springContext-claims.properties | ||
---|---|---|
25 | 25 |
services.claims.mail.openaireCommunityClaimsPage = http://duffy.di.uoa.gr:4200/claims?communityId= |
26 | 26 |
services.claims.mail.manageCommunityUserNotificationsPage = https://beta.admin.connect.openaire.eu/manage-user-notifications?communityId= |
27 | 27 |
|
28 |
emailScheduler.sendEmailNotifications = false
|
|
28 |
services.claims.mail.sendEmailNotifications = false
|
|
29 | 29 |
|
30 | 30 |
services.claims.results.pathToSaveRecord = /home/argirok/claims_www_last/records/ |
31 | 31 |
services.claims.reports.pathToSaveReport = /home/argirok/claims_www_last/reports/ |
... | ... | |
36 | 36 |
|
37 | 37 |
|
38 | 38 |
services.claims.mail.enabledCommunities = invalid_community_pid |
39 |
services.claims.mail.notifyCommunityManagers = true |
|
40 |
services.claims.mail.notifyProjectManagers = false |
modules/uoa-claims/trunk/src/main/resources/eu/dnetlib/data/claims/springContext-claims.xml | ||
---|---|---|
109 | 109 |
<property name="specialRecipients" value="${services.claims.mail.specialRecipients}"/> |
110 | 110 |
<property name="defaultFrequencyInHours" ref="defaultFrequencyInHours"/> |
111 | 111 |
<property name="enabledCommunities" value="${services.claims.mail.enabledCommunities}"/> |
112 |
<property name="notifyCommunityManagers" value="${services.claims.mail.notifyCommunityManagers}"/> |
|
113 |
<property name="notifyProjectManagers" value="${services.claims.mail.notifyProjectManagers}"/> |
|
112 | 114 |
</bean> |
113 | 115 |
|
114 | 116 |
<bean id="CommunityUtils" class="eu.dnetlib.data.claims.utils.CommunityUtils"> |
... | ... | |
132 | 134 |
</bean> |
133 | 135 |
|
134 | 136 |
<bean id="emailScheduler" class="eu.dnetlib.data.emailSender.EmailScheduler"> |
135 |
<property name="sendEmailNotifications" value="${emailScheduler.sendEmailNotifications}"/>
|
|
137 |
<property name="sendEmailNotifications" value="${services.claims.mail.sendEmailNotifications}"/>
|
|
136 | 138 |
<property name="beautySleep" ref="beautySleep"/> |
137 | 139 |
<property name="targetHour" ref="targetHour"/> |
138 | 140 |
<property name="targetMinute" ref="targetMinute"/> |
Also available in: Unified diff
Update email Sender and Scheduler:
rename property emailScheduler.sendEmailNotifications to services.claims.mail.sendEmailNotifications
Add properties to enable/disable notifications for specific entities:
services.claims.mail.notifyCommunityManagers
services.claims.mail.notifyProjectManagers