Rewrite of .properties file that handles notification messages. Properties now take parameters for easier modification and localization.
This commit is contained in:
parent
aa931305f6
commit
d70fdee6a5
src/main/java/se/su/dsv/scipro
21
src/main/java/se/su/dsv/scipro/SciProApplication.properties
Normal file
21
src/main/java/se/su/dsv/scipro/SciProApplication.properties
Normal file
@ -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}
|
@ -27,9 +27,6 @@ public interface NotificationController {
|
||||
final NotificationPriority notificationPriority, final String title,
|
||||
final String classId, final String absolutePath);
|
||||
|
||||
public void notifyReplyPrivateMessage(final User user, final String message,
|
||||
final String url);
|
||||
|
||||
public void notifyFinalSeminarEdited(final User user,
|
||||
final FinalSeminar finalSeminar, final NotificationPriority notificationPriority,
|
||||
final String absolutePath);
|
||||
|
@ -1,11 +1,9 @@
|
||||
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.RequestCycle;
|
||||
import org.apache.wicket.model.Model;
|
||||
import org.apache.wicket.model.StringResourceModel;
|
||||
import org.apache.wicket.protocol.http.RequestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.ProjectPeerStatsPage;
|
||||
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
|
||||
@ -65,7 +62,7 @@ public class NotificationControllerImpl implements NotificationController {
|
||||
String systemFromName = generalSystemSettings.getMailFromName();
|
||||
String systemFromEmail = generalSystemSettings.getSystemFromMail();
|
||||
boolean sendMailEnabled = generalSystemSettings.isMailNotifications();
|
||||
// Mailnotifications
|
||||
// Mail notifications
|
||||
if (sendMailEnabled) {
|
||||
UserSettings userSettings = userSettingsDao.getUserSettings(usertoNotify);
|
||||
if (userSettings == null) {
|
||||
@ -112,7 +109,7 @@ public class NotificationControllerImpl implements NotificationController {
|
||||
}
|
||||
}
|
||||
|
||||
// Webnotifications
|
||||
// Web notifications
|
||||
WebNotification notification = new WebNotification();
|
||||
notification.setUser(usertoNotify);
|
||||
notification.setInfoText(notificationMessage.getWebNotificationMessage());
|
||||
@ -120,86 +117,43 @@ public class NotificationControllerImpl implements NotificationController {
|
||||
notificationDao.save(notification);
|
||||
}
|
||||
|
||||
private String generateMail(String userFirstName, String addMessage, String absoluteUrl) {
|
||||
String message = "";
|
||||
|
||||
Properties props = null;
|
||||
|
||||
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;
|
||||
private String generateMail(String userFirstName, String addMessage,
|
||||
String absoluteUrl) {
|
||||
return new StringResourceModel("mailNotification", null, new Object[] {
|
||||
userFirstName, addMessage, absoluteUrl }).getString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyPrivateMessage(final User user, final String message,
|
||||
final String url) {
|
||||
Properties props = null;
|
||||
try {
|
||||
props = PropsUtils.load("notification.properties");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String mailSubject = props.getProperty("mailSubject");
|
||||
String privateMessageNotification = props.getProperty("privateMessageNotification");
|
||||
String twoNewLines = props.getProperty("twoNewLines");
|
||||
|
||||
String webNotificationMessage = SciProSession.get().getUser() + privateMessageNotification;
|
||||
String webNotificationMessage = new StringResourceModel("pm.webNotification",
|
||||
new Model<User>(SciProSession.get().getUser())).getString();
|
||||
String mailBody = new StringResourceModel("mailBody", null, new Object[]{message}).getString();
|
||||
|
||||
String mailMessage = webNotificationMessage + twoNewLines + message;
|
||||
String mailMessage = webNotificationMessage + mailBody;
|
||||
String mailSubject = new StringResourceModel("mailSubject", null).getString();
|
||||
|
||||
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
||||
mailSubject, mailMessage);
|
||||
processNotification(user, notificationMessage, url, NotificationPriority.MEDIUM);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyConferencePost(final User user, final String message,
|
||||
final String messageboardTitle, final NotificationPriority notificationPriority,
|
||||
final String absolutePath) {
|
||||
final String url) {
|
||||
|
||||
Properties props = null;
|
||||
try {
|
||||
props = PropsUtils.load("notification.properties");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String mailSubject = props.getProperty("mailSubject");
|
||||
String conferenceNotification = props.getProperty("conferenceNotification");
|
||||
String twoNewLines = props.getProperty("twoNewLines");
|
||||
String quote = props.getProperty("quote");
|
||||
String webNotificationMessage = new StringResourceModel("conferencePost.webNotification",
|
||||
new Model<User>(SciProSession.get().getUser()), new Object[] {messageboardTitle}).getString();
|
||||
String mailBody = new StringResourceModel("mailBody", null, new Object[]{message}).getString();
|
||||
|
||||
String webNotificationMessage = SciProSession.get().getUser() + conferenceNotification
|
||||
+ quote + messageboardTitle + quote;
|
||||
|
||||
String mailMessage = webNotificationMessage + twoNewLines + message;
|
||||
String mailMessage = webNotificationMessage + mailBody;
|
||||
String mailSubject = new StringResourceModel("mailSubject", null).getString();
|
||||
|
||||
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
||||
mailSubject, mailMessage);
|
||||
processNotification(user, notificationMessage, absolutePath, notificationPriority);
|
||||
processNotification(user, notificationMessage, url, notificationPriority);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -207,20 +161,12 @@ public class NotificationControllerImpl implements NotificationController {
|
||||
final NotificationPriority notificationPriority, final String title,
|
||||
final String classId, final String absolutePath) {
|
||||
|
||||
Properties props = null;
|
||||
try {
|
||||
props = PropsUtils.load("notification.properties");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String mailSubject = props.getProperty("mailSubject");
|
||||
String conferenceNotification = props.getProperty("conferenceNotificationComment");
|
||||
String twoNewLines = props.getProperty("twoNewLines");
|
||||
String webNotificationMessage = new StringResourceModel("comment.webNotification",
|
||||
new Model<User>(SciProSession.get().getUser()), new Object[] { title }).getString();
|
||||
String mailBody = new StringResourceModel("mailBody", null, new Object[]{message}).getString();
|
||||
|
||||
String webNotificationMessage = SciProSession.get().getUser() + conferenceNotification
|
||||
+ title;
|
||||
|
||||
String mailMessage = webNotificationMessage + twoNewLines + message;
|
||||
String mailMessage = webNotificationMessage + mailBody;
|
||||
String mailSubject = new StringResourceModel("mailSubject", null).getString();
|
||||
|
||||
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
||||
mailSubject, mailMessage);
|
||||
@ -228,48 +174,14 @@ public class NotificationControllerImpl implements NotificationController {
|
||||
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
|
||||
public void notifyFinalSeminarEdited(final User user,
|
||||
final FinalSeminar finalSeminar, final NotificationPriority notificationPriority,
|
||||
final String absolutePath) {
|
||||
|
||||
Properties props = null;
|
||||
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 = new StringResourceModel("finalSeminarEdit.webNotification", new Model<FinalSeminar>(finalSeminar)).getString();
|
||||
|
||||
String webNotificationMessage = finalSeminarReportEdited + quote
|
||||
+ finalSeminar.getProject().getTitle() + quote
|
||||
+ finalSeminarOppositionReportBeenEdited;
|
||||
String mailSubject = new StringResourceModel("mailSubject", null).getString();
|
||||
String mailMessage = webNotificationMessage;
|
||||
|
||||
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
||||
@ -279,37 +191,17 @@ public class NotificationControllerImpl implements NotificationController {
|
||||
|
||||
@Override
|
||||
public void notifyCreateFinalSeminar(final User user,
|
||||
final FinalSeminar finalSemniar, final NotificationPriority notificationPriority,
|
||||
final FinalSeminar finalSeminar, final NotificationPriority notificationPriority,
|
||||
final String absolutePath, final boolean opponent) {
|
||||
|
||||
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 = "";
|
||||
String webNotificationMessage = "";
|
||||
if (!opponent) {
|
||||
project = props.getProperty("finalSeminarProject");
|
||||
webNotificationMessage = new StringResourceModel("finalSeminarCreated.webNotification", new Model<FinalSeminar>(finalSeminar), new Object[]{finalSeminar.getStartDate(), finalSeminar.getEndDate()}).getString();
|
||||
} 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 mailSubject = new StringResourceModel("mailSubject", null).getString();
|
||||
|
||||
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
||||
mailSubject, mailMessage);
|
||||
@ -321,24 +213,15 @@ public class NotificationControllerImpl implements NotificationController {
|
||||
final FinalSeminar finalSeminar, final NotificationPriority notificationPriority,
|
||||
final String absolutePath) {
|
||||
|
||||
Properties props = null;
|
||||
try {
|
||||
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 webNotificationMessage = new StringResourceModel("thesisUpload.webNotification",
|
||||
new Model<FinalSeminar>(finalSeminar)).getString();
|
||||
String mailMessage = webNotificationMessage;
|
||||
String mailSubject = new StringResourceModel("mailSubject", null).getString();
|
||||
|
||||
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
||||
mailSubject, mailMessage);
|
||||
processNotification(user, notificationMessage, absolutePath, notificationPriority);
|
||||
System.out.println(generateMail(user.getFirstName(), notificationMessage.getMailMessage(), absolutePath));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -346,27 +229,10 @@ public class NotificationControllerImpl implements NotificationController {
|
||||
final FinalSeminarOpposition opposition,
|
||||
final NotificationPriority notificationPriority, final String absolutePath) {
|
||||
|
||||
Properties props = null;
|
||||
try {
|
||||
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 webNotificationMessage = new StringResourceModel("oppositionUpload.webNotification",
|
||||
new Model<FinalSeminarOpposition>(opposition)).getString();
|
||||
String mailMessage = webNotificationMessage;
|
||||
String mailSubject = new StringResourceModel("mailSubject", null).getString();
|
||||
|
||||
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
||||
mailSubject, mailMessage);
|
||||
@ -374,26 +240,14 @@ public class NotificationControllerImpl implements NotificationController {
|
||||
}
|
||||
|
||||
public void notifyAcceptOfReview(PeerRequest request, Student student, Project project) {
|
||||
try {
|
||||
Properties props = null;
|
||||
|
||||
props = PropsUtils.load("notification.properties");
|
||||
|
||||
String mailSubject = props.getProperty("acceptPeerReviewSubject");
|
||||
String requestAccepted = props.getProperty("requestAccepted");
|
||||
String heShe = props.getProperty("heShe");
|
||||
String complete = props.getProperty("complete");
|
||||
String webNotificationMessage = new StringResourceModel("reviewAccepted.webNotification", null, new Object[]{student.getUser(), project.getProjectClass().getProjectClassSettings()
|
||||
.getNumDaysToSubmitPeerReview()}).getString();
|
||||
String mailSubject = new StringResourceModel("acceptPeerReviewSubject", null).getString();
|
||||
|
||||
User requestingUser = request.getRequester().getUser();
|
||||
|
||||
String messageBody = requestAccepted
|
||||
+ student.getUser().toString()
|
||||
+ heShe
|
||||
+ project.getProjectClass().getProjectClassSettings()
|
||||
.getNumDaysToSubmitPeerReview() + complete;
|
||||
|
||||
String webNotificationMessage = requestAccepted + student.getUser().toString();
|
||||
|
||||
String messageBody = webNotificationMessage;
|
||||
NotificationMessage notificationMessage = new NotificationMessage(
|
||||
webNotificationMessage, mailSubject, messageBody);
|
||||
|
||||
@ -404,25 +258,13 @@ public class NotificationControllerImpl implements NotificationController {
|
||||
|
||||
processNotification(requestingUser, notificationMessage, peerStatsUrl,
|
||||
NotificationPriority.MEDIUM);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void notifyCompletionOfReview(PeerReview review) {
|
||||
try {
|
||||
|
||||
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");
|
||||
String mailSubject = new StringResourceModel("completedReviewSubject", null).getString();
|
||||
|
||||
PeerRequest peerRequest = review.getPeerRequest();
|
||||
User requestingUser = peerRequest.getRequester().getUser();
|
||||
|
||||
@ -435,21 +277,26 @@ public class NotificationControllerImpl implements NotificationController {
|
||||
.urlFor(SupervisorPeerReviewPage.class, pp).toString());
|
||||
|
||||
// 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,
|
||||
mailSubject, messageBody);
|
||||
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessageForRequester,
|
||||
mailSubject, webNotificationMessageForRequester);
|
||||
|
||||
processNotification(requestingUser, notificationMessage, reviewUrl,
|
||||
NotificationPriority.MEDIUM);
|
||||
|
||||
// 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();
|
||||
|
||||
NotificationMessage notificationMessageSupervisorOfProject = new NotificationMessage(
|
||||
messageBody, mailSubject, messageBody);
|
||||
webNotificationMessageForSupervisorOfProject, mailSubject, webNotificationMessageForSupervisorOfProject);
|
||||
|
||||
processNotification(requestSupervisor, notificationMessageSupervisorOfProject,
|
||||
supervisorReviewUrl, NotificationPriority.MEDIUM);
|
||||
@ -457,23 +304,20 @@ public class NotificationControllerImpl implements NotificationController {
|
||||
// Message for supervisor of the reviewer that have made a review
|
||||
// for another project.
|
||||
|
||||
String webNotificationMessage = review.getReviewer().getUser().toString() + inProject
|
||||
+ review.getProject().getTitle() + hasPerformed;
|
||||
String webNotificationMessageForSupervisorOfReviewer = new StringResourceModel(
|
||||
"reviewCompletedforReviewSupervisor.webNotification",
|
||||
new Model<PeerReview>(review)).getString();
|
||||
|
||||
messageBody = supervisorMessageBody + review.getProject().getTitle()
|
||||
/*messageBody = supervisorMessageBody + review.getProject().getTitle()
|
||||
+ commaWithLinebreak + review.getReviewer().getUser().toString()
|
||||
+ supervisorMessageBody3;
|
||||
+ supervisorMessageBody3;*/
|
||||
|
||||
User reviewSupervisor = review.getProject().getHeadSupervisor().getUser();
|
||||
NotificationMessage notificationMessageSupervisorOfReviewer = new NotificationMessage(
|
||||
webNotificationMessage, mailSubject, messageBody);
|
||||
webNotificationMessageForSupervisorOfReviewer, mailSubject, webNotificationMessageForSupervisorOfReviewer);
|
||||
|
||||
processNotification(reviewSupervisor, notificationMessageSupervisorOfReviewer,
|
||||
supervisorReviewUrl, NotificationPriority.MEDIUM);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -482,11 +326,9 @@ public class NotificationControllerImpl implements NotificationController {
|
||||
* @param review
|
||||
*/
|
||||
public void notifyOfReviewRating(PeerReview review) {
|
||||
try {
|
||||
Properties props = null;
|
||||
props = PropsUtils.load("notification.properties");
|
||||
String mailSubject = props.getProperty("reviewRatedSubject");
|
||||
String reviewRatedBody = props.getProperty("reviewRatedBody");
|
||||
|
||||
String webNotificationMessage = new StringResourceModel("reviewRated.webNotification", null).getString();
|
||||
String mailSubject = new StringResourceModel("completedReviewSubject", null).getString();
|
||||
User reviewingUser = review.getReviewer().getUser();
|
||||
|
||||
PageParameters pp = new PageParameters();
|
||||
@ -494,16 +336,12 @@ public class NotificationControllerImpl implements NotificationController {
|
||||
String projectReviewUrl = RequestUtils.toAbsolutePath(RequestCycle.get()
|
||||
.urlFor(ProjectPeerReviewPage.class, pp).toString());
|
||||
|
||||
String messageBody = reviewRatedBody;
|
||||
String mailMessage = webNotificationMessage;
|
||||
|
||||
NotificationMessage notificationMessage = new NotificationMessage(messageBody,
|
||||
mailSubject, messageBody);
|
||||
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
||||
mailSubject, mailMessage);
|
||||
|
||||
processNotification(reviewingUser, notificationMessage, projectReviewUrl,
|
||||
NotificationPriority.MEDIUM);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class ReplyMessageModel implements IClusterable {
|
||||
r.setToUser(originalMessage.getFromUser());
|
||||
r.setPrivateMessage(pm);
|
||||
r = recipientDao.save(r);
|
||||
notificationController.notifyReplyPrivateMessage(originalMessage.getFromUser(), getReplySubject() +"\n\n" + getReplyText(), PrivateMessagesPage.getAbsoluteURL());
|
||||
notificationController.notifyPrivateMessage(originalMessage.getFromUser(), getReplySubject() +"\n\n" + getReplyText(), PrivateMessagesPage.getAbsoluteURL());
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user