getabsoulteurl och peer notifications
Change-Id: Ie110885d4a8b79ae438426f52d1e31ff721826da
This commit is contained in:
parent
04ae4cbaef
commit
804d035a0d
src/main/java/se/su/dsv/scipro/data/controllers
@ -2,8 +2,12 @@ package se.su.dsv.scipro.data.controllers;
|
|||||||
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.FinalSeminar;
|
import se.su.dsv.scipro.data.dataobjects.FinalSeminar;
|
||||||
import se.su.dsv.scipro.data.dataobjects.FinalSeminarOpposition;
|
import se.su.dsv.scipro.data.dataobjects.FinalSeminarOpposition;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.Student;
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
import se.su.dsv.scipro.data.enums.NotificationPriority;
|
import se.su.dsv.scipro.data.enums.NotificationPriority;
|
||||||
|
import se.su.dsv.scipro.peer.data.dataobjects.PeerRequest;
|
||||||
|
import se.su.dsv.scipro.peer.data.dataobjects.PeerReview;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -12,32 +16,38 @@ import se.su.dsv.scipro.data.enums.NotificationPriority;
|
|||||||
*/
|
*/
|
||||||
public interface NotificationController {
|
public interface NotificationController {
|
||||||
|
|
||||||
public void createNotificationForPrivateMessage(final User user, final String message,
|
public void notifyPrivateMessage(final User user, final String message,
|
||||||
final String url);
|
final String url);
|
||||||
|
|
||||||
public void createNotificationForConference(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 absolutePath);
|
||||||
|
|
||||||
public void createNotificationForComment(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 createNotificationForReplyPrivateMessage(final User user, final String message,
|
public void notifyReplyPrivateMessage(final User user, final String message,
|
||||||
final String url);
|
final String url);
|
||||||
|
|
||||||
public void createNotificationForFinalSeminarEdited(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);
|
||||||
|
|
||||||
public void createNotificationForCreateFinalSeminar(final User user, final FinalSeminar finalSemniar,
|
public void notifyCreateFinalSeminar(final User user, final FinalSeminar finalSemniar,
|
||||||
final NotificationPriority notificationPriority, final String absolutePath, final boolean opponent);
|
final NotificationPriority notificationPriority, final String absolutePath, final boolean opponent);
|
||||||
|
|
||||||
public void createNotificationForThesisUploaded(final User user,
|
public void notifyThesisUploaded(final User user,
|
||||||
final FinalSeminar finalSeminar, final NotificationPriority notificationPriority,
|
final FinalSeminar finalSeminar, final NotificationPriority notificationPriority,
|
||||||
final String absolutePath);
|
final String absolutePath);
|
||||||
|
|
||||||
public void createNotificationForOppositionUploaded(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);
|
||||||
|
|
||||||
|
public void notifyOfReviewRating(PeerReview review);
|
||||||
|
|
||||||
|
public void notifyCompletionOfReview(PeerReview review);
|
||||||
|
|
||||||
|
public void notifyAcceptOfReview(PeerRequest request, Student student, Project project);
|
||||||
}
|
}
|
||||||
|
@ -168,21 +168,21 @@ public class FinalSeminarUploadControllerImpl implements FinalSeminarUploadContr
|
|||||||
|
|
||||||
for (FinalSeminarActiveParticipation fa : seminar.getActiveParticipations()) {
|
for (FinalSeminarActiveParticipation fa : seminar.getActiveParticipations()) {
|
||||||
|
|
||||||
notificationController.createNotificationForThesisUploaded(fa.getUser(), seminar,
|
notificationController.notifyThesisUploaded(fa.getUser(), seminar,
|
||||||
NotificationPriority.HIGH, ProjectOppositionPage.getAbsoluteURL());
|
NotificationPriority.HIGH, ProjectOppositionPage.getAbsoluteURL());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (FinalSeminarOpposition fo : seminar.getOppositions()) {
|
for (FinalSeminarOpposition fo : seminar.getOppositions()) {
|
||||||
notificationController.createNotificationForThesisUploaded(fo.getOpponent().getUser(), seminar,
|
notificationController.notifyThesisUploaded(fo.getOpponent().getUser(), seminar,
|
||||||
NotificationPriority.HIGH, ProjectOppositionPage.getAbsoluteURL());
|
NotificationPriority.HIGH, ProjectOppositionPage.getAbsoluteURL());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ProjectFollower pf : seminar.getProject().getProjectFollowers()) {
|
for (ProjectFollower pf : seminar.getProject().getProjectFollowers()) {
|
||||||
notificationController.createNotificationForThesisUploaded(pf.getFollower().getUser(), seminar,
|
notificationController.notifyThesisUploaded(pf.getFollower().getUser(), seminar,
|
||||||
NotificationPriority.HIGH, SupervisorProjectsFinalSeminarPage.getAbsoluteURL());
|
NotificationPriority.HIGH, SupervisorProjectsFinalSeminarPage.getAbsoluteURL());
|
||||||
}
|
}
|
||||||
if (seminar.getProject().getHeadSupervisor() != null) {
|
if (seminar.getProject().getHeadSupervisor() != null) {
|
||||||
notificationController.createNotificationForThesisUploaded(seminar.getProject().getHeadSupervisor()
|
notificationController.notifyThesisUploaded(seminar.getProject().getHeadSupervisor()
|
||||||
.getUser(), seminar, NotificationPriority.HIGH,
|
.getUser(), seminar, NotificationPriority.HIGH,
|
||||||
SupervisorProjectsFinalSeminarPage.getAbsoluteURL());
|
SupervisorProjectsFinalSeminarPage.getAbsoluteURL());
|
||||||
}
|
}
|
||||||
@ -219,15 +219,15 @@ public class FinalSeminarUploadControllerImpl implements FinalSeminarUploadContr
|
|||||||
opposition = finalSeminarOppositionDao.save(opposition);
|
opposition = finalSeminarOppositionDao.save(opposition);
|
||||||
|
|
||||||
for (Student student : opposition.getFinalSeminar().getProject().getProjectParticipants()) {
|
for (Student student : opposition.getFinalSeminar().getProject().getProjectParticipants()) {
|
||||||
notificationController.createNotificationForOppositionUploaded(student.getUser(), opposition,
|
notificationController.notifyOppositionUploaded(student.getUser(), opposition,
|
||||||
NotificationPriority.HIGH, ProjectStartPage.getAbsoluteURL());
|
NotificationPriority.HIGH, ProjectStartPage.getAbsoluteURL());
|
||||||
}
|
}
|
||||||
for (ProjectFollower pf : opposition.getFinalSeminar().getProject().getProjectFollowers()) {
|
for (ProjectFollower pf : opposition.getFinalSeminar().getProject().getProjectFollowers()) {
|
||||||
notificationController.createNotificationForOppositionUploaded(pf.getFollower().getUser(), opposition,
|
notificationController.notifyOppositionUploaded(pf.getFollower().getUser(), opposition,
|
||||||
NotificationPriority.HIGH, SupervisorProjectsFinalSeminarPage.getAbsoluteURL());
|
NotificationPriority.HIGH, SupervisorProjectsFinalSeminarPage.getAbsoluteURL());
|
||||||
}
|
}
|
||||||
if (opposition.getFinalSeminar().getProject().getHeadSupervisor() != null) {
|
if (opposition.getFinalSeminar().getProject().getHeadSupervisor() != null) {
|
||||||
notificationController.createNotificationForOppositionUploaded(opposition.getFinalSeminar().getProject().getHeadSupervisor()
|
notificationController.notifyOppositionUploaded(opposition.getFinalSeminar().getProject().getHeadSupervisor()
|
||||||
.getUser(), opposition, NotificationPriority.HIGH,
|
.getUser(), opposition, NotificationPriority.HIGH,
|
||||||
SupervisorProjectsFinalSeminarPage.getAbsoluteURL());
|
SupervisorProjectsFinalSeminarPage.getAbsoluteURL());
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,9 @@ import java.text.DateFormat;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.apache.wicket.PageParameters;
|
||||||
|
import org.apache.wicket.RequestCycle;
|
||||||
|
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;
|
||||||
|
|
||||||
@ -18,10 +21,17 @@ import se.su.dsv.scipro.data.dataobjects.FinalSeminar;
|
|||||||
import se.su.dsv.scipro.data.dataobjects.FinalSeminarOpposition;
|
import se.su.dsv.scipro.data.dataobjects.FinalSeminarOpposition;
|
||||||
import se.su.dsv.scipro.data.dataobjects.GeneralSystemSettings;
|
import se.su.dsv.scipro.data.dataobjects.GeneralSystemSettings;
|
||||||
import se.su.dsv.scipro.data.dataobjects.MailEvent;
|
import se.su.dsv.scipro.data.dataobjects.MailEvent;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.Student;
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
import se.su.dsv.scipro.data.dataobjects.UserSettings;
|
import se.su.dsv.scipro.data.dataobjects.UserSettings;
|
||||||
import se.su.dsv.scipro.data.dataobjects.WebNotification;
|
import se.su.dsv.scipro.data.dataobjects.WebNotification;
|
||||||
import se.su.dsv.scipro.data.enums.NotificationPriority;
|
import se.su.dsv.scipro.data.enums.NotificationPriority;
|
||||||
|
import se.su.dsv.scipro.peer.data.dataobjects.PeerRequest;
|
||||||
|
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;
|
import se.su.dsv.scipro.util.PropsUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -144,7 +154,7 @@ public class NotificationControllerImpl implements NotificationController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createNotificationForPrivateMessage(final User user, final String message,
|
public void notifyPrivateMessage(final User user, final String message,
|
||||||
final String url) {
|
final String url) {
|
||||||
Properties props = null;
|
Properties props = null;
|
||||||
try {
|
try {
|
||||||
@ -167,7 +177,7 @@ public class NotificationControllerImpl implements NotificationController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createNotificationForConference(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 absolutePath) {
|
||||||
|
|
||||||
@ -193,7 +203,7 @@ public class NotificationControllerImpl implements NotificationController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createNotificationForComment(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) {
|
||||||
|
|
||||||
@ -219,7 +229,7 @@ public class NotificationControllerImpl implements NotificationController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createNotificationForReplyPrivateMessage(final User user, final String message,
|
public void notifyReplyPrivateMessage(final User user, final String message,
|
||||||
final String absolutePath) {
|
final String absolutePath) {
|
||||||
Properties props = null;
|
Properties props = null;
|
||||||
try {
|
try {
|
||||||
@ -239,9 +249,9 @@ public class NotificationControllerImpl implements NotificationController {
|
|||||||
mailSubject, mailMessage);
|
mailSubject, mailMessage);
|
||||||
processNotification(user, notificationMessage, absolutePath, NotificationPriority.MEDIUM);
|
processNotification(user, notificationMessage, absolutePath, NotificationPriority.MEDIUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createNotificationForFinalSeminarEdited(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) {
|
||||||
|
|
||||||
@ -264,13 +274,13 @@ public class NotificationControllerImpl implements NotificationController {
|
|||||||
|
|
||||||
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
||||||
mailSubject, mailMessage);
|
mailSubject, mailMessage);
|
||||||
processNotification(user, notificationMessage, absolutePath,
|
processNotification(user, notificationMessage, absolutePath, notificationPriority);
|
||||||
notificationPriority);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createNotificationForCreateFinalSeminar(final User user, final FinalSeminar finalSemniar,
|
public void notifyCreateFinalSeminar(final User user,
|
||||||
final NotificationPriority notificationPriority, final String absolutePath, final boolean opponent) {
|
final FinalSeminar finalSemniar, final NotificationPriority notificationPriority,
|
||||||
|
final String absolutePath, final boolean opponent) {
|
||||||
|
|
||||||
Properties props = null;
|
Properties props = null;
|
||||||
try {
|
try {
|
||||||
@ -282,9 +292,9 @@ public class NotificationControllerImpl implements NotificationController {
|
|||||||
String created = props.getProperty("finalSeminarCreated");
|
String created = props.getProperty("finalSeminarCreated");
|
||||||
String mailSubject = props.getProperty("mailSubject");
|
String mailSubject = props.getProperty("mailSubject");
|
||||||
String project = "";
|
String project = "";
|
||||||
if(!opponent){
|
if (!opponent) {
|
||||||
project = props.getProperty("finalSeminarProject");
|
project = props.getProperty("finalSeminarProject");
|
||||||
}else{
|
} else {
|
||||||
project = props.getProperty("finalSeminarProjectOpponnent");
|
project = props.getProperty("finalSeminarProjectOpponnent");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,12 +313,11 @@ public class NotificationControllerImpl implements NotificationController {
|
|||||||
|
|
||||||
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
||||||
mailSubject, mailMessage);
|
mailSubject, mailMessage);
|
||||||
processNotification(user, notificationMessage, absolutePath,
|
processNotification(user, notificationMessage, absolutePath, notificationPriority);
|
||||||
notificationPriority);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createNotificationForThesisUploaded(final User user,
|
public void notifyThesisUploaded(final User user,
|
||||||
final FinalSeminar finalSeminar, final NotificationPriority notificationPriority,
|
final FinalSeminar finalSeminar, final NotificationPriority notificationPriority,
|
||||||
final String absolutePath) {
|
final String absolutePath) {
|
||||||
|
|
||||||
@ -329,12 +338,11 @@ public class NotificationControllerImpl implements NotificationController {
|
|||||||
|
|
||||||
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
||||||
mailSubject, mailMessage);
|
mailSubject, mailMessage);
|
||||||
processNotification(user, notificationMessage, absolutePath,
|
processNotification(user, notificationMessage, absolutePath, notificationPriority);
|
||||||
notificationPriority);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createNotificationForOppositionUploaded(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) {
|
||||||
|
|
||||||
@ -362,7 +370,140 @@ public class NotificationControllerImpl implements NotificationController {
|
|||||||
|
|
||||||
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
||||||
mailSubject, mailMessage);
|
mailSubject, mailMessage);
|
||||||
processNotification(user, notificationMessage, absolutePath,
|
processNotification(user, notificationMessage, absolutePath, notificationPriority);
|
||||||
notificationPriority);
|
}
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
PageParameters pp = new PageParameters();
|
||||||
|
|
||||||
|
String peerStatsUrl = RequestUtils.toAbsolutePath(RequestCycle.get()
|
||||||
|
.urlFor(ProjectPeerStatsPage.class, pp).toString());
|
||||||
|
|
||||||
|
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");
|
||||||
|
PeerRequest peerRequest = review.getPeerRequest();
|
||||||
|
User requestingUser = peerRequest.getRequester().getUser();
|
||||||
|
|
||||||
|
PageParameters pp = new PageParameters();
|
||||||
|
pp.add(PeerReview.PP_PEER_REVIEW_ID, review.getId().toString());
|
||||||
|
|
||||||
|
String reviewUrl = RequestUtils.toAbsolutePath(RequestCycle.get()
|
||||||
|
.urlFor(ProjectPeerReviewPage.class, pp).toString());
|
||||||
|
String supervisorReviewUrl = RequestUtils.toAbsolutePath(RequestCycle.get()
|
||||||
|
.urlFor(SupervisorPeerReviewPage.class, pp).toString());
|
||||||
|
|
||||||
|
// Message for student when his/her review request is completed.
|
||||||
|
String messageBody = requestReviewed;
|
||||||
|
|
||||||
|
NotificationMessage notificationMessage = new NotificationMessage(messageBody,
|
||||||
|
mailSubject, messageBody);
|
||||||
|
|
||||||
|
processNotification(requestingUser, notificationMessage, reviewUrl,
|
||||||
|
NotificationPriority.MEDIUM);
|
||||||
|
|
||||||
|
// Message for supervisor of the project with a completed review.
|
||||||
|
messageBody = supervisorMessageBody + peerRequest.getProject().getTitle()
|
||||||
|
+ supervisorMessageBody2;
|
||||||
|
User requestSupervisor = peerRequest.getProject().getHeadSupervisor().getUser();
|
||||||
|
|
||||||
|
NotificationMessage notificationMessageSupervisorOfProject = new NotificationMessage(
|
||||||
|
messageBody, mailSubject, messageBody);
|
||||||
|
|
||||||
|
processNotification(requestSupervisor, notificationMessageSupervisorOfProject,
|
||||||
|
supervisorReviewUrl, NotificationPriority.MEDIUM);
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
messageBody = supervisorMessageBody + review.getProject().getTitle()
|
||||||
|
+ commaWithLinebreak + review.getReviewer().getUser().toString()
|
||||||
|
+ supervisorMessageBody3;
|
||||||
|
|
||||||
|
User reviewSupervisor = review.getProject().getHeadSupervisor().getUser();
|
||||||
|
NotificationMessage notificationMessageSupervisorOfReviewer = new NotificationMessage(
|
||||||
|
webNotificationMessage, mailSubject, messageBody);
|
||||||
|
|
||||||
|
processNotification(reviewSupervisor, notificationMessageSupervisorOfReviewer,
|
||||||
|
supervisorReviewUrl, NotificationPriority.MEDIUM);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO Rewrite
|
||||||
|
*
|
||||||
|
* @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");
|
||||||
|
User reviewingUser = review.getReviewer().getUser();
|
||||||
|
|
||||||
|
PageParameters pp = new PageParameters();
|
||||||
|
pp.add(PeerReview.PP_PEER_REVIEW_ID, review.getId().toString());
|
||||||
|
String projectReviewUrl = RequestUtils.toAbsolutePath(RequestCycle.get()
|
||||||
|
.urlFor(ProjectPeerReviewPage.class, pp).toString());
|
||||||
|
|
||||||
|
String messageBody = reviewRatedBody;
|
||||||
|
|
||||||
|
NotificationMessage notificationMessage = new NotificationMessage(messageBody,
|
||||||
|
mailSubject, messageBody);
|
||||||
|
|
||||||
|
processNotification(reviewingUser, notificationMessage, projectReviewUrl,
|
||||||
|
NotificationPriority.MEDIUM);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user