/** * Get the subject for the email. * * @param event * The event that matched criteria to cause the notification. * @return the subject for the email. */ protected String getSubject(Event event) { return findHeaderValue("Subject", getHeaders(event)); }
/** * Find the header value whose name matches with the header parameter * * @param header * The header to find. * @param headers * The list of full header lines. * @return The header line found or null if not found. */ protected String findHeaderValue(String header, List headers) { String line = findHeader(header, headers); if (line == null) return null; String value = line.substring(header.length() + 2); return value; }
@Override public NotificationAction getClone() { // TODO Auto-generated method stub return super.getClone(); }
/** * Format a From: respecting the notification service replyable configuration * * @param event * @return */ protected String getFrom(Event event) { if (NotificationService.isNotificationFromReplyable()) { // from user display name <email> return "From: " + getFromEventUser(event); } else { // from the general service, no reply return "From: " + getFromService(); } }
List recipients = getRecipients(event); List immediate = immediateRecipients(recipients, notificationId, resourceFilter, eventPriority, event); List digest = digestRecipients(recipients, notificationId, resourceFilter, eventPriority, event); List headers = getHeaders(event); String message = getMessage(event); String message = plainTextContent(event); String item = findHeader("From", headers); if (item != null) messageForDigest.append(item+"\n"); item = findHeader("Date", headers); if (item != null) item = findHeader("To", headers); if (item != null) messageForDigest.append(item+"\n"); item = findHeader("Cc", headers); if (item != null) messageForDigest.append(item+"\n"); item = findHeader("Subject", headers); if (item != null) messageForDigest.append(item+"\n"); DigestService.digest(user.getId(), findHeaderValue("Subject", headers), messageForDigest.toString());
int option = getOption(user, notificationId, resourceFilter, eventPriority, event); if (isImmediateDeliveryOption(option, resourceFilter))
@Override protected List<String> getHeaders(Event event) { List<String> rv = super.getHeaders(event); // the Subject rv.add("Subject: " + getSubject(event)); // from rv.add(getFrom(event)); // to List toList = getRecipients(event); Iterator itr = toList.iterator(); StringBuilder recips = new StringBuilder(); while (itr.hasNext()) { User usr = (User) itr.next(); recips.append(usr.getEmail() + ", "); } rv.add("To: " + recips.toString()); return rv; }
int option = getOption(user, notificationId, resourceFilter, eventPriority, event);
/** * Filter the recipients Users into the list of those who get this one by digest. Combine the * event's notification priority with the user's notification profile. Alias call to * {@link digestRecipients(List, String, String, int)} * * @param recipients * The List (User) of potential recipients. * @param notification * The notification responding to the event. * @param event * The event that matched criteria to cause the notification. * @return The List (User) of digest recipients. */ protected List digestRecipients(List recipients, Notification notification, Event event) { return digestRecipients(recipients, notification.getId(), notification.getResourceFilter(), event.getPriority(), event); }
/** * Get the user's notification option for this... one of the NotificationService's PREF_ settings */ protected int getOption(User user, Notification notification, Event event) { return getOption(user, notification.getId(), notification.getResourceFilter(), event .getPriority(), event); }