1
|
package eu.dnetlib.data.emailSender;
|
2
|
|
3
|
import eu.dnetlib.data.claims.entity.Claim;
|
4
|
import eu.dnetlib.data.claims.entity.Context;
|
5
|
import eu.dnetlib.data.claims.entity.Notification;
|
6
|
import eu.dnetlib.data.claims.entity.Project;
|
7
|
import eu.dnetlib.data.claims.handler.*;
|
8
|
import eu.dnetlib.data.claims.utils.ClaimUtils;
|
9
|
//import eu.dnetlib.data.claims.utils.CommunityUtils;
|
10
|
import eu.dnetlib.data.claims.sql.SQLStoreException;
|
11
|
import eu.dnetlib.data.claims.utils.ManagerUtils;
|
12
|
import org.apache.log4j.Logger;
|
13
|
import org.springframework.beans.factory.annotation.Autowired;
|
14
|
|
15
|
import javax.mail.*;
|
16
|
import javax.mail.internet.AddressException;
|
17
|
import javax.mail.internet.InternetAddress;
|
18
|
import javax.mail.internet.MimeMessage;
|
19
|
import java.text.SimpleDateFormat;
|
20
|
import java.util.*;
|
21
|
|
22
|
public class EmailSender implements Runnable {
|
23
|
|
24
|
private static final Logger logger = Logger.getLogger(EmailSender.class);
|
25
|
|
26
|
@Autowired
|
27
|
private FetchClaimHandler fetchClaimHandler = null;
|
28
|
@Autowired
|
29
|
private FetchProjectHandler fetchProjectHandler = null;
|
30
|
@Autowired
|
31
|
private FetchNotificationHandler fetchNotificationHandler = null;
|
32
|
@Autowired
|
33
|
private NotificationHandler notificationHandler = null;
|
34
|
@Autowired
|
35
|
private FetchContextHandler fetchContextHandler = null;
|
36
|
|
37
|
@Autowired
|
38
|
private String defaultFrequencyInHours;
|
39
|
|
40
|
// @Autowired
|
41
|
// private CommunityUtils communityUtils;
|
42
|
|
43
|
@Autowired
|
44
|
private ManagerUtils managerUtils;
|
45
|
|
46
|
private static String manageCommunityUserNotificationsPage;
|
47
|
private static String openaireProjectClaimsPage;
|
48
|
private static String openaireCommunityClaimsPage;
|
49
|
private static String username;
|
50
|
private static String password;
|
51
|
private static String host;
|
52
|
private static String port;
|
53
|
private static String from;
|
54
|
private static String auth;
|
55
|
private static String contactMail;
|
56
|
private static String specialRecipients;
|
57
|
private static String enabledCommunities;
|
58
|
private static boolean notifyCommunityManagers;
|
59
|
private static boolean notifyProjectManagers;
|
60
|
|
61
|
@Override
|
62
|
public void run() {
|
63
|
logger.info("EmailSender thread is running. " + host);
|
64
|
logger.info("Special Recipients " + specialRecipients);
|
65
|
logger.info("Enabled Communities " + enabledCommunities);
|
66
|
|
67
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
68
|
Date date = new Date();
|
69
|
String dateTo = (format.format(date));
|
70
|
if(notifyCommunityManagers){
|
71
|
defaultEmails_For_CommunityClaims(dateTo, format); // daily for managers not in notification table
|
72
|
notificationEmails_For_CommunityClaims(dateTo, format);
|
73
|
}
|
74
|
if(notifyProjectManagers) {
|
75
|
// defaultEmails_For_ProjectClaims(dateTo, format); // daily for managers not in notification table
|
76
|
// notificationEmails_For_ProjectClaims(dateTo, format);
|
77
|
}
|
78
|
}
|
79
|
|
80
|
public void defaultEmails_For_ProjectClaims(String dateTo, SimpleDateFormat format) {
|
81
|
Map<String, List<String>> managersOfProject = new HashMap<String, List<String>>();
|
82
|
Project project;
|
83
|
List<Claim> claims = null;
|
84
|
List<String> types = new ArrayList<String>();
|
85
|
|
86
|
types.add(ClaimUtils.PROJECT);
|
87
|
|
88
|
Calendar calendar = Calendar.getInstance();
|
89
|
calendar.add(Calendar.HOUR_OF_DAY, -(Integer.parseInt(defaultFrequencyInHours)-1));
|
90
|
calendar.add(Calendar.MINUTE, -59);
|
91
|
calendar.add(Calendar.SECOND, -59);
|
92
|
Date date = calendar.getTime();
|
93
|
String dateFrom=(format.format(date));
|
94
|
|
95
|
logger.debug("Sending emails for project claims between " + dateFrom + " and "+dateTo);
|
96
|
|
97
|
try {
|
98
|
// Get all claims between dateFrom and dateTo which satisfy source_type == "project" or target_type == "project"
|
99
|
claims = fetchClaimHandler.fetchClaimsByDate(dateFrom, dateTo, null, null, "", "source", true, types, false);
|
100
|
} catch (SQLStoreException|Exception e) {
|
101
|
logger.error("Could not fetch claims by date from "+dateFrom+" to "+dateTo, e);
|
102
|
}
|
103
|
|
104
|
for (Claim claim: claims) {
|
105
|
if (claim.getSourceType().equals("project")) {
|
106
|
project = (Project)claim.getSource();
|
107
|
} else {
|
108
|
project = (Project)claim.getTarget();
|
109
|
}
|
110
|
|
111
|
if (!managersOfProject.containsKey(project.getOpenaireId())) {
|
112
|
|
113
|
// specialRecipients are used currently for testing purposes
|
114
|
List<String> tmpManagers = null;
|
115
|
if (specialRecipients != null && !specialRecipients.isEmpty()) {
|
116
|
tmpManagers = new ArrayList<>(Arrays.asList(specialRecipients.split("\\s*,\\s*")));
|
117
|
logger.debug("Special recipients: " + specialRecipients);
|
118
|
|
119
|
if(tmpManagers != null) {
|
120
|
Iterator itr = tmpManagers.iterator();
|
121
|
while (itr.hasNext()) {
|
122
|
String manager = (String) itr.next();
|
123
|
Notification notification = null;
|
124
|
try {
|
125
|
notification = fetchNotificationHandler.fetchNotification(project.getOpenaireId(), manager);
|
126
|
} catch (Exception e) {
|
127
|
e.printStackTrace();
|
128
|
} catch (SQLStoreException e) {
|
129
|
e.printStackTrace();
|
130
|
}
|
131
|
if (notification != null) {
|
132
|
itr.remove();
|
133
|
}
|
134
|
}
|
135
|
}
|
136
|
|
137
|
managersOfProject.put(project.getOpenaireId(), tmpManagers);
|
138
|
}
|
139
|
|
140
|
// Send emails to actual project managers instead of special recipients
|
141
|
List<String> managers = null;
|
142
|
try {
|
143
|
managers = fetchProjectHandler.fetchContactEmailsByProjectId(project.getOpenaireId());
|
144
|
logger.debug("All actual Managers of project " + project.getOpenaireId() + ": "+managers);
|
145
|
|
146
|
if(managers != null) {
|
147
|
Iterator itr = managers.iterator();
|
148
|
while (itr.hasNext()) {
|
149
|
String manager = (String) itr.next();
|
150
|
Notification notification = fetchNotificationHandler.fetchNotification(project.getOpenaireId(), manager);
|
151
|
//if (notification != null && (!notification.isNotify() || notification.getFrequency() != 24)) {
|
152
|
if (notification != null) {
|
153
|
itr.remove();
|
154
|
}
|
155
|
}
|
156
|
}
|
157
|
} catch (Exception e) {
|
158
|
e.printStackTrace();
|
159
|
} catch (SQLStoreException e) {
|
160
|
e.printStackTrace();
|
161
|
}
|
162
|
|
163
|
logger.debug("Managers of project (not in notification table) " + project.getOpenaireId() + ": "+managers);
|
164
|
/*
|
165
|
managersOfProject.put(project.getOpenaireId(), managers);
|
166
|
*/
|
167
|
|
168
|
if (managersOfProject.get(project.getOpenaireId()) != null &&
|
169
|
!managersOfProject.get(project.getOpenaireId()).isEmpty()) {
|
170
|
send(project.getOpenaireId(), project.getName(), "project", managersOfProject.get(project.getOpenaireId()));
|
171
|
}
|
172
|
}
|
173
|
}
|
174
|
}
|
175
|
|
176
|
public void defaultEmails_For_CommunityClaims(String dateTo, SimpleDateFormat format) {
|
177
|
Map<String, List<String>> managersOfCommunity = new HashMap<String, List<String>>();
|
178
|
Context context;
|
179
|
List<Claim> claims = null;
|
180
|
List<String> types = new ArrayList<String>();
|
181
|
|
182
|
types.add(ClaimUtils.CONTEXT);
|
183
|
|
184
|
Calendar calendar = Calendar.getInstance();
|
185
|
calendar.add(Calendar.HOUR_OF_DAY, -(Integer.parseInt(defaultFrequencyInHours)-1));
|
186
|
calendar.add(Calendar.MINUTE, -59);
|
187
|
calendar.add(Calendar.SECOND, -59);
|
188
|
Date date = calendar.getTime();
|
189
|
String dateFrom=(format.format(date));
|
190
|
|
191
|
List<String> enabledCommunitiesList = null;
|
192
|
if (enabledCommunities != null && !enabledCommunities.isEmpty()) {
|
193
|
enabledCommunitiesList = Arrays.asList(enabledCommunities.split("\\s*,\\s*"));
|
194
|
}
|
195
|
|
196
|
logger.debug("Sending emails for community claims between " + dateFrom + " and "+dateTo);
|
197
|
|
198
|
try {
|
199
|
// Get all claims between dateFrom and dateTo which satisfy source_type == "context" or target_type == "context"
|
200
|
claims = fetchClaimHandler.fetchClaimsByDate(dateFrom, dateTo, null, null, "", "source", true, types, false);
|
201
|
} catch (SQLStoreException|Exception e) {
|
202
|
logger.error("Could not fetch claims by date from "+dateFrom+" to "+dateTo, e);
|
203
|
}
|
204
|
|
205
|
for (Claim claim: claims) {
|
206
|
if (claim.getSourceType().equals("context")) {
|
207
|
context = (Context)claim.getSource();
|
208
|
} else {
|
209
|
context = (Context)claim.getTarget();
|
210
|
}
|
211
|
|
212
|
String openaireId = context.getOpenaireId().split("::")[0];
|
213
|
if (!managersOfCommunity.containsKey(openaireId) && enabledCommunitiesList != null && enabledCommunitiesList.contains(openaireId)) {
|
214
|
|
215
|
/*
|
216
|
// specialRecipients are used currently for testing purposes
|
217
|
List<String> tmpManagers = null;
|
218
|
if (specialRecipients != null && !specialRecipients.isEmpty()) {
|
219
|
tmpManagers = Arrays.asList(specialRecipients.split("\\s*,\\s*"));
|
220
|
logger.debug("Special recipients: " + specialRecipients);
|
221
|
managersOfCommunity.put(openaireId, tmpManagers);
|
222
|
}
|
223
|
*/
|
224
|
|
225
|
|
226
|
// Send emails to actual project managers instead of special recipients
|
227
|
List<String> managers = null;
|
228
|
try {
|
229
|
//CommunityUtils communityInfo = this.communityUtils.getCommunityInfo(openaireId);
|
230
|
List<ManagerUtils> managerUtils = this.managerUtils.getManagersByEmail(openaireId);
|
231
|
//managers = communityInfo.getManagers();
|
232
|
if(managerUtils != null) {
|
233
|
Iterator<ManagerUtils> itr = managerUtils.iterator();
|
234
|
while (itr.hasNext()) {
|
235
|
String manager = (String) itr.next().getEmail();
|
236
|
Notification notification = fetchNotificationHandler.fetchNotification(openaireId, manager);
|
237
|
if (notification != null) {
|
238
|
itr.remove();
|
239
|
} else {
|
240
|
if(managers == null) {
|
241
|
managers = new ArrayList<>();
|
242
|
}
|
243
|
managers.add(manager);
|
244
|
logger.debug("Sending email to community manager: "+ manager);
|
245
|
}
|
246
|
}
|
247
|
}
|
248
|
else {
|
249
|
logger.debug("Community Managers: null");
|
250
|
}
|
251
|
} catch (Exception e) {
|
252
|
e.printStackTrace();
|
253
|
} catch (SQLStoreException e) {
|
254
|
e.printStackTrace();
|
255
|
}
|
256
|
|
257
|
logger.debug("Managers of community " + openaireId + ": "+managers);
|
258
|
managersOfCommunity.put(openaireId, managers);
|
259
|
|
260
|
|
261
|
if (managersOfCommunity.get(openaireId) != null &&
|
262
|
!managersOfCommunity.get(openaireId).isEmpty()) {
|
263
|
send(openaireId, context.getTitle().split(">")[0], "community", managersOfCommunity.get(openaireId));
|
264
|
}
|
265
|
} else if(enabledCommunitiesList == null || !enabledCommunitiesList.contains(openaireId)) {
|
266
|
logger.debug("Community "+openaireId+" is not enabled");
|
267
|
}
|
268
|
}
|
269
|
}
|
270
|
|
271
|
public void notificationEmails_For_ProjectClaims(String dateTo, SimpleDateFormat format) {
|
272
|
Project project = null;
|
273
|
List<String> types = new ArrayList<String>();
|
274
|
|
275
|
types.add(ClaimUtils.PROJECT);
|
276
|
|
277
|
logger.debug("Sending email for project claims from notification table");
|
278
|
|
279
|
try {
|
280
|
List<Notification> trueNotifications = fetchNotificationHandler.fetchTrueNotifications();
|
281
|
logger.debug(trueNotifications);
|
282
|
if(trueNotifications != null) {
|
283
|
for(Notification notification : trueNotifications) {
|
284
|
List<String> managers = fetchProjectHandler.fetchContactEmailsByProjectId(notification.getOpenaireId());
|
285
|
if(managers != null && managers.contains(notification.getUserMail())) {
|
286
|
|
287
|
Date _dateTo = format.parse(dateTo);
|
288
|
|
289
|
Date _last_interaction_date = notification.getDate();
|
290
|
Calendar cal = Calendar.getInstance();
|
291
|
cal.setTime(_last_interaction_date);
|
292
|
cal.add(Calendar.SECOND, 1);
|
293
|
_last_interaction_date = cal.getTime();
|
294
|
|
295
|
String last_interaction_date = (format.format(_last_interaction_date));
|
296
|
|
297
|
long diff = _dateTo.getTime() - notification.getDate().getTime();
|
298
|
diff = diff / 1000;
|
299
|
|
300
|
if (diff >= (notification.getFrequency() * 3600)) {
|
301
|
if (fetchClaimHandler.fetchNumberOfClaimsByDateAndOpenaireId(last_interaction_date, dateTo, notification.getOpenaireId(), null, null, "", null, true, types, false) > 0) {
|
302
|
List<String> managersByNotification = new ArrayList<>();
|
303
|
managersByNotification.add(notification.getUserMail());
|
304
|
|
305
|
project = fetchProjectHandler.fetchProjectById(notification.getOpenaireId());
|
306
|
|
307
|
logger.debug("Sending email for project claims between " + last_interaction_date + " and " + dateTo + " to " + notification.getUserMail());
|
308
|
|
309
|
send(project.getOpenaireId(), project.getName(), "project", managersByNotification);
|
310
|
}
|
311
|
|
312
|
notificationHandler.updateNotificationLastInteractionDate(notification.getOpenaireId(), notification.getUserMail(), _dateTo);
|
313
|
}
|
314
|
} else {
|
315
|
logger.debug("managers do not contain "+notification.getUserMail());
|
316
|
}
|
317
|
}
|
318
|
} else {
|
319
|
logger.debug("true notifications: null");
|
320
|
}
|
321
|
} catch (Exception e) {
|
322
|
e.printStackTrace();
|
323
|
} catch (SQLStoreException e) {
|
324
|
e.printStackTrace();
|
325
|
}
|
326
|
}
|
327
|
|
328
|
public void notificationEmails_For_CommunityClaims(String dateTo, SimpleDateFormat format) {
|
329
|
Context context = null;
|
330
|
List<String> types = new ArrayList<String>();
|
331
|
|
332
|
types.add(ClaimUtils.CONTEXT);
|
333
|
|
334
|
List<String> enabledCommunitiesList = null;
|
335
|
if (enabledCommunities != null && !enabledCommunities.isEmpty()) {
|
336
|
enabledCommunitiesList = Arrays.asList(enabledCommunities.split("\\s*,\\s*"));
|
337
|
}
|
338
|
|
339
|
logger.debug("Sending email for community claims from notification table");
|
340
|
|
341
|
try {
|
342
|
List<Notification> trueNotifications = fetchNotificationHandler.fetchTrueNotifications();
|
343
|
|
344
|
Map<String, List<String>> allManagers = new HashMap<>();
|
345
|
|
346
|
if(trueNotifications != null) {
|
347
|
for(Notification notification : trueNotifications) {
|
348
|
if (enabledCommunitiesList != null && enabledCommunitiesList.contains(notification.getOpenaireId())) {
|
349
|
|
350
|
if(!allManagers.containsKey(notification.getOpenaireId())) {
|
351
|
allManagers.put(notification.getOpenaireId(), new ArrayList());
|
352
|
|
353
|
// CommunityUtils communityInfo = this.communityUtils.getCommunityInfo(notification.getOpenaireId());
|
354
|
List<ManagerUtils> managerUtils = this.managerUtils.getManagersByEmail(notification.getOpenaireId());
|
355
|
|
356
|
// List<String> managers = null;
|
357
|
if (managerUtils != null) {
|
358
|
for (ManagerUtils manager : managerUtils) {
|
359
|
allManagers.get(notification.getOpenaireId()).add(manager.getEmail());
|
360
|
}
|
361
|
}
|
362
|
}
|
363
|
|
364
|
|
365
|
// if (managers != null && managers.contains(notification.getUserMail())) {
|
366
|
if(allManagers.get(notification.getOpenaireId()).contains(notification.getUserMail())) {
|
367
|
Date _dateTo = format.parse(dateTo);
|
368
|
|
369
|
Date _last_interaction_date = notification.getDate();
|
370
|
Calendar cal = Calendar.getInstance();
|
371
|
cal.setTime(_last_interaction_date);
|
372
|
cal.add(Calendar.SECOND, 1);
|
373
|
_last_interaction_date = cal.getTime();
|
374
|
|
375
|
String last_interaction_date = (format.format(_last_interaction_date));
|
376
|
long diff = _dateTo.getTime() - notification.getDate().getTime();
|
377
|
diff = diff / 1000;
|
378
|
|
379
|
if (diff >= (notification.getFrequency() * 3600)) {
|
380
|
if (fetchClaimHandler.fetchNumberOfClaimsByDateAndOpenaireId(last_interaction_date, dateTo, notification.getOpenaireId(), null, null, "", null, true, types, false) > 0) {
|
381
|
List<String> managersByNotification = new ArrayList<>();
|
382
|
managersByNotification.add(notification.getUserMail());
|
383
|
|
384
|
// We need that to get name of community
|
385
|
context = fetchContextHandler.fetchFirstContextByCommunityId(notification.getOpenaireId());
|
386
|
|
387
|
logger.debug("Sending email for community claims between " + last_interaction_date + " and " + dateTo + " to " + notification.getUserMail());
|
388
|
|
389
|
send(context.getOpenaireId().split("::")[0], context.getTitle().split(">")[0], "community", managersByNotification);
|
390
|
}
|
391
|
|
392
|
notificationHandler.updateNotificationLastInteractionDate(notification.getOpenaireId(), notification.getUserMail(), _dateTo);
|
393
|
} else {
|
394
|
logger.debug("[no notification] User "+notification.getUserMail()+" got latest notification at "+last_interaction_date+" and has set frequency to: "+notification.getFrequency());
|
395
|
}
|
396
|
} else {
|
397
|
logger.debug("User "+notification.getUserMail()+" is not manager of community "+notification.getOpenaireId());
|
398
|
}
|
399
|
} else {
|
400
|
logger.debug("Community "+notification.getOpenaireId()+" is not enabled");
|
401
|
}
|
402
|
}
|
403
|
}
|
404
|
} catch (Exception e) {
|
405
|
e.printStackTrace();
|
406
|
} catch (SQLStoreException e) {
|
407
|
e.printStackTrace();
|
408
|
}
|
409
|
}
|
410
|
|
411
|
public void send(String openaire_id, String openaire_name, String type, List<String> managers) {
|
412
|
logger.debug("Sending email");
|
413
|
String openaireClaimsPageUrl = "";
|
414
|
String manageUserNotificationsPage = "";
|
415
|
String messageContent = "";
|
416
|
String subject = "";
|
417
|
|
418
|
if(type.equals("project")) {
|
419
|
openaireClaimsPageUrl = openaireProjectClaimsPage + openaire_id;
|
420
|
|
421
|
subject = "[OpenAIRE] Links notification";
|
422
|
messageContent = "There are new Claims for: '" + openaire_name +"' project for which you seem to be a contact person." +
|
423
|
"<br>Click <a href=\""+openaireClaimsPageUrl+"\">here</a> to curate these Claims.";
|
424
|
} else if(type.equals("community")) {
|
425
|
openaireClaimsPageUrl = openaireCommunityClaimsPage + openaire_id;
|
426
|
manageUserNotificationsPage = manageCommunityUserNotificationsPage + openaire_id;
|
427
|
|
428
|
subject = "[OpenAIRE-Connect] "+openaire_name+": Links notification";
|
429
|
messageContent =
|
430
|
" <div style=\"font-size:14px;\">" +
|
431
|
" <p>" +
|
432
|
" There are new links for '"+openaire_name+"' community. Click <a href=\""+openaireClaimsPageUrl+"\">here</a> to view the links.\n" +
|
433
|
" </p>" +
|
434
|
" <p>OpenAIRE team<br/>" +
|
435
|
" <a href=\"https://www.openaire.eu\">www.openaire.eu</a>" +
|
436
|
" </p>" +
|
437
|
" <p style=\"font-size:11px;\">You are receiving this e-mail as manager of the community <a href=\"https://"+openaire_id+".openaire.eu\">"+openaire_name+"</a>." +
|
438
|
" If you are not responsible for this community, please <a href=\"mailto:"+contactMail+"\">contact us</a>." +
|
439
|
" <br/>" +
|
440
|
" Click <a href=\""+manageUserNotificationsPage+"\">here</a> to manage your notification settings. </p>" +
|
441
|
" </div>"
|
442
|
;
|
443
|
}
|
444
|
|
445
|
//logger.debug(messageContent);
|
446
|
|
447
|
// Get system properties
|
448
|
Properties properties = System.getProperties();
|
449
|
properties.setProperty("mail.smtp.host", host);
|
450
|
properties.put("mail.smtp.port", port);
|
451
|
properties.put("mail.smtp.auth", auth); //enable authentication
|
452
|
properties.put("mail.smtp.starttls.enable", "true");
|
453
|
|
454
|
Session session = Session.getInstance(properties,
|
455
|
new javax.mail.Authenticator() {
|
456
|
protected PasswordAuthentication getPasswordAuthentication() {
|
457
|
return new PasswordAuthentication(username, password);
|
458
|
}
|
459
|
});
|
460
|
|
461
|
try {
|
462
|
// Create a default MimeMessage object.
|
463
|
MimeMessage message = new MimeMessage(session);
|
464
|
|
465
|
// Set From: header field of the header.
|
466
|
message.setFrom(new InternetAddress(from));
|
467
|
|
468
|
// Set To: header field of the header.
|
469
|
for(String to : managers) {
|
470
|
logger.debug(to);
|
471
|
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
|
472
|
}
|
473
|
message.addRecipient(Message.RecipientType.BCC, new InternetAddress("openaire.test@gmail.com"));
|
474
|
|
475
|
// Set Subject: header field
|
476
|
message.setSubject(subject);
|
477
|
|
478
|
// For simple text setText() can be used instead of setContent()
|
479
|
|
480
|
// Send the actual HTML message, as big as you like
|
481
|
message.setContent(messageContent, "text/html");
|
482
|
|
483
|
// Send message
|
484
|
Transport.send(message);
|
485
|
logger.debug("Sent message successfully....\n");
|
486
|
|
487
|
} catch (AddressException ae) {
|
488
|
logger.error("Email could not be send.", ae);
|
489
|
|
490
|
} catch (MessagingException me) {
|
491
|
logger.error("Email could not be send.", me);
|
492
|
}
|
493
|
}
|
494
|
|
495
|
public void setFetchClaimHandler(FetchClaimHandler fetchClaimHandler) {
|
496
|
this.fetchClaimHandler = fetchClaimHandler;
|
497
|
}
|
498
|
|
499
|
public void setFetchProjectHandler(FetchProjectHandler fetchProjectHandler) {
|
500
|
this.fetchProjectHandler = fetchProjectHandler;
|
501
|
}
|
502
|
|
503
|
public void setFetchNotificationHandler(FetchNotificationHandler fetchNotificationHandler) {
|
504
|
this.fetchNotificationHandler = fetchNotificationHandler;
|
505
|
}
|
506
|
|
507
|
public void setNotificationHandler(NotificationHandler notificationHandler) {
|
508
|
this.notificationHandler = notificationHandler;
|
509
|
}
|
510
|
|
511
|
public void setFetchContextHandler(FetchContextHandler fetchContextHandler) {
|
512
|
this.fetchContextHandler = fetchContextHandler;
|
513
|
}
|
514
|
|
515
|
public void setOpenaireProjectClaimsPage(String openaireProjectClaimsPage) {
|
516
|
EmailSender.openaireProjectClaimsPage = openaireProjectClaimsPage;
|
517
|
}
|
518
|
|
519
|
public void setOpenaireCommunityClaimsPage(String openaireCommunityClaimsPage) {
|
520
|
EmailSender.openaireCommunityClaimsPage = openaireCommunityClaimsPage;
|
521
|
}
|
522
|
|
523
|
public void setManageCommunityUserNotificationsPage(String manageCommunityUserNotificationsPage) {
|
524
|
EmailSender.manageCommunityUserNotificationsPage = manageCommunityUserNotificationsPage;
|
525
|
}
|
526
|
|
527
|
public void setUsername(String username) {
|
528
|
EmailSender.username = username;
|
529
|
}
|
530
|
|
531
|
public void setPassword(String password) {
|
532
|
EmailSender.password = password;
|
533
|
}
|
534
|
|
535
|
public void setHost(String host) {
|
536
|
EmailSender.host = host;
|
537
|
}
|
538
|
|
539
|
public void setPort(String port) {
|
540
|
EmailSender.port = port;
|
541
|
}
|
542
|
|
543
|
public void setFrom(String from) {
|
544
|
EmailSender.from = from;
|
545
|
}
|
546
|
|
547
|
public void setAuth(String auth) {
|
548
|
EmailSender.auth = auth;
|
549
|
}
|
550
|
|
551
|
public void setContactMail(String contactMail) { EmailSender.contactMail = contactMail; }
|
552
|
|
553
|
public void setSpecialRecipients(String specialRecipients) {
|
554
|
EmailSender.specialRecipients = specialRecipients;
|
555
|
}
|
556
|
|
557
|
public void setDefaultFrequencyInHours(String defaultFrequencyInHours) {
|
558
|
this.defaultFrequencyInHours = defaultFrequencyInHours;
|
559
|
}
|
560
|
|
561
|
public void setEnabledCommunities(String enabledCommunities) {
|
562
|
EmailSender.enabledCommunities = enabledCommunities;
|
563
|
}
|
564
|
|
565
|
public static boolean isNotifyCommunityManagers() {
|
566
|
return notifyCommunityManagers;
|
567
|
}
|
568
|
|
569
|
public static void setNotifyCommunityManagers(boolean notifyCommunityManagers) {
|
570
|
EmailSender.notifyCommunityManagers = notifyCommunityManagers;
|
571
|
}
|
572
|
|
573
|
public static boolean isNotifyProjectManagers() {
|
574
|
return notifyProjectManagers;
|
575
|
}
|
576
|
|
577
|
public static void setNotifyProjectManagers(boolean notifyProjectManagers) {
|
578
|
EmailSender.notifyProjectManagers = notifyProjectManagers;
|
579
|
}
|
580
|
|
581
|
// public void setCommunityUtils(CommunityUtils communityUtils) {
|
582
|
// this.communityUtils = communityUtils;
|
583
|
// }
|
584
|
//
|
585
|
// public CommunityUtils getCommunityUtils() {
|
586
|
// return communityUtils;
|
587
|
// }
|
588
|
|
589
|
|
590
|
public ManagerUtils getManagerUtils() {
|
591
|
return managerUtils;
|
592
|
}
|
593
|
|
594
|
public void setManagerUtils(ManagerUtils managerUtils) {
|
595
|
this.managerUtils = managerUtils;
|
596
|
}
|
597
|
}
|