conveinencemethod for creating notifications
Change-Id: I6bb184b1f6e084c65ebb75059390e9d8d65600bf
This commit is contained in:
parent
aac654c81d
commit
ece6ffacc9
@ -261,28 +261,23 @@ public class ConferencePanel extends Panel {
|
||||
@Override
|
||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||
|
||||
|
||||
BoardMessage bm = new BoardMessage();
|
||||
bm.setMessage(message);
|
||||
bm.setMessageBoard(messageBoardModel.getObject());
|
||||
bm.setFromUser(SciProSession.get().getUser());
|
||||
bm = boardMessageDao.save(bm);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
projectModel.detach();
|
||||
|
||||
|
||||
for (ProjectFollower projectFollower : projectModel.getObject()
|
||||
.getProjectFollowers()) {
|
||||
createNotification(projectFollower.getFollower().getUser(), message);
|
||||
}
|
||||
|
||||
|
||||
for (Student student : projectModel.getObject().getProjectParticipants()) {
|
||||
createNotification(student.getUser(), message);
|
||||
}
|
||||
|
||||
|
||||
User user = projectModel.getObject().getHeadSupervisor().getUser();
|
||||
createNotification(user, message);
|
||||
|
||||
@ -298,12 +293,13 @@ public class ConferencePanel extends Panel {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void createNotification(final User user,final String message){
|
||||
String absoluteURL = RequestUtils.toAbsolutePath(RequestCycle.get().getRequest().getRelativePathPrefixToWicketHandler());
|
||||
absoluteURL += relativePath + projectModel.getObject().getId();
|
||||
|
||||
private void createNotification(final User user, final String message) {
|
||||
String absoluteURL = RequestUtils.toAbsolutePath(RequestCycle.get().getRequest()
|
||||
.getRelativePathPrefixToWicketHandler());
|
||||
absoluteURL += relativePath + projectModel.getObject().getId();
|
||||
String relativeURL = relativePath + projectModel.getObject().getId();
|
||||
|
||||
|
||||
Properties props = null;
|
||||
try {
|
||||
props = PropsUtils.load("notification.properties");
|
||||
@ -315,17 +311,16 @@ public class ConferencePanel extends Panel {
|
||||
String twoNewLines = props.getProperty("twoNewLines");
|
||||
String linkText = props.getProperty("linkText");
|
||||
|
||||
|
||||
String webNotificationMessage = SciProSession.get()
|
||||
.getUser()
|
||||
+ conferenceNotification
|
||||
+ messageBoardModel.getObject().getTitle();
|
||||
|
||||
String mailMessage = webNotificationMessage + twoNewLines + message + twoNewLines + linkText + absoluteURL;
|
||||
|
||||
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage, mailSubject, mailMessage);
|
||||
notificationController.processNotification(user, notificationMessage,
|
||||
relativeURL, NotificationPriority.LOW);
|
||||
|
||||
String webNotificationMessage = SciProSession.get().getUser() + conferenceNotification
|
||||
+ messageBoardModel.getObject().getTitle();
|
||||
|
||||
String mailMessage = webNotificationMessage + twoNewLines + message + twoNewLines
|
||||
+ linkText + absoluteURL;
|
||||
|
||||
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
||||
mailSubject, mailMessage);
|
||||
notificationController.processNotification(user, notificationMessage, relativeURL,
|
||||
NotificationPriority.LOW);
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user