Exemplo n.º 1
0
  @Override
  public EmailMessage format(Notification notif) {
    if (!"issue-changes".equals(notif.getType())) {
      return null;
    }

    StringBuilder sb = new StringBuilder();
    appendHeader(notif, sb);
    sb.append(NEW_LINE);
    appendChanges(notif, sb);
    sb.append(NEW_LINE);
    appendFooter(sb, notif);

    String projectName = notif.getFieldValue("projectName");
    String issueKey = notif.getFieldValue("key");
    String author = notif.getFieldValue("changeAuthor");

    EmailMessage message =
        new EmailMessage()
            .setMessageId("issue-changes/" + issueKey)
            .setSubject(projectName + ", change on issue #" + issueKey)
            .setMessage(sb.toString());
    if (author != null) {
      message.setFrom(getUserFullName(author));
    }
    return message;
  }
Exemplo n.º 2
0
  @Override
  public EmailMessage format(Notification notification) {
    if (!"review-changed".equals(notification.getType())) {
      return null;
    }
    String reviewId = notification.getFieldValue("reviewId");
    String author = notification.getFieldValue("author");
    StringBuilder sb = new StringBuilder();

    append(sb, "Project", null, notification.getFieldValue("project"));
    append(sb, "Resource", null, notification.getFieldValue("resource"));
    sb.append('\n');
    append(sb, null, null, notification.getFieldValue("title"));
    sb.append('\n');
    append(
        sb,
        "Status",
        notification.getFieldValue("old.status"),
        notification.getFieldValue("new.status"));
    append(
        sb,
        "Resolution",
        notification.getFieldValue("old.resolution"),
        notification.getFieldValue("new.resolution"));
    append(
        sb,
        "Assignee",
        getUserFullName(notification.getFieldValue("old.assignee")),
        getUserFullName(notification.getFieldValue("new.assignee")));
    appendComment(sb, notification);
    appendFooter(sb, notification);

    EmailMessage message =
        new EmailMessage()
            .setMessageId("review/" + reviewId)
            .setSubject("Review #" + reviewId)
            .setMessage(sb.toString());
    if (author != null) {
      message.setFrom(getUserFullName(author));
    }
    return message;
  }