コード例 #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;
  }
コード例 #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;
  }
コード例 #3
0
  @Override
  public EmailMessage format(Notification notification) {
    if (shouldNotFormat(notification)) {
      return null;
    }
    String projectName = checkNotNull(notification.getFieldValue(FIELD_PROJECT_NAME));

    StringBuilder message = new StringBuilder();
    message.append("Project: ").append(projectName).append(NEW_LINE).append(NEW_LINE);
    appendSeverity(message, notification);
    appendAssignees(message, notification);
    appendRules(message, notification);
    appendTags(message, notification);
    appendComponents(message, notification);
    appendFooter(message, notification);

    return new EmailMessage()
        .setMessageId(notification.getType() + "/" + notification.getFieldValue(FIELD_PROJECT_KEY))
        .setSubject(subject(notification, projectName))
        .setMessage(message.toString());
  }