conference with notifications
Change-Id: I28ea22a0a8c5d74792f7f5e6a69125c9c0300b60
This commit is contained in:
parent
348c4cc2d4
commit
4599a394ec
src/main/java/se/su/dsv/scipro/conference
@ -0,0 +1,109 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package se.su.dsv.scipro.conference.model;
|
||||
|
||||
import org.apache.wicket.IClusterable;
|
||||
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.data.enums.NotificationPriority;
|
||||
|
||||
/**
|
||||
* @author Johan Aschan <aschan@dsv.su.se>
|
||||
*
|
||||
*/
|
||||
public class SubscriberModel implements IClusterable{
|
||||
|
||||
private User user;
|
||||
private String relativePath;
|
||||
private NotificationPriority notificationPriority;
|
||||
|
||||
|
||||
/**
|
||||
* @param user
|
||||
* @param relativePath
|
||||
* @param notificationPriority
|
||||
*/
|
||||
public SubscriberModel(User user, String relativePath, NotificationPriority notificationPriority) {
|
||||
super();
|
||||
this.user = user;
|
||||
this.relativePath = relativePath;
|
||||
this.notificationPriority = notificationPriority;
|
||||
}
|
||||
/**
|
||||
* @return the user
|
||||
*/
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
/**
|
||||
* @param user the user to set
|
||||
*/
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
/**
|
||||
* @return the relativePath
|
||||
*/
|
||||
public String getRelativePath() {
|
||||
return relativePath;
|
||||
}
|
||||
/**
|
||||
* @param relativePath the relativePath to set
|
||||
*/
|
||||
public void setRelativePath(String relativePath) {
|
||||
this.relativePath = relativePath;
|
||||
}
|
||||
/**
|
||||
* @return the notificationPriority
|
||||
*/
|
||||
public NotificationPriority getNotificationPriority() {
|
||||
return notificationPriority;
|
||||
}
|
||||
/**
|
||||
* @param notificationPriority the notificationPriority to set
|
||||
*/
|
||||
public void setNotificationPriority(NotificationPriority notificationPriority) {
|
||||
this.notificationPriority = notificationPriority;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result
|
||||
+ ((notificationPriority == null) ? 0 : notificationPriority.hashCode());
|
||||
result = prime * result + ((relativePath == null) ? 0 : relativePath.hashCode());
|
||||
result = prime * result + ((user == null) ? 0 : user.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
SubscriberModel other = (SubscriberModel) obj;
|
||||
if (notificationPriority != other.notificationPriority)
|
||||
return false;
|
||||
if (relativePath == null) {
|
||||
if (other.relativePath != null)
|
||||
return false;
|
||||
} else if (!relativePath.equals(other.relativePath))
|
||||
return false;
|
||||
if (user == null) {
|
||||
if (other.user != null)
|
||||
return false;
|
||||
} else if (!user.equals(other.user))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -3,31 +3,124 @@
|
||||
*/
|
||||
package se.su.dsv.scipro.conference.pages;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.wicket.PageParameters;
|
||||
import org.apache.wicket.RequestCycle;
|
||||
import org.apache.wicket.RestartResponseException;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.LoadableDetachableModel;
|
||||
import org.apache.wicket.protocol.http.RequestUtils;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.SciProApplication;
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.conference.model.SubscriberModel;
|
||||
import se.su.dsv.scipro.conference.panels.ConferencePanel;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.MessageBoardDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectFollower;
|
||||
import se.su.dsv.scipro.data.dataobjects.Student;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.data.enums.NotificationPriority;
|
||||
import se.su.dsv.scipro.project.pages.ProjectPage;
|
||||
import se.su.dsv.scipro.security.auth.Authorization;
|
||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||
|
||||
/**
|
||||
* @author Johan Aschan <aschan@dsv.su.se>
|
||||
*
|
||||
*/
|
||||
@Authorization(authorizedRoles={Roles.SYSADMIN})
|
||||
public class ProjectConferencePage extends ProjectPage {
|
||||
|
||||
@SpringBean
|
||||
MessageBoardDao messageBoardDao;
|
||||
|
||||
private MessageBoardDao messageBoardDao;
|
||||
|
||||
private IModel<Project> projectModel;
|
||||
private IModel<MessageBoard> messageBoardModel;
|
||||
private MessageBoard messageBoard;
|
||||
private final static String PROJECTID = "pid";
|
||||
|
||||
public ProjectConferencePage(PageParameters pp) {
|
||||
super(pp);
|
||||
String projectId = pp.getString("pid");
|
||||
if(projectId == null){
|
||||
pp.put("pid", SciProSession.get().getActiveProject().getId());
|
||||
if (projectId == null) {
|
||||
projectId = String.valueOf(SciProSession.get().getActiveProject().getId());
|
||||
}
|
||||
final Project project = projectDao.load(Long.valueOf(projectId));
|
||||
if (project == null || !projectDao.isPartOf(SciProSession.get().getUser(), project)) {
|
||||
failAndRedirect();
|
||||
} else {
|
||||
projectModel = new LoadableDetachableModel<Project>() {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected Project load() {
|
||||
return projectDao.reLoad(project);
|
||||
}
|
||||
};
|
||||
|
||||
Set<SubscriberModel> subscriberModel = new HashSet<SubscriberModel>();
|
||||
User user = projectModel.getObject().getHeadSupervisor().getUser();
|
||||
subscriberModel.add(new SubscriberModel(user,
|
||||
SupervisorConferencePage.getAbsoluteForSupervisorConferenceURL(projectModel.getObject().getId()),
|
||||
NotificationPriority.LOW));
|
||||
|
||||
for (ProjectFollower projectFollower : projectModel.getObject().getProjectFollowers()) {
|
||||
subscriberModel.add(new SubscriberModel(projectFollower.getFollower().getUser(),
|
||||
SupervisorConferencePage.getAbsoluteForSupervisorConferenceURL(projectModel.getObject().getId()),
|
||||
NotificationPriority.LOW));
|
||||
|
||||
}
|
||||
|
||||
for (Student student : projectModel.getObject().getProjectParticipants()) {
|
||||
//Prod-kod
|
||||
if (!student.getUser().equals(SciProSession.get().getUser()))
|
||||
subscriberModel.add(new SubscriberModel(student.getUser(),
|
||||
getAbsoluteForProjectConferenceURL(projectModel.getObject().getId()),
|
||||
NotificationPriority.LOW));
|
||||
//Test-kod
|
||||
// subscriberModel.add(new SubscriberModel(student.getUser(),
|
||||
// getAbsoluteForProjectConferenceURL(projectModel.getObject().getId()),
|
||||
// NotificationPriority.LOW));
|
||||
|
||||
}
|
||||
|
||||
messageBoard = messageBoardDao.getMessageBoard(projectModel.getObject());
|
||||
if (messageBoard == null) {
|
||||
messageBoard = new MessageBoard(projectModel.getObject());
|
||||
messageBoard.setTitle(projectModel.getObject().getTitle());
|
||||
messageBoard = messageBoardDao.save(messageBoard);
|
||||
}
|
||||
messageBoardModel = new LoadableDetachableModel<MessageBoard>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected MessageBoard load() {
|
||||
return messageBoardDao.reLoad(messageBoard);
|
||||
}
|
||||
};
|
||||
add(new ConferencePanel("conferencePanel", messageBoardModel, subscriberModel));
|
||||
}
|
||||
add(new ConferencePanel("conferencePanel", pp));
|
||||
|
||||
}
|
||||
|
||||
private void failAndRedirect() {
|
||||
throw new RestartResponseException(SciProApplication.get().getApplicationSettings()
|
||||
.getAccessDeniedPage());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String getAbsoluteForProjectConferenceURL(Long id) {
|
||||
PageParameters pageParameters = new PageParameters();
|
||||
pageParameters.add(PROJECTID, id.toString());
|
||||
return RequestUtils.toAbsolutePath(RequestCycle.get().urlFor(ProjectConferencePage.class, pageParameters)
|
||||
.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,21 +3,128 @@
|
||||
*/
|
||||
package se.su.dsv.scipro.conference.pages;
|
||||
|
||||
import org.apache.wicket.PageParameters;
|
||||
import org.apache.wicket.markup.html.panel.EmptyPanel;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.wicket.PageParameters;
|
||||
import org.apache.wicket.RequestCycle;
|
||||
import org.apache.wicket.RestartResponseException;
|
||||
import org.apache.wicket.markup.html.panel.EmptyPanel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.LoadableDetachableModel;
|
||||
import org.apache.wicket.protocol.http.RequestUtils;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.SciProApplication;
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.conference.model.SubscriberModel;
|
||||
import se.su.dsv.scipro.conference.panels.ConferencePanel;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.MessageBoardDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectFollower;
|
||||
import se.su.dsv.scipro.data.dataobjects.Student;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.data.enums.NotificationPriority;
|
||||
import se.su.dsv.scipro.security.auth.Authorization;
|
||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||
import se.su.dsv.scipro.supervisor.pages.AbstractSupervisorPage;
|
||||
|
||||
/**
|
||||
* @author Johan Aschan <aschan@dsv.su.se>
|
||||
*
|
||||
*/
|
||||
@Authorization(authorizedRoles = { Roles.SYSADMIN })
|
||||
public class SupervisorConferencePage extends AbstractSupervisorPage {
|
||||
|
||||
@SpringBean
|
||||
private MessageBoardDao messageBoardDao;
|
||||
@SpringBean
|
||||
protected ProjectDao projectDao;
|
||||
|
||||
private IModel<Project> projectModel;
|
||||
private IModel<MessageBoard> messageBoardModel;
|
||||
private MessageBoard messageBoard;
|
||||
private final static String PROJECTID = "pid";
|
||||
|
||||
public SupervisorConferencePage(PageParameters pp) {
|
||||
super(pp);
|
||||
String projectId = pp.getString("pid");
|
||||
if (projectId == null) {
|
||||
add(new EmptyPanel("conferencePanel"));
|
||||
} else {
|
||||
|
||||
add(new EmptyPanel("conferencePanel"));
|
||||
final Project project = projectDao.load(Long.valueOf(projectId));
|
||||
if (project == null || !projectDao.isPartOf(SciProSession.get().getUser(), project)) {
|
||||
failAndRedirect();
|
||||
} else {
|
||||
projectModel = new LoadableDetachableModel<Project>() {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected Project load() {
|
||||
return projectDao.reLoad(project);
|
||||
}
|
||||
};
|
||||
|
||||
Set<SubscriberModel> subscriberModel = new HashSet<SubscriberModel>();
|
||||
User user = projectModel.getObject().getHeadSupervisor().getUser();
|
||||
if (!user.equals(SciProSession.get().getUser())) {
|
||||
subscriberModel
|
||||
.add(new SubscriberModel(user,
|
||||
getAbsoluteForSupervisorConferenceURL(projectModel.getObject()
|
||||
.getId()), NotificationPriority.LOW));
|
||||
}
|
||||
|
||||
for (ProjectFollower projectFollower : projectModel.getObject()
|
||||
.getProjectFollowers()) {
|
||||
if (!user.equals(SciProSession.get().getUser())) {
|
||||
subscriberModel.add(new SubscriberModel(projectFollower.getFollower()
|
||||
.getUser(), getAbsoluteForSupervisorConferenceURL(projectModel
|
||||
.getObject().getId()), NotificationPriority.LOW));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (Student student : projectModel.getObject().getProjectParticipants()) {
|
||||
subscriberModel.add(new SubscriberModel(student.getUser(),
|
||||
ProjectConferencePage.getAbsoluteForProjectConferenceURL(projectModel
|
||||
.getObject().getId()), NotificationPriority.LOW));
|
||||
|
||||
}
|
||||
|
||||
messageBoard = messageBoardDao.getMessageBoard(projectModel.getObject());
|
||||
if (messageBoard == null) {
|
||||
messageBoard = new MessageBoard(projectModel.getObject());
|
||||
messageBoard.setTitle(projectModel.getObject().getTitle());
|
||||
messageBoard = messageBoardDao.save(messageBoard);
|
||||
}
|
||||
messageBoardModel = new LoadableDetachableModel<MessageBoard>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected MessageBoard load() {
|
||||
return messageBoardDao.reLoad(messageBoard);
|
||||
}
|
||||
};
|
||||
add(new ConferencePanel("conferencePanel", messageBoardModel, subscriberModel));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void failAndRedirect() {
|
||||
throw new RestartResponseException(SciProApplication.get().getApplicationSettings()
|
||||
.getAccessDeniedPage());
|
||||
}
|
||||
|
||||
public static String getAbsoluteForSupervisorConferenceURL(Long id) {
|
||||
PageParameters pageParameters = new PageParameters();
|
||||
pageParameters.add(PROJECTID, id.toString());
|
||||
return RequestUtils.toAbsolutePath(RequestCycle.get()
|
||||
.urlFor(SupervisorConferencePage.class, pageParameters).toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,10 +5,8 @@ package se.su.dsv.scipro.conference.panels;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.wicket.PageParameters;
|
||||
import org.apache.wicket.RequestCycle;
|
||||
import org.apache.wicket.RestartResponseException;
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
||||
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
|
||||
@ -22,28 +20,19 @@ import org.apache.wicket.markup.repeater.Item;
|
||||
import org.apache.wicket.markup.repeater.data.DataView;
|
||||
import org.apache.wicket.markup.repeater.data.IDataProvider;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.LoadableDetachableModel;
|
||||
import org.apache.wicket.model.Model;
|
||||
import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.protocol.http.RequestUtils;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import se.su.dsv.scipro.SciProApplication;
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.commentthread.panels.CommentThreadPanel;
|
||||
import se.su.dsv.scipro.conference.model.SubscriberModel;
|
||||
import se.su.dsv.scipro.data.controllers.NotificationController;
|
||||
import se.su.dsv.scipro.data.controllers.NotificationMessage;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.BoardMessageDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CommentThreadDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.MessageBoardDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.RoleDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.BoardMessage;
|
||||
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectFollower;
|
||||
import se.su.dsv.scipro.data.dataobjects.Student;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.data.enums.NotificationPriority;
|
||||
import se.su.dsv.scipro.dataproviders.BoardMessageDataProvider;
|
||||
@ -60,83 +49,28 @@ public class ConferencePanel extends Panel {
|
||||
@SpringBean
|
||||
private BoardMessageDao boardMessageDao;
|
||||
@SpringBean
|
||||
private MessageBoardDao messageBoardDao;
|
||||
@SpringBean
|
||||
private CommentThreadDao commentThreadDao;
|
||||
@SpringBean
|
||||
private RoleDao roleDao;
|
||||
|
||||
@SpringBean
|
||||
private ProjectDao projectDao;
|
||||
|
||||
@SpringBean
|
||||
private NotificationController notificationController;
|
||||
|
||||
private final static String relativePath = "project/conference/pid/";
|
||||
|
||||
private MessageBoard messageBoard;
|
||||
private DataView<BoardMessage> dataView;
|
||||
private WebMarkupContainer webMarkupContainer;
|
||||
private IModel<MessageBoard> messageBoardModel;
|
||||
private IModel<Project> projectModel;
|
||||
private Set<SubscriberModel> subscriberModels;
|
||||
|
||||
// public ConferencePanel(final String id, final Commentable keyObject,
|
||||
// final Set<User> userList,
|
||||
// final String title) {
|
||||
// super(id);
|
||||
//
|
||||
//
|
||||
// messageBoard = messageBoardDao.getMessageBoard(keyObject);
|
||||
// if (messageBoard == null) {
|
||||
// messageBoard = new MessageBoard(keyObject);
|
||||
// messageBoard.setTitle(title);
|
||||
// }
|
||||
//
|
||||
// messageBoard = messageBoardDao.save(messageBoard);
|
||||
// initPanel();
|
||||
// }
|
||||
|
||||
public ConferencePanel(String id, PageParameters pp) {
|
||||
public ConferencePanel(String id,
|
||||
IModel<MessageBoard> messageBoardModel, Set<SubscriberModel> subscriberModels) {
|
||||
super(id);
|
||||
String projectId = pp.getString("pid");
|
||||
|
||||
final Project project = projectDao.load(Long.valueOf(projectId));
|
||||
if (project == null || !projectDao.isPartOf(SciProSession.get().getUser(), project)) {
|
||||
failAndRedirect();
|
||||
} else {
|
||||
projectModel = new LoadableDetachableModel<Project>() {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected Project load() {
|
||||
// TODO Auto-generated method stub
|
||||
return projectDao.reLoad(project);
|
||||
}
|
||||
};
|
||||
|
||||
messageBoard = messageBoardDao.getMessageBoard(projectModel.getObject());
|
||||
if (messageBoard == null) {
|
||||
messageBoard = new MessageBoard(projectModel.getObject());
|
||||
messageBoard.setTitle(projectModel.getObject().getTitle());
|
||||
messageBoard = messageBoardDao.save(messageBoard);
|
||||
}
|
||||
|
||||
initPanel();
|
||||
}
|
||||
this.messageBoardModel = messageBoardModel;
|
||||
this.subscriberModels = subscriberModels;
|
||||
initPanel();
|
||||
}
|
||||
|
||||
private void initPanel() {
|
||||
add(new SendWallMessageForm("sendForm"));
|
||||
webMarkupContainer = new WebMarkupContainer("container");
|
||||
messageBoardModel = new LoadableDetachableModel<MessageBoard>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected MessageBoard load() {
|
||||
return messageBoardDao.reLoad(messageBoard);
|
||||
}
|
||||
};
|
||||
loadUserDataView(new BoardMessageDataProvider(messageBoardModel));
|
||||
webMarkupContainer.add(dataView);
|
||||
webMarkupContainer.setOutputMarkupId(true);
|
||||
@ -144,11 +78,6 @@ public class ConferencePanel extends Panel {
|
||||
add(webMarkupContainer);
|
||||
}
|
||||
|
||||
private void failAndRedirect() {
|
||||
throw new RestartResponseException(SciProApplication.get().getApplicationSettings()
|
||||
.getAccessDeniedPage());
|
||||
}
|
||||
|
||||
public void loadUserDataView(IDataProvider<BoardMessage> boardMessageDataProvider) {
|
||||
|
||||
dataView = new DataView<BoardMessage>("boardMessageDataView", boardMessageDataProvider, 10) {
|
||||
@ -257,7 +186,6 @@ public class ConferencePanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||
|
||||
@ -267,20 +195,12 @@ public class ConferencePanel extends Panel {
|
||||
bm.setFromUser(SciProSession.get().getUser());
|
||||
bm = boardMessageDao.save(bm);
|
||||
|
||||
projectModel.detach();
|
||||
|
||||
for (ProjectFollower projectFollower : projectModel.getObject()
|
||||
.getProjectFollowers()) {
|
||||
createNotification(projectFollower.getFollower().getUser(), message);
|
||||
for (SubscriberModel subscriberModel : subscriberModels) {
|
||||
createNotification(subscriberModel.getUser(), message,
|
||||
subscriberModel.getNotificationPriority(), subscriberModel.getRelativePath());
|
||||
}
|
||||
|
||||
for (Student student : projectModel.getObject().getProjectParticipants()) {
|
||||
createNotification(student.getUser(), message);
|
||||
}
|
||||
|
||||
User user = projectModel.getObject().getHeadSupervisor().getUser();
|
||||
createNotification(user, message);
|
||||
|
||||
webMarkupContainer.removeAll();
|
||||
loadUserDataView(new BoardMessageDataProvider(messageBoardModel));
|
||||
webMarkupContainer.add(dataView);
|
||||
@ -294,11 +214,8 @@ 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();
|
||||
String relativeURL = relativePath + projectModel.getObject().getId();
|
||||
private void createNotification(final User user, final String message,
|
||||
final NotificationPriority notificationPriority, final String relativePath) {
|
||||
|
||||
Properties props = null;
|
||||
try {
|
||||
@ -309,18 +226,17 @@ public class ConferencePanel extends Panel {
|
||||
String mailSubject = props.getProperty("mailSubject");
|
||||
String conferenceNotification = props.getProperty("conferenceNotification");
|
||||
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;
|
||||
String mailMessage = webNotificationMessage + twoNewLines + message;
|
||||
|
||||
|
||||
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
||||
mailSubject, mailMessage);
|
||||
notificationController.processNotification(user, notificationMessage, relativeURL,
|
||||
NotificationPriority.LOW);
|
||||
|
||||
notificationController.processNotification(user, notificationMessage, relativePath,
|
||||
notificationPriority);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user