Ejemplo n.º 1
0
  private void writeLogEntry(PrintWriter out, LogEntry logEntry) {
    if (logEntry.getEntriesCount() == 0) {
      return;
    }

    String message = logEntry.getMessage().replace(QUOTE_CHARACTER, QUOTE_SPECIAL_CHARACTER);
    message =
        message.replace(ANGLE_OPENING_BRACKET_CHARACTER, ANGLE_OPENING_BRACKET_SPECIAL_CHARACTER);
    message =
        message.replace(ANGLE_CLOSING_BRACKET_CHARACTER, ANGLE_CLOSING_BRACKET_SPECIAL_CHARACTER);

    out.println(
        MessageFormat.format(
            LOGENTRY_START_NODE,
            new String[] {message, Integer.toString(logEntry.getRevision()), logEntry.getDate()}));

    List<PathEntry> pathEntries = logEntry.getPathEntries();
    for (PathEntry pathEntry : pathEntries) {
      out.println(
          MessageFormat.format(
              PATH_NODE, new String[] {pathEntry.getAction(), pathEntry.getPath()}));
    }

    out.println(LOGENTRY_END_NODE);
  }
Ejemplo n.º 2
0
  private void writeReport(PrintWriter out) {
    out.println(XML_HEADER);
    out.println(REPORT_START_NODE);

    writeSummary(out);

    writeChanges(out);

    out.println(REPORT_END_NODE);
  }
Ejemplo n.º 3
0
  private void writeSummary(PrintWriter out) {
    out.println(SUMMARY_START_NODE);
    out.println(
        MessageFormat.format(
            CHANGES_START_NODE, new String[] {Integer.toString(getLogEntriesCount())}));

    List<String> authors = getAuthors();
    for (String author : authors) {
      out.println(
          MessageFormat.format(
              AUTHOR_SUMMARY_NODE,
              new String[] {
                author,
                Integer.toString(getAuthorLogEntriesCount(author)),
                Integer.toString(getAuthorLogEntriesPercent(author))
              }));
    }

    out.println(CHANGES_END_NODE);
    out.println(SUMMARY_END_NODE);
  }
Ejemplo n.º 4
0
  private void writeChanges(PrintWriter out) {
    List<String> authors = getAuthors();
    for (String author : authors) {
      List<LogEntry> logEntries = getOrderedAuthorLogEntries(author);
      if (logEntries == null || logEntries.isEmpty()) {
        continue;
      }

      out.println(
          MessageFormat.format(
              AUTHOR_START_NODE,
              new String[] {
                author,
                Integer.toString(getAuthorLogEntriesCount(author)),
                Integer.toString(logEntries.size())
              }));

      for (LogEntry logEntry : logEntries) {
        writeLogEntry(out, logEntry);
      }

      out.println(AUTHOR_END_NODE);
    }
  }