}
int rating = newReview.getRating();
String comment = newReview.getReviewText();
boolean anonymous = newReview.getIsAnonymous();
Author author = newReview.getAuthor();
Artifact artifact = collabReview.getRepository().getArtifact(newReview.getArtifactIdentifier());
String articleName = newReview.getArtifactIdentifier().getName();
int mailCount = 3;
String ratingName = "";
switch (rating) {
case 0:
ratingName = "mangelhaft";
break;
case 2:
ratingName = "ausreichend";
break;
case 4:
ratingName = "befriedigend";
break;
case 7:
ratingName = "gut";
break;
case 10:
ratingName = "sehr gut";
break;
}
if (comment.equals("Bitte geben Sie Ihren Kommentar hier ein!") || comment.equals("")) {
comment = "- kein -";
}
Map<Author, Float> responsibilities = collabReview.getMeasurementsManager().getArtifactResponsibility().listResponsibilities(artifact);
for (Author aa : responsibilities.keySet()) {
if (mailCount == 0 || responsibilities.get(aa) < 0.1) {
break;
}
mailCount--;
logger.debug("Mail an " + aa + " email: " + aa.getEmail());
String linkArticle = null;
try {
linkArticle = "http://moknowpedia.fit.fraunhofer.de/mediawiki/index.php5/" + java.net.URLEncoder.encode(articleName, "utf-8");
} catch (UnsupportedEncodingException e) {
logger.error("Encoding error when trying to send Moknowpedia Mail", e);
linkArticle = "[ENCODING ERROR]";
}
String reviewerName = anonymous ? "anonym" : ("von " + author.getName());
collabReview.getMailManager().newMail("Ein Artikel von dir wurde bewertet! :-)", aa.getEmail())
.setBody("Hallo " + aa.getName() + ",\n\n dein Artikel \"" + articleName + "\" wurde gerade " + reviewerName + " mit _" + ratingName + "_ bewertet!" +
"\n Optionaler Kommentar der Bewertung: " + comment + "." +
"\n\nBester Gruß,\n Euer MoKnowPedianer" +
"\n\nPS: Diese URL führt dich eventuell direkt zum Artikel: " + linkArticle)