Date dateEnd = calendarEnd.getTime();
List<Call> calls = callService.findScheduleCalls(new Date());
for (Call call : calls) {
Date startDate = call.getStart_date();
ReminderOption reminderOption = call.getReminder_option_email();
String value = reminderOption.getValue();
if (!CommonUtil.isNullOrEmpty(value)) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(startDate);
calendar.add(Calendar.MINUTE, -Integer.parseInt(value));
Date dueDateTime = calendar.getTime();
if (dueDateTime.after(now) && dueDateTime.before(dateEnd)) {
Timer timer = new Timer();
MailTimerTask task = new MailTimerTask();
task.setMailService(mailService);
task.setEmailTemplateService(emailTemplateService);
task.setCall(call);
timer.schedule(task, dueDateTime);
}
}
}
List<Meeting> meetings = meetingService
.findScheduleMeetings(new Date());
for (Meeting meeting : meetings) {
Date startDate = meeting.getStart_date();
ReminderOption reminderOption = meeting.getReminder_option_email();
String value = reminderOption.getValue();
if (!CommonUtil.isNullOrEmpty(value)) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(startDate);
calendar.add(Calendar.MINUTE, -Integer.parseInt(value));
Date dueDateTime = calendar.getTime();