Rewrite of .properties file that handles notification messages. Properties now take parameters for easier modification and localization.

This commit is contained in:
Emil Siverhall 2011-08-05 09:04:07 +02:00
parent aa931305f6
commit d70fdee6a5
4 changed files with 107 additions and 251 deletions

@ -0,0 +1,21 @@
#Web notifications:
conferencePost.webNotification = ${firstName} ${lastName} posted on conference "{0}".
pm.webNotification = ${firstName} ${lastName} wrote a private message to you.
comment.webNotification = ${firstName} ${lastName} commented on a post on conference "{0}".
finalSeminarEdit.webNotification = Final seminar for project "${project}" has been edited.
finalSeminarCreated.webNotification = Head supervisor for "${project}" has created a final seminar, room ${room}, {0,date,yyyy-MM-dd HH:mm}{1,date,-HH:mm}
finalSeminarCreatedOpponent.webNotification = Head supervisor for "${project}" has created a final seminar and added you as an opponent, room ${room}, {0,date,yyyy-MM-dd HH:mm}{1,date,-HH:mm}
thesisUpload.webNotification = Thesis for the project "${project}" has been uploaded.
oppositionUpload.webNotification = Opposition report for the project "${finalSeminar.project}" has been uploaded by ${opponent.user}.
reviewAccepted.webNotification = Your peer request was accepted by {0}, he/she now has {1, number} days to complete a review.
reviewCompletedforRequester.webNotification = Your peer request has now been reviewed and is available.
reviewCompletedforRequestSupervisor.webNotification = You are getting this message because you are supervisor of "${peerRequest.project.title}". A peer review on this project has been completed and is available for you.
reviewCompletedforReviewSupervisor.webNotification = ${reviewer.user} in project: ${project.title} has performed a peer review.
reviewRated.webNotification = Your review has been rated.
#Mail notifications
mailSubject = Notification from SciPro
acceptPeerReviewSubject = Your request for peer review has been accepted
completedReviewSubject = A peer review has been completed
reviewRatedSubject = You have received a rating for a review you have done
mailNotification = Hello {0}, \n\n{1}\n\nClick on the link to see it in Scipro: \n{2} \n\nThis is an auto-generated message from SciPro.
mailBody = \n\n{0}

@ -26,9 +26,6 @@ public interface NotificationController {
public void notifyForComment(final User user, final String message, public void notifyForComment(final User user, final String message,
final NotificationPriority notificationPriority, final String title, final NotificationPriority notificationPriority, final String title,
final String classId, final String absolutePath); final String classId, final String absolutePath);
public void notifyReplyPrivateMessage(final User user, final String message,
final String url);
public void notifyFinalSeminarEdited(final User user, public void notifyFinalSeminarEdited(final User user,
final FinalSeminar finalSeminar, final NotificationPriority notificationPriority, final FinalSeminar finalSeminar, final NotificationPriority notificationPriority,

@ -1,11 +1,9 @@
package se.su.dsv.scipro.data.controllers.impl; package se.su.dsv.scipro.data.controllers.impl;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Properties;
import org.apache.wicket.PageParameters; import org.apache.wicket.PageParameters;
import org.apache.wicket.RequestCycle; import org.apache.wicket.RequestCycle;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.StringResourceModel;
import org.apache.wicket.protocol.http.RequestUtils; import org.apache.wicket.protocol.http.RequestUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -32,7 +30,6 @@ import se.su.dsv.scipro.peer.data.dataobjects.PeerReview;
import se.su.dsv.scipro.peer.pages.ProjectPeerReviewPage; import se.su.dsv.scipro.peer.pages.ProjectPeerReviewPage;
import se.su.dsv.scipro.peer.pages.ProjectPeerStatsPage; import se.su.dsv.scipro.peer.pages.ProjectPeerStatsPage;
import se.su.dsv.scipro.peer.pages.SupervisorPeerReviewPage; import se.su.dsv.scipro.peer.pages.SupervisorPeerReviewPage;
import se.su.dsv.scipro.util.PropsUtils;
/** /**
* TODO Think this through and do it properly, this is a rush-job implemented * TODO Think this through and do it properly, this is a rush-job implemented
@ -65,7 +62,7 @@ public class NotificationControllerImpl implements NotificationController {
String systemFromName = generalSystemSettings.getMailFromName(); String systemFromName = generalSystemSettings.getMailFromName();
String systemFromEmail = generalSystemSettings.getSystemFromMail(); String systemFromEmail = generalSystemSettings.getSystemFromMail();
boolean sendMailEnabled = generalSystemSettings.isMailNotifications(); boolean sendMailEnabled = generalSystemSettings.isMailNotifications();
// Mailnotifications // Mail notifications
if (sendMailEnabled) { if (sendMailEnabled) {
UserSettings userSettings = userSettingsDao.getUserSettings(usertoNotify); UserSettings userSettings = userSettingsDao.getUserSettings(usertoNotify);
if (userSettings == null) { if (userSettings == null) {
@ -112,7 +109,7 @@ public class NotificationControllerImpl implements NotificationController {
} }
} }
// Webnotifications // Web notifications
WebNotification notification = new WebNotification(); WebNotification notification = new WebNotification();
notification.setUser(usertoNotify); notification.setUser(usertoNotify);
notification.setInfoText(notificationMessage.getWebNotificationMessage()); notification.setInfoText(notificationMessage.getWebNotificationMessage());
@ -120,86 +117,43 @@ public class NotificationControllerImpl implements NotificationController {
notificationDao.save(notification); notificationDao.save(notification);
} }
private String generateMail(String userFirstName, String addMessage, String absoluteUrl) { private String generateMail(String userFirstName, String addMessage,
String message = ""; String absoluteUrl) {
return new StringResourceModel("mailNotification", null, new Object[] {
Properties props = null; userFirstName, addMessage, absoluteUrl }).getString();
try {
props = PropsUtils.load("notification.properties");
String twoNewLines = props.getProperty("twoNewLines");
String hello = props.getProperty("hello");
String autogenerated = props.getProperty("autogenerated");
String twoNewLinesWithComma = props.getProperty("twoNewLinesWithComma");
String linkText = props.getProperty("linkText");
message += hello;
message += userFirstName;
message += twoNewLinesWithComma;
message += addMessage;
message += twoNewLines;
message += linkText;
message += absoluteUrl;
message += twoNewLines;
message += autogenerated;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return message;
} }
@Override @Override
public void notifyPrivateMessage(final User user, final String message, public void notifyPrivateMessage(final User user, final String message,
final String url) { final String url) {
Properties props = null;
try { String webNotificationMessage = new StringResourceModel("pm.webNotification",
props = PropsUtils.load("notification.properties"); new Model<User>(SciProSession.get().getUser())).getString();
} catch (Exception e) { String mailBody = new StringResourceModel("mailBody", null, new Object[]{message}).getString();
e.printStackTrace();
} String mailMessage = webNotificationMessage + mailBody;
String mailSubject = props.getProperty("mailSubject"); String mailSubject = new StringResourceModel("mailSubject", null).getString();
String privateMessageNotification = props.getProperty("privateMessageNotification");
String twoNewLines = props.getProperty("twoNewLines");
String webNotificationMessage = SciProSession.get().getUser() + privateMessageNotification;
String mailMessage = webNotificationMessage + twoNewLines + message;
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage, NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
mailSubject, mailMessage); mailSubject, mailMessage);
processNotification(user, notificationMessage, url, NotificationPriority.MEDIUM); processNotification(user, notificationMessage, url, NotificationPriority.MEDIUM);
} }
@Override @Override
public void notifyConferencePost(final User user, final String message, public void notifyConferencePost(final User user, final String message,
final String messageboardTitle, final NotificationPriority notificationPriority, final String messageboardTitle, final NotificationPriority notificationPriority,
final String absolutePath) { final String url) {
Properties props = null; String webNotificationMessage = new StringResourceModel("conferencePost.webNotification",
try { new Model<User>(SciProSession.get().getUser()), new Object[] {messageboardTitle}).getString();
props = PropsUtils.load("notification.properties"); String mailBody = new StringResourceModel("mailBody", null, new Object[]{message}).getString();
} catch (Exception e) {
e.printStackTrace(); String mailMessage = webNotificationMessage + mailBody;
} String mailSubject = new StringResourceModel("mailSubject", null).getString();
String mailSubject = props.getProperty("mailSubject");
String conferenceNotification = props.getProperty("conferenceNotification");
String twoNewLines = props.getProperty("twoNewLines");
String quote = props.getProperty("quote");
String webNotificationMessage = SciProSession.get().getUser() + conferenceNotification
+ quote + messageboardTitle + quote;
String mailMessage = webNotificationMessage + twoNewLines + message;
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage, NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
mailSubject, mailMessage); mailSubject, mailMessage);
processNotification(user, notificationMessage, absolutePath, notificationPriority); processNotification(user, notificationMessage, url, notificationPriority);
} }
@Override @Override
@ -207,20 +161,12 @@ public class NotificationControllerImpl implements NotificationController {
final NotificationPriority notificationPriority, final String title, final NotificationPriority notificationPriority, final String title,
final String classId, final String absolutePath) { final String classId, final String absolutePath) {
Properties props = null; String webNotificationMessage = new StringResourceModel("comment.webNotification",
try { new Model<User>(SciProSession.get().getUser()), new Object[] { title }).getString();
props = PropsUtils.load("notification.properties"); String mailBody = new StringResourceModel("mailBody", null, new Object[]{message}).getString();
} catch (Exception e) {
e.printStackTrace(); String mailMessage = webNotificationMessage + mailBody;
} String mailSubject = new StringResourceModel("mailSubject", null).getString();
String mailSubject = props.getProperty("mailSubject");
String conferenceNotification = props.getProperty("conferenceNotificationComment");
String twoNewLines = props.getProperty("twoNewLines");
String webNotificationMessage = SciProSession.get().getUser() + conferenceNotification
+ title;
String mailMessage = webNotificationMessage + twoNewLines + message;
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage, NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
mailSubject, mailMessage); mailSubject, mailMessage);
@ -228,48 +174,14 @@ public class NotificationControllerImpl implements NotificationController {
notificationPriority); notificationPriority);
} }
@Override
public void notifyReplyPrivateMessage(final User user, final String message,
final String absolutePath) {
Properties props = null;
try {
props = PropsUtils.load("notification.properties");
} catch (Exception e) {
e.printStackTrace();
}
String mailSubject = props.getProperty("mailSubject");
String privateMessageNotification = props.getProperty("privateMessageReplyNotification");
String twoNewLines = props.getProperty("twoNewLines");
String webNotificationMessage = SciProSession.get().getUser() + privateMessageNotification;
String mailMessage = webNotificationMessage + twoNewLines + message;
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
mailSubject, mailMessage);
processNotification(user, notificationMessage, absolutePath, NotificationPriority.MEDIUM);
}
@Override @Override
public void notifyFinalSeminarEdited(final User user, public void notifyFinalSeminarEdited(final User user,
final FinalSeminar finalSeminar, final NotificationPriority notificationPriority, final FinalSeminar finalSeminar, final NotificationPriority notificationPriority,
final String absolutePath) { final String absolutePath) {
Properties props = null; String webNotificationMessage = new StringResourceModel("finalSeminarEdit.webNotification", new Model<FinalSeminar>(finalSeminar)).getString();
try {
props = PropsUtils.load("notification.properties");
} catch (Exception e) {
e.printStackTrace();
}
String mailSubject = props.getProperty("mailSubject");
String finalSeminarReportEdited = props.getProperty("finalSeminarOppositionReportEdited");
String finalSeminarOppositionReportBeenEdited = props
.getProperty("finalSeminarOppositionReportBeenEdited");
String quote = props.getProperty("quote");
String webNotificationMessage = finalSeminarReportEdited + quote String mailSubject = new StringResourceModel("mailSubject", null).getString();
+ finalSeminar.getProject().getTitle() + quote
+ finalSeminarOppositionReportBeenEdited;
String mailMessage = webNotificationMessage; String mailMessage = webNotificationMessage;
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage, NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
@ -279,37 +191,17 @@ public class NotificationControllerImpl implements NotificationController {
@Override @Override
public void notifyCreateFinalSeminar(final User user, public void notifyCreateFinalSeminar(final User user,
final FinalSeminar finalSemniar, final NotificationPriority notificationPriority, final FinalSeminar finalSeminar, final NotificationPriority notificationPriority,
final String absolutePath, final boolean opponent) { final String absolutePath, final boolean opponent) {
String webNotificationMessage = "";
Properties props = null;
try {
props = PropsUtils.load("notification.properties");
} catch (Exception e) {
e.printStackTrace();
}
String created = props.getProperty("finalSeminarCreated");
String mailSubject = props.getProperty("mailSubject");
String project = "";
if (!opponent) { if (!opponent) {
project = props.getProperty("finalSeminarProject"); webNotificationMessage = new StringResourceModel("finalSeminarCreated.webNotification", new Model<FinalSeminar>(finalSeminar), new Object[]{finalSeminar.getStartDate(), finalSeminar.getEndDate()}).getString();
} else { } else {
project = props.getProperty("finalSeminarProjectOpponnent"); webNotificationMessage = new StringResourceModel("finalSeminarCreatedOpponent.webNotification", new Model<FinalSeminar>(finalSeminar), new Object[]{finalSeminar.getStartDate(), finalSeminar.getEndDate()}).getString();
} }
String comma = props.getProperty("comma");
String space = props.getProperty("space");
String quote = props.getProperty("quote");
DateFormat dfFrom = new SimpleDateFormat("yyyy-MM-dd HH:mm");
DateFormat dfTo = new SimpleDateFormat("-HH:mm");
String webNotificationMessage = created + quote + finalSemniar.getProject().getTitle()
+ quote + project + finalSemniar.getRoom() + comma + space
+ dfFrom.format(finalSemniar.getStartDate())
+ dfTo.format(finalSemniar.getEndDate());
String mailMessage = webNotificationMessage; String mailMessage = webNotificationMessage;
String mailSubject = new StringResourceModel("mailSubject", null).getString();
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage, NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
mailSubject, mailMessage); mailSubject, mailMessage);
@ -321,108 +213,58 @@ public class NotificationControllerImpl implements NotificationController {
final FinalSeminar finalSeminar, final NotificationPriority notificationPriority, final FinalSeminar finalSeminar, final NotificationPriority notificationPriority,
final String absolutePath) { final String absolutePath) {
Properties props = null; String webNotificationMessage = new StringResourceModel("thesisUpload.webNotification",
try { new Model<FinalSeminar>(finalSeminar)).getString();
props = PropsUtils.load("notification.properties");
} catch (Exception e) {
e.printStackTrace();
}
String mailSubject = props.getProperty("mailSubject");
String finalSeminarReportUploaded = props.getProperty("finalSeminarReportUploaded");
String finalSeminarReportBeenUploaded = props.getProperty("finalSeminarReportBeenUploaded");
String quote = props.getProperty("quote");
String webNotificationMessage = finalSeminarReportUploaded + quote
+ finalSeminar.getProject().getTitle() + quote + finalSeminarReportBeenUploaded;
String mailMessage = webNotificationMessage; String mailMessage = webNotificationMessage;
String mailSubject = new StringResourceModel("mailSubject", null).getString();
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage, NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
mailSubject, mailMessage); mailSubject, mailMessage);
processNotification(user, notificationMessage, absolutePath, notificationPriority); processNotification(user, notificationMessage, absolutePath, notificationPriority);
System.out.println(generateMail(user.getFirstName(), notificationMessage.getMailMessage(), absolutePath));
} }
@Override @Override
public void notifyOppositionUploaded(final User user, public void notifyOppositionUploaded(final User user,
final FinalSeminarOpposition opposition, final FinalSeminarOpposition opposition,
final NotificationPriority notificationPriority, final String absolutePath) { final NotificationPriority notificationPriority, final String absolutePath) {
Properties props = null; String webNotificationMessage = new StringResourceModel("oppositionUpload.webNotification",
try { new Model<FinalSeminarOpposition>(opposition)).getString();
props = PropsUtils.load("notification.properties");
} catch (Exception e) {
e.printStackTrace();
}
String mailSubject = props.getProperty("mailSubject");
String finalSeminarOppositionReportUploaded = props
.getProperty("finalSeminarOppositionReportUploaded");
String finalSeminarOppositionReportBeenUploaded = props
.getProperty("finalSeminarOppositionReportBeenUploaded");
String dot = props.getProperty("dot");
String quote = props.getProperty("quote");
String space = props.getProperty("space");
String webNotificationMessage = finalSeminarOppositionReportUploaded + quote
+ opposition.getFinalSeminar().getProject().getTitle() + quote
+ finalSeminarOppositionReportBeenUploaded
+ opposition.getOpponent().getUser().getFirstName() + space
+ opposition.getOpponent().getUser().getLastName() + dot;
String mailMessage = webNotificationMessage; String mailMessage = webNotificationMessage;
String mailSubject = new StringResourceModel("mailSubject", null).getString();
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage, NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
mailSubject, mailMessage); mailSubject, mailMessage);
processNotification(user, notificationMessage, absolutePath, notificationPriority); processNotification(user, notificationMessage, absolutePath, notificationPriority);
} }
public void notifyAcceptOfReview(PeerRequest request, Student student, Project project) { public void notifyAcceptOfReview(PeerRequest request, Student student, Project project) {
try {
Properties props = null; String webNotificationMessage = new StringResourceModel("reviewAccepted.webNotification", null, new Object[]{student.getUser(), project.getProjectClass().getProjectClassSettings()
.getNumDaysToSubmitPeerReview()}).getString();
String mailSubject = new StringResourceModel("acceptPeerReviewSubject", null).getString();
props = PropsUtils.load("notification.properties"); User requestingUser = request.getRequester().getUser();
String mailSubject = props.getProperty("acceptPeerReviewSubject"); String messageBody = webNotificationMessage;
String requestAccepted = props.getProperty("requestAccepted"); NotificationMessage notificationMessage = new NotificationMessage(
String heShe = props.getProperty("heShe");
String complete = props.getProperty("complete");
User requestingUser = request.getRequester().getUser();
String messageBody = requestAccepted
+ student.getUser().toString()
+ heShe
+ project.getProjectClass().getProjectClassSettings()
.getNumDaysToSubmitPeerReview() + complete;
String webNotificationMessage = requestAccepted + student.getUser().toString();
NotificationMessage notificationMessage = new NotificationMessage(
webNotificationMessage, mailSubject, messageBody); webNotificationMessage, mailSubject, messageBody);
PageParameters pp = new PageParameters(); PageParameters pp = new PageParameters();
String peerStatsUrl = RequestUtils.toAbsolutePath(RequestCycle.get() String peerStatsUrl = RequestUtils.toAbsolutePath(RequestCycle.get()
.urlFor(ProjectPeerStatsPage.class, pp).toString()); .urlFor(ProjectPeerStatsPage.class, pp).toString());
processNotification(requestingUser, notificationMessage, peerStatsUrl, processNotification(requestingUser, notificationMessage, peerStatsUrl,
NotificationPriority.MEDIUM); NotificationPriority.MEDIUM);
} catch (Exception e) {
e.printStackTrace();
} }
}
public void notifyCompletionOfReview(PeerReview review) { public void notifyCompletionOfReview(PeerReview review) {
try {
String mailSubject = new StringResourceModel("completedReviewSubject", null).getString();
Properties props = null;
props = PropsUtils.load("notification.properties");
String mailSubject = props.getProperty("completedReviewSubject");
String requestReviewed = props.getProperty("requestReviewed");
String supervisorMessageBody = props.getProperty("supervisorMessageBody");
String supervisorMessageBody2 = props.getProperty("supervisorMessageBody2");
String supervisorMessageBody3 = props.getProperty("supervisorMessageBody3");
String commaWithLinebreak = props.getProperty("commaWithLinebreak");
String inProject = props.getProperty("inProject");
String hasPerformed = props.getProperty("hasPerformed");
PeerRequest peerRequest = review.getPeerRequest(); PeerRequest peerRequest = review.getPeerRequest();
User requestingUser = peerRequest.getRequester().getUser(); User requestingUser = peerRequest.getRequester().getUser();
@ -435,21 +277,26 @@ public class NotificationControllerImpl implements NotificationController {
.urlFor(SupervisorPeerReviewPage.class, pp).toString()); .urlFor(SupervisorPeerReviewPage.class, pp).toString());
// Message for student when his/her review request is completed. // Message for student when his/her review request is completed.
String messageBody = requestReviewed; String webNotificationMessageForRequester = new StringResourceModel(
"reviewCompletedforRequester.webNotification",
new Model<PeerReview>(review)).getString();
NotificationMessage notificationMessage = new NotificationMessage(messageBody, NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessageForRequester,
mailSubject, messageBody); mailSubject, webNotificationMessageForRequester);
processNotification(requestingUser, notificationMessage, reviewUrl, processNotification(requestingUser, notificationMessage, reviewUrl,
NotificationPriority.MEDIUM); NotificationPriority.MEDIUM);
// Message for supervisor of the project with a completed review. // Message for supervisor of the project with a completed review.
messageBody = supervisorMessageBody + peerRequest.getProject().getTitle()
+ supervisorMessageBody2; String webNotificationMessageForSupervisorOfProject = new StringResourceModel(
"reviewCompletedforRequestSupervisor.webNotification",
new Model<PeerReview>(review)).getString();
User requestSupervisor = peerRequest.getProject().getHeadSupervisor().getUser(); User requestSupervisor = peerRequest.getProject().getHeadSupervisor().getUser();
NotificationMessage notificationMessageSupervisorOfProject = new NotificationMessage( NotificationMessage notificationMessageSupervisorOfProject = new NotificationMessage(
messageBody, mailSubject, messageBody); webNotificationMessageForSupervisorOfProject, mailSubject, webNotificationMessageForSupervisorOfProject);
processNotification(requestSupervisor, notificationMessageSupervisorOfProject, processNotification(requestSupervisor, notificationMessageSupervisorOfProject,
supervisorReviewUrl, NotificationPriority.MEDIUM); supervisorReviewUrl, NotificationPriority.MEDIUM);
@ -457,23 +304,20 @@ public class NotificationControllerImpl implements NotificationController {
// Message for supervisor of the reviewer that have made a review // Message for supervisor of the reviewer that have made a review
// for another project. // for another project.
String webNotificationMessage = review.getReviewer().getUser().toString() + inProject String webNotificationMessageForSupervisorOfReviewer = new StringResourceModel(
+ review.getProject().getTitle() + hasPerformed; "reviewCompletedforReviewSupervisor.webNotification",
new Model<PeerReview>(review)).getString();
messageBody = supervisorMessageBody + review.getProject().getTitle()
/*messageBody = supervisorMessageBody + review.getProject().getTitle()
+ commaWithLinebreak + review.getReviewer().getUser().toString() + commaWithLinebreak + review.getReviewer().getUser().toString()
+ supervisorMessageBody3; + supervisorMessageBody3;*/
User reviewSupervisor = review.getProject().getHeadSupervisor().getUser(); User reviewSupervisor = review.getProject().getHeadSupervisor().getUser();
NotificationMessage notificationMessageSupervisorOfReviewer = new NotificationMessage( NotificationMessage notificationMessageSupervisorOfReviewer = new NotificationMessage(
webNotificationMessage, mailSubject, messageBody); webNotificationMessageForSupervisorOfReviewer, mailSubject, webNotificationMessageForSupervisorOfReviewer);
processNotification(reviewSupervisor, notificationMessageSupervisorOfReviewer, processNotification(reviewSupervisor, notificationMessageSupervisorOfReviewer,
supervisorReviewUrl, NotificationPriority.MEDIUM); supervisorReviewUrl, NotificationPriority.MEDIUM);
} catch (Exception e) {
e.printStackTrace();
}
} }
/** /**
@ -482,11 +326,9 @@ public class NotificationControllerImpl implements NotificationController {
* @param review * @param review
*/ */
public void notifyOfReviewRating(PeerReview review) { public void notifyOfReviewRating(PeerReview review) {
try {
Properties props = null; String webNotificationMessage = new StringResourceModel("reviewRated.webNotification", null).getString();
props = PropsUtils.load("notification.properties"); String mailSubject = new StringResourceModel("completedReviewSubject", null).getString();
String mailSubject = props.getProperty("reviewRatedSubject");
String reviewRatedBody = props.getProperty("reviewRatedBody");
User reviewingUser = review.getReviewer().getUser(); User reviewingUser = review.getReviewer().getUser();
PageParameters pp = new PageParameters(); PageParameters pp = new PageParameters();
@ -494,16 +336,12 @@ public class NotificationControllerImpl implements NotificationController {
String projectReviewUrl = RequestUtils.toAbsolutePath(RequestCycle.get() String projectReviewUrl = RequestUtils.toAbsolutePath(RequestCycle.get()
.urlFor(ProjectPeerReviewPage.class, pp).toString()); .urlFor(ProjectPeerReviewPage.class, pp).toString());
String messageBody = reviewRatedBody; String mailMessage = webNotificationMessage;
NotificationMessage notificationMessage = new NotificationMessage(messageBody, NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
mailSubject, messageBody); mailSubject, mailMessage);
processNotification(reviewingUser, notificationMessage, projectReviewUrl, processNotification(reviewingUser, notificationMessage, projectReviewUrl,
NotificationPriority.MEDIUM); NotificationPriority.MEDIUM);
} catch (Exception e) {
e.printStackTrace();
}
} }
} }

@ -89,7 +89,7 @@ public class ReplyMessageModel implements IClusterable {
r.setToUser(originalMessage.getFromUser()); r.setToUser(originalMessage.getFromUser());
r.setPrivateMessage(pm); r.setPrivateMessage(pm);
r = recipientDao.save(r); r = recipientDao.save(r);
notificationController.notifyReplyPrivateMessage(originalMessage.getFromUser(), getReplySubject() +"\n\n" + getReplyText(), PrivateMessagesPage.getAbsoluteURL()); notificationController.notifyPrivateMessage(originalMessage.getFromUser(), getReplySubject() +"\n\n" + getReplyText(), PrivateMessagesPage.getAbsoluteURL());
} }