Esempio n. 1
0
  private void writeChangelog(Issue issue, JsonWriter json) {
    json.name("changelog")
        .beginArray()
        .beginObject()
        .prop("creationDate", DateUtils.formatDateTime(issue.creationDate()))
        .prop("fCreationDate", formatDate(issue.creationDate()))
        .name("diffs")
        .beginArray()
        .value(i18n.message(UserSession.get().locale(), "created", null))
        .endArray()
        .endObject();

    IssueChangelog changelog = issueChangelogService.changelog(issue);
    for (FieldDiffs diffs : changelog.changes()) {
      String userLogin = diffs.userLogin();
      json.beginObject()
          .prop("userName", userLogin != null ? changelog.user(diffs).name() : null)
          .prop("creationDate", DateUtils.formatDateTime(diffs.creationDate()))
          .prop("fCreationDate", formatDate(diffs.creationDate()));
      json.name("diffs").beginArray();
      List<String> diffsFormatted = issueChangelogService.formatDiffs(diffs);
      for (String diff : diffsFormatted) {
        json.value(diff);
      }
      json.endArray();
      json.endObject();
    }
    json.endArray();
  }