@Override public TaskExec storeExec(final TaskExec execution) { NotificationTask task = taskDAO.find(execution.getTask().getKey()); task.add(execution); task.setExecuted(true); taskDAO.save(task); return execution; }
@Override public long countExecutionsWithStatus(final String taskKey, final String status) { NotificationTask task = taskDAO.find(taskKey); long count = 0; for (TaskExec taskExec : task.getExecs()) { if (status == null) { if (taskExec.getStatus() == null) { count++; } } else if (status.equals(taskExec.getStatus())) { count++; } } return count; }
if (StringUtils.isBlank(task.getSubject()) || task.getRecipients().isEmpty() || StringUtils.isBlank(task.getHtmlBody()) || StringUtils.isBlank(task.getTextBody())) { + task.getRecipients() + "\n" + task.getSender() + "\n" + task.getSubject() + "\n" + task.getHtmlBody() + "\n" + task.getTextBody(); LOG.error(message); if (task.getTraceLevel().ordinal() >= TraceLevel.FAILURES.ordinal()) { execution.setMessage(message); if (LOG.isDebugEnabled()) { LOG.debug("About to send e-mails:\n" + task.getRecipients() + "\n" + task.getSender() + "\n" + task.getSubject() + "\n" + task.getHtmlBody() + "\n" + task.getTextBody() + "\n"); status.set("Sending notifications to " + task.getRecipients()); for (String to : task.getRecipients()) { try { MimeMessage message = mailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true); helper.setTo(to); helper.setFrom(task.getSender());
NotificationTaskTO notificationTaskTO = (NotificationTaskTO) taskTO; notificationTaskTO.setNotification(notificationTask.getNotification().getKey()); notificationTaskTO.setAnyTypeKind(notificationTask.getAnyTypeKind()); notificationTaskTO.setEntityKey(notificationTask.getEntityKey()); notificationTaskTO.setSender(notificationTask.getSender()); notificationTaskTO.getRecipients().addAll(notificationTask.getRecipients()); notificationTaskTO.setSubject(notificationTask.getSubject()); notificationTaskTO.setHtmlBody(notificationTask.getHtmlBody()); notificationTaskTO.setTextBody(notificationTask.getTextBody()); notificationTaskTO.setExecuted(notificationTask.isExecuted()); if (notificationTask.isExecuted() && StringUtils.isBlank(taskTO.getLatestExecStatus())) { taskTO.setLatestExecStatus("[EXECUTED]"); notificationTaskTO.setTraceLevel(notificationTask.getTraceLevel()); break;
task.setNotification(notification); if (any != null) { task.setEntityKey(any.getKey()); task.setAnyTypeKind(any.getType().getKind()); task.setTraceLevel(notification.getTraceLevel()); task.getRecipients().addAll(recipientEmails); task.setSender(notification.getSender()); task.setSubject(notification.getSubject()); task.setTextBody(evaluate(notification.getTemplate().getTextTemplate(), jexlVars)); task.setHtmlBody(evaluate(notification.getTemplate().getHTMLTemplate(), jexlVars));