Improved review reporter code.
This commit is contained in:
parent
1e8f06f373
commit
95c12449d1
@ -40,19 +40,6 @@ public class ReviewReporter
|
||||
|
||||
private static final int LENGTH_LINE = 80;
|
||||
|
||||
/**
|
||||
* Adds the.
|
||||
*
|
||||
* @param buffer
|
||||
* the buffer
|
||||
* @param content
|
||||
* the content
|
||||
*/
|
||||
private static void add(final StringList buffer, final String content)
|
||||
{
|
||||
buffer.append(content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the center.
|
||||
*
|
||||
@ -73,12 +60,12 @@ public class ReviewReporter
|
||||
* the buffer
|
||||
* @param content
|
||||
* the content
|
||||
* @param c
|
||||
* @param letter
|
||||
* the c
|
||||
*/
|
||||
private static void addCenter(final StringList buffer, final String content, final char c)
|
||||
private static void addCenter(final StringList buffer, final String content, final char letter)
|
||||
{
|
||||
buffer.append(getLine(content, c));
|
||||
buffer.appendln(getLine(content, letter));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -91,7 +78,7 @@ public class ReviewReporter
|
||||
*/
|
||||
private static void addChunk(final StringList buffer, final String content)
|
||||
{
|
||||
add(buffer, chunk(content));
|
||||
appendln(buffer, chunk(content));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -102,7 +89,7 @@ public class ReviewReporter
|
||||
*/
|
||||
private static void addEmpty(final StringList buffer)
|
||||
{
|
||||
buffer.append("\n");
|
||||
buffer.appendln();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,7 +102,33 @@ public class ReviewReporter
|
||||
*/
|
||||
private static void addLine(final StringList buffer, final char c)
|
||||
{
|
||||
buffer.append(getLine(c));
|
||||
buffer.append(getLine(c)).appendln();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the.
|
||||
*
|
||||
* @param buffer
|
||||
* the buffer
|
||||
* @param content
|
||||
* the content
|
||||
*/
|
||||
private static void append(final StringList buffer, final String content)
|
||||
{
|
||||
buffer.append(content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Appendln.
|
||||
*
|
||||
* @param buffer
|
||||
* the buffer
|
||||
* @param content
|
||||
* the content
|
||||
*/
|
||||
private static void appendln(final StringList buffer, final String content)
|
||||
{
|
||||
buffer.appendln(content);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -140,11 +153,11 @@ public class ReviewReporter
|
||||
*
|
||||
* @param content
|
||||
* the content
|
||||
* @param length
|
||||
* @param maxLength
|
||||
* the length
|
||||
* @return the string
|
||||
*/
|
||||
private static String chunk(final String content, final int length)
|
||||
private static String chunk(final String content, final int maxLength)
|
||||
{
|
||||
String result;
|
||||
|
||||
@ -154,7 +167,7 @@ public class ReviewReporter
|
||||
|
||||
for (final String word : words)
|
||||
{
|
||||
if (current.length() + word.length() > length)
|
||||
if (current.length() + word.length() > maxLength)
|
||||
{
|
||||
if (buffer.length() > 0)
|
||||
{
|
||||
@ -199,7 +212,7 @@ public class ReviewReporter
|
||||
{
|
||||
String result;
|
||||
|
||||
result = StringUtils.repeat(letter.toString(), LENGTH_LINE) + "\n";
|
||||
result = StringUtils.repeat(letter.toString(), LENGTH_LINE);
|
||||
|
||||
//
|
||||
return result;
|
||||
@ -218,7 +231,7 @@ public class ReviewReporter
|
||||
{
|
||||
String result;
|
||||
|
||||
result = StringUtils.center(" " + content + " ", LENGTH_LINE, letter) + "\n";
|
||||
result = StringUtils.center(" " + content + " ", LENGTH_LINE, letter);
|
||||
|
||||
//
|
||||
return result;
|
||||
@ -235,7 +248,7 @@ public class ReviewReporter
|
||||
{
|
||||
String result;
|
||||
|
||||
result = "=== " + topic.getTitle() + " ===\n";
|
||||
result = "=== " + topic.getTitle() + " ===";
|
||||
|
||||
//
|
||||
return result;
|
||||
@ -256,6 +269,8 @@ public class ReviewReporter
|
||||
|
||||
//
|
||||
StringList buffer = new StringList();
|
||||
|
||||
//
|
||||
addLine(buffer, '=');
|
||||
addCenter(buffer, "Revue de la semaine en cours");
|
||||
addEmpty(buffer);
|
||||
@ -270,7 +285,7 @@ public class ReviewReporter
|
||||
addCenter(buffer, "Participants", '-');
|
||||
for (final String participant : review.getParticipants())
|
||||
{
|
||||
addChunk(buffer, "* " + review.getAliases().getRealName(participant) + "\n");
|
||||
addChunk(buffer, "* " + review.getAliases().getRealName(participant));
|
||||
}
|
||||
|
||||
//
|
||||
@ -287,11 +302,11 @@ public class ReviewReporter
|
||||
if (topic.hasParticipant(participant))
|
||||
{
|
||||
addEmpty(buffer);
|
||||
add(buffer, getTopic(topic));
|
||||
appendln(buffer, getTopic(topic));
|
||||
addEmpty(buffer);
|
||||
for (final Message message : topic.getMessages(participant))
|
||||
{
|
||||
addChunk(buffer, "* " + message.getContent() + "\n");
|
||||
addChunk(buffer, "* " + message.getContent());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -310,7 +325,7 @@ public class ReviewReporter
|
||||
addEmpty(buffer);
|
||||
for (final Message message : topic.getMessages())
|
||||
{
|
||||
addChunk(buffer, "* " + message.getAuthor() + " : " + message.getContent() + "\n");
|
||||
addChunk(buffer, "* " + message.getAuthor() + " : " + message.getContent());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -321,21 +336,21 @@ public class ReviewReporter
|
||||
addEmpty(buffer);
|
||||
for (Message message : review.getMessages())
|
||||
{
|
||||
addChunk(buffer, "* " + message.getAuthor() + " : " + message.getContent() + "\n");
|
||||
addChunk(buffer, "* " + message.getAuthor() + " : " + message.getContent());
|
||||
}
|
||||
|
||||
// Add statistics in text review.
|
||||
addEmpty(buffer);
|
||||
addCenter(buffer, "Statistiques");
|
||||
addEmpty(buffer);
|
||||
addChunk(buffer, ReviewStatsReporter.reportReviewCount(datas) + "\n");
|
||||
addChunk(buffer, "Horaire de début de la revue : " + review.getFormattedStartTime() + "\n");
|
||||
addChunk(buffer, "Horaire de fin de la revue : " + review.getFormattedEndTime() + "\n");
|
||||
addChunk(buffer, "Durée de la revue : " + review.getDurationInMinutes() + " minutes\n");
|
||||
addChunk(buffer, "Nombre de personnes participantes : " + review.getParticipants().size() + "\n");
|
||||
addChunk(buffer, ReviewStatsReporter.reportUserCount(datas, review.getParticipants().size()) + "\n");
|
||||
addChunk(buffer, ReviewStatsReporter.reportNewMaxUserCount(datas, review.getParticipants().size()) + "\n");
|
||||
addChunk(buffer, ReviewStatsReporter.reportDuration(datas, review.getDurationInMinutes()) + "\n");
|
||||
addChunk(buffer, ReviewStatsReporter.reportReviewCount(datas));
|
||||
addChunk(buffer, "Horaire de début de la revue : " + review.getFormattedStartTime());
|
||||
addChunk(buffer, "Horaire de fin de la revue : " + review.getFormattedEndTime());
|
||||
addChunk(buffer, "Durée de la revue : " + review.getDurationInMinutes() + " minutes");
|
||||
addChunk(buffer, "Nombre de personnes participantes : " + review.getParticipants().size());
|
||||
addChunk(buffer, ReviewStatsReporter.reportUserCount(datas, review.getParticipants().size()));
|
||||
addChunk(buffer, ReviewStatsReporter.reportNewMaxUserCount(datas, review.getParticipants().size()));
|
||||
addChunk(buffer, ReviewStatsReporter.reportDuration(datas, review.getDurationInMinutes()));
|
||||
|
||||
//
|
||||
result = buffer.toString();
|
||||
|
Loading…
Reference in New Issue
Block a user