Merge branch 'develop' of ssh://git.dsv.su.se/git/scipro/scipro into local_develop
This commit is contained in:
commit
8197a87fc7
src
main
java/se/su/dsv/scipro
admin/pages
basepanels
checklists/panels
CreateCheckListTemplatePanel.htmlCreateCheckListTemplatePanel.javaTrafficLightPanel.htmlTrafficLightPanel.java
conference
data
controllers/impl
dao
interfaces
BoardMessageDao.javaCheckListAnswerDao.javaCheckListDao.javaCheckListQuestionDao.javaCheckListTemplateDao.javaMessageBoardDao.java
jpa
dataobjects
BoardMessage.javaCheckList.javaCheckListAnswer.javaCheckListQuestion.javaCheckListTemplate.javaMessageBoard.java
enums
project
resources
webapp
test/java/se/su/dsv/scipro/dao/jpa
@ -19,7 +19,7 @@ import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||
*
|
||||
*/
|
||||
|
||||
@Authorization(authorizedRoles={Roles.SYSADMIN})
|
||||
@Authorization(authorizedRoles={Roles.SYSADMIN, Roles.ADMIN})
|
||||
public class AdminProjectPartnerPage extends AbstractAdminPage {
|
||||
|
||||
@SpringBean
|
||||
|
@ -25,7 +25,9 @@ import se.su.dsv.scipro.message.pages.PrivateMessagesPage;
|
||||
import se.su.dsv.scipro.peer.pages.PeerReviewTemplatePage;
|
||||
import se.su.dsv.scipro.project.pages.FinalSeminarProjectListPage;
|
||||
import se.su.dsv.scipro.project.pages.ProjectOppositionPage;
|
||||
import se.su.dsv.scipro.project.pages.ProjectPartnerPage;
|
||||
import se.su.dsv.scipro.project.pages.ProjectStartPage;
|
||||
import se.su.dsv.scipro.project.pages.ProjectChecklistPage;
|
||||
import se.su.dsv.scipro.security.auth.MetaDataActionStrategy;
|
||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorProjectsFinalSeminarPage;
|
||||
|
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<div wicket:id="feedbackPanel"></div>
|
||||
<form wicket:id="form">
|
||||
<div>
|
||||
<input wicket:id="questions" type="text" />
|
||||
</div>
|
||||
<input wicket:id="button" type="submit"/>
|
||||
</form>
|
||||
<div>
|
||||
<a href="#" wicket:id="link">Print</a>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a href="#" wicket:id="newLink">New Link</a>
|
||||
</div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,159 @@
|
||||
package se.su.dsv.scipro.checklists.panels;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.markup.html.AjaxLink;
|
||||
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
|
||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||
import org.apache.wicket.markup.html.WebPage;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.basic.MultiLineLabel;
|
||||
import org.apache.wicket.markup.html.form.Form;
|
||||
import org.apache.wicket.markup.html.form.Radio;
|
||||
import org.apache.wicket.markup.html.form.RadioChoice;
|
||||
import org.apache.wicket.markup.html.form.RadioGroup;
|
||||
import org.apache.wicket.markup.html.form.RequiredTextField;
|
||||
import org.apache.wicket.markup.html.form.TextField;
|
||||
import org.apache.wicket.markup.html.list.ListItem;
|
||||
import org.apache.wicket.markup.html.list.ListView;
|
||||
import org.apache.wicket.markup.html.panel.FeedbackPanel;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.CompoundPropertyModel;
|
||||
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.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListAnswerDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListQuestionDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectClassDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckList;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListAnswer;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListTemplate;
|
||||
import se.su.dsv.scipro.data.dataobjects.GeneralSystemSettings;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
|
||||
import se.su.dsv.scipro.data.enums.CheckListQuestionAnswer;
|
||||
import se.su.dsv.scipro.data.enums.StateOfMind;
|
||||
import se.su.dsv.scipro.knol.resource.page.StaticImage;
|
||||
import edu.emory.mathcs.backport.java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author fnorbe@dsv.su.se
|
||||
*/
|
||||
|
||||
public class CreateCheckListTemplatePanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = 8862892008428526067L;
|
||||
|
||||
@SpringBean
|
||||
private CheckListDao checkListDao;
|
||||
|
||||
@SpringBean
|
||||
private CheckListAnswerDao checkListAnswerDao;
|
||||
|
||||
@SpringBean
|
||||
private CheckListQuestionDao checkListQuestionDao;
|
||||
|
||||
@SpringBean
|
||||
private CheckListTemplateDao checkListTemplateDao;
|
||||
|
||||
@SpringBean
|
||||
private ProjectClassDao projectClassDao;
|
||||
|
||||
private String question = "";
|
||||
private String title = "";
|
||||
|
||||
private ProjectClass projectClass;
|
||||
|
||||
private CheckListTemplate checkListTemplate = new CheckListTemplate();
|
||||
|
||||
public CreateCheckListTemplatePanel(String id) {
|
||||
super(id);
|
||||
projectClass = projectClassDao.getProjectClass(ProjectClass.BACHELOR);
|
||||
final FeedbackPanel feedbackPanel = new FeedbackPanel("feedbackPanel");
|
||||
feedbackPanel.setOutputMarkupId(true);
|
||||
add(feedbackPanel);
|
||||
Form<CheckListTemplate> form = new Form<CheckListTemplate>("form");
|
||||
final TextField<String> titleField = new RequiredTextField<String>("title",
|
||||
new PropertyModel<String>(this, "title"));
|
||||
final TextField<String> questionField = new RequiredTextField<String>("questions",
|
||||
new PropertyModel<String>(this, "question"));
|
||||
questionField.setOutputMarkupId(true);
|
||||
RadioChoice<ProjectClass> radioChoice = new RadioChoice<ProjectClass>("view",
|
||||
new PropertyModel<ProjectClass>(this, "projectClass"), projectClassDao.findAll());
|
||||
|
||||
IModel<List<String>> questionModel = new LoadableDetachableModel<List<String>>() {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected List<String> load() {
|
||||
// TODO Auto-generated method stub
|
||||
return checkListTemplate.getQuestions();
|
||||
}
|
||||
};
|
||||
|
||||
AjaxLink<Void> printLink = new AjaxLink<Void>("addQuestionLink") {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
checkListTemplate.getQuestions().add(question);
|
||||
question = "";
|
||||
target.addComponent(questionField);
|
||||
}
|
||||
};
|
||||
AjaxButton button = new AjaxButton("button", new Model<String>("Save")) {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||
|
||||
checkListTemplate.setLevel(projectClass);
|
||||
checkListTemplate.setCreator(SciProSession.get().getUser());
|
||||
checkListTemplate.setName(title);
|
||||
|
||||
target.addComponent(feedbackPanel);
|
||||
|
||||
}
|
||||
};
|
||||
form.add(titleField);
|
||||
form.add(radioChoice);
|
||||
form.add(button);
|
||||
form.add(questionField);
|
||||
add(form);
|
||||
|
||||
|
||||
|
||||
AjaxLink<Void> newLink = new AjaxLink<Void>("newLink") {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
checkListTemplate = new CheckListTemplate();
|
||||
|
||||
}
|
||||
};
|
||||
add(printLink);
|
||||
add(newLink);
|
||||
|
||||
};
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<div wicket:id="trafficLightContainer">
|
||||
<div wicket:id="group">
|
||||
<div wicket:id="lights">
|
||||
<table >
|
||||
<tr >
|
||||
<td><input type="radio" wicket:id="radio" /></td>
|
||||
<!--
|
||||
<td><img wicket:id="image" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div wicket:id="checkLists">
|
||||
<div wicket:id="listView">
|
||||
<span wicket:id="question"></span>
|
||||
<div wicket:id="listViewAnswer">
|
||||
<span wicket:id="answer"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
<td><img wicket:id="image"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
||||
<!--
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<div wicket:id="trafficLightContainer">
|
||||
<table wicket:id="group">
|
||||
<tr wicket:id="lights">
|
||||
<td><input type="radio" wicket:id="radio" /></td>
|
||||
<td> <img wicket:id="image"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
>>>>>>> checklists
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html> -->
|
@ -0,0 +1,164 @@
|
||||
package se.su.dsv.scipro.checklists.panels;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.form.Radio;
|
||||
import org.apache.wicket.markup.html.form.RadioGroup;
|
||||
import org.apache.wicket.markup.html.list.ListItem;
|
||||
import org.apache.wicket.markup.html.list.ListView;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.Model;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListAnswerDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListQuestionDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckList;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListAnswer;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
|
||||
import se.su.dsv.scipro.data.enums.CheckListQuestionAnswer;
|
||||
import se.su.dsv.scipro.knol.resource.page.StaticImage;
|
||||
|
||||
/**
|
||||
* @author fnorbe@dsv.su.se
|
||||
*/
|
||||
|
||||
public class TrafficLightPanel extends Panel {
|
||||
|
||||
private List<TrafficLight> lights;
|
||||
|
||||
enum TrafficLight{
|
||||
GREEN, YELLOW, RED, NOT
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 8862892008428526067L;
|
||||
|
||||
@SpringBean
|
||||
private CheckListDao checkListDao;
|
||||
|
||||
@SpringBean
|
||||
private CheckListAnswerDao checkListAnswerDao;
|
||||
|
||||
@SpringBean
|
||||
private CheckListQuestionDao checkListQuestionDao;
|
||||
|
||||
@SpringBean
|
||||
private CheckListTemplateDao checkListTemplateDao;
|
||||
|
||||
public TrafficLightPanel(String id) {
|
||||
super(id);
|
||||
|
||||
WebMarkupContainer trafficLightContainer = new WebMarkupContainer(
|
||||
"trafficLightContainer");
|
||||
add(trafficLightContainer);
|
||||
lights = new ArrayList<TrafficLight>();
|
||||
lights.add(TrafficLight.GREEN);lights.add(TrafficLight.YELLOW);lights.add(TrafficLight.RED);lights.add(TrafficLight.NOT);
|
||||
RadioGroup<TrafficLight> group = new RadioGroup<TrafficLight>("group");
|
||||
trafficLightContainer.add(group);
|
||||
|
||||
|
||||
|
||||
ListView<TrafficLight> lightList = new ListView<TrafficLight>("lights", lights) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected void populateItem(ListItem<TrafficLight> item) {
|
||||
TrafficLight trafficLight = item.getModelObject();
|
||||
item.add(new Radio<TrafficLight>("radio", item.getModel()));
|
||||
StaticImage image = null;
|
||||
if (trafficLight.equals(TrafficLight.GREEN)) {
|
||||
image = new StaticImage("image", new Model<String>(
|
||||
"images/icons/green_ball_32.png"));
|
||||
} else if (trafficLight.equals(TrafficLight.YELLOW)) {
|
||||
image = new StaticImage("image", new Model<String>(
|
||||
|
||||
"images/icons/red_ball_32.png"));
|
||||
} else if (trafficLight.equals(TrafficLight.RED)) {
|
||||
|
||||
image = new StaticImage("image", new Model<String>(
|
||||
"images/icons/yellow_ball_32.png"));
|
||||
}
|
||||
else if (trafficLight.equals(TrafficLight.NOT)) {
|
||||
image = new StaticImage("image", new Model<String>(
|
||||
"images/icons/grey_ball_32.png"));
|
||||
}
|
||||
item.add(image);
|
||||
};
|
||||
};
|
||||
|
||||
group.add(lightList);
|
||||
}
|
||||
|
||||
|
||||
List<CheckList> checkLists = checkListDao.findCheckLists(SciProSession.get()
|
||||
.getActiveProject());{
|
||||
if (checkLists.size() < 1) {
|
||||
CheckList checkList = new CheckList("Test", SciProSession.get().getActiveProject());
|
||||
CheckListQuestion checkListQuestion = new CheckListQuestion("Testquestion?");
|
||||
checkListQuestion = checkListQuestionDao.save(checkListQuestion);
|
||||
checkList.getQuestions().add(checkListQuestion);
|
||||
checkList = checkListDao.save(checkList);
|
||||
}
|
||||
|
||||
ListView<CheckList> checkListsListView = new ListView<CheckList>("checkLists", checkLists) {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(ListItem<CheckList> item) {
|
||||
|
||||
ListView<CheckListQuestion> listView = new ListView<CheckListQuestion>(
|
||||
"listView",
|
||||
new ArrayList<CheckListQuestion>(item.getModel().getObject().getQuestions())) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(ListItem<CheckListQuestion> item) {
|
||||
CheckListQuestion checkListQuestion = item.getModel().getObject();
|
||||
if(checkListQuestion.getAnswers().size() == 0){
|
||||
CheckListAnswer checkListAnswer = new CheckListAnswer(SciProSession.get().getUser(), CheckListQuestionAnswer.GREEN);
|
||||
checkListAnswer = checkListAnswerDao.save(checkListAnswer);
|
||||
checkListQuestion.getAnswers().add(checkListAnswer);
|
||||
checkListQuestionDao.save(checkListQuestion);
|
||||
|
||||
}
|
||||
item.add(new Label("question", item.getModel().getObject().getQuestion()));
|
||||
|
||||
ListView<CheckListAnswer> listView = new ListView<CheckListAnswer>(
|
||||
"listViewAnswer",
|
||||
new ArrayList<CheckListAnswer>(item.getModel().getObject().getAnswers())) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(ListItem<CheckListAnswer> item) {
|
||||
item.add(new Label("answer", item.getModel().getObject().getAnswer().toString()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
item.add(listView);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
item.add(listView);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
add(checkListsListView);
|
||||
};
|
||||
|
||||
}
|
@ -5,12 +5,12 @@ package se.su.dsv.scipro.conference.pages;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
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.AbstractReadOnlyModel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.LoadableDetachableModel;
|
||||
import org.apache.wicket.protocol.http.RequestUtils;
|
||||
@ -53,24 +53,10 @@ public class ProjectConferencePage extends ProjectPage {
|
||||
|
||||
public ProjectConferencePage(PageParameters pp) {
|
||||
super(pp);
|
||||
String projectId = pp.getString("pid");
|
||||
String boardMessageId = null;
|
||||
if (projectId != null) {
|
||||
StringTokenizer stringTokenizer = new StringTokenizer(projectId, "&");
|
||||
boolean first = true;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (stringTokenizer.hasMoreTokens()) {
|
||||
if (first) {
|
||||
projectId = stringTokenizer.nextToken().trim();
|
||||
first = false;
|
||||
} else {
|
||||
boardMessageId = stringTokenizer.nextToken().trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Long projectId = pp.getAsLong("pid");
|
||||
Long boardMessageId = pp.getAsLong("cid");
|
||||
if (projectId == null && SciProSession.get().getActiveProject() != null) {
|
||||
projectId = String.valueOf(SciProSession.get().getActiveProject().getId());
|
||||
projectId = SciProSession.get().getActiveProject().getId();
|
||||
}
|
||||
if (projectId != null) {
|
||||
final Project project = projectDao.load(Long.valueOf(projectId));
|
||||
@ -126,23 +112,23 @@ public class ProjectConferencePage extends ProjectPage {
|
||||
messageBoard.setTitle(projectModel.getObject().getTitle());
|
||||
messageBoard = messageBoardDao.save(messageBoard);
|
||||
}
|
||||
messageBoardModel = new LoadableDetachableModel<MessageBoard>() {
|
||||
messageBoardModel = new AbstractReadOnlyModel<MessageBoard>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected MessageBoard load() {
|
||||
public MessageBoard getObject() {
|
||||
return messageBoardDao.reLoad(messageBoard);
|
||||
}
|
||||
};
|
||||
if (boardMessageId != null) {
|
||||
final BoardMessage bm = boardMessageDao.load(Long.valueOf(boardMessageId));
|
||||
|
||||
if (bm != null && messageBoard.getBoardMessageSet().contains(bm)) {
|
||||
boardMessageModel = new LoadableDetachableModel<BoardMessage>() {
|
||||
if (bm != null) {
|
||||
boardMessageModel = new AbstractReadOnlyModel<BoardMessage>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected BoardMessage load() {
|
||||
public BoardMessage getObject() {
|
||||
return boardMessageDao.reLoad(bm);
|
||||
}
|
||||
};
|
||||
|
@ -11,6 +11,7 @@ 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.AbstractReadOnlyModel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.LoadableDetachableModel;
|
||||
import org.apache.wicket.protocol.http.RequestUtils;
|
||||
@ -56,22 +57,8 @@ public class SupervisorConferencePage extends AbstractSupervisorPage {
|
||||
|
||||
public SupervisorConferencePage(PageParameters pp) {
|
||||
super(pp);
|
||||
String projectId = pp.getString("pid");
|
||||
String boardMessageId = null;
|
||||
if (projectId != null) {
|
||||
StringTokenizer stringTokenizer = new StringTokenizer(projectId, "&");
|
||||
boolean first = true;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (stringTokenizer.hasMoreTokens()) {
|
||||
if (first) {
|
||||
projectId = stringTokenizer.nextToken().trim();
|
||||
first = false;
|
||||
} else {
|
||||
boardMessageId = stringTokenizer.nextToken().trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Long projectId = pp.getAsLong(PROJECTID);
|
||||
Long boardMessageId = pp.getAsLong("cid");
|
||||
if (projectId == null) {
|
||||
add(new EmptyPanel("conferencePanel"));
|
||||
} else {
|
||||
@ -122,23 +109,24 @@ public class SupervisorConferencePage extends AbstractSupervisorPage {
|
||||
messageBoard.setTitle(projectModel.getObject().getTitle());
|
||||
messageBoard = messageBoardDao.save(messageBoard);
|
||||
}
|
||||
messageBoardModel = new LoadableDetachableModel<MessageBoard>() {
|
||||
messageBoardModel = new AbstractReadOnlyModel<MessageBoard>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected MessageBoard load() {
|
||||
public MessageBoard getObject() {
|
||||
return messageBoardDao.reLoad(messageBoard);
|
||||
}
|
||||
|
||||
};
|
||||
if (boardMessageId != null) {
|
||||
final BoardMessage bm = boardMessageDao.load(Long.valueOf(boardMessageId));
|
||||
|
||||
if (bm != null && messageBoard.getBoardMessageSet().contains(bm)) {
|
||||
boardMessageModel = new LoadableDetachableModel<BoardMessage>() {
|
||||
if (bm != null) {
|
||||
boardMessageModel = new AbstractReadOnlyModel<BoardMessage>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected BoardMessage load() {
|
||||
public BoardMessage getObject() {
|
||||
return boardMessageDao.reLoad(bm);
|
||||
}
|
||||
};
|
||||
|
@ -32,6 +32,7 @@ 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.dataobjects.BoardMessage;
|
||||
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
@ -51,6 +52,8 @@ public class ConferencePanel extends Panel {
|
||||
private BoardMessageDao boardMessageDao;
|
||||
@SpringBean
|
||||
private CommentThreadDao commentThreadDao;
|
||||
@SpringBean
|
||||
private MessageBoardDao messageBoardDao;
|
||||
|
||||
@SpringBean
|
||||
private NotificationController notificationController;
|
||||
@ -61,6 +64,7 @@ public class ConferencePanel extends Panel {
|
||||
private IModel<BoardMessage> boardMessageModel;
|
||||
private Set<SubscriberModel> subscriberModels;
|
||||
private FeedbackPanel feedbackPanel;
|
||||
private final static int BOARDMESSAGESPERPAGE = 10;
|
||||
|
||||
public ConferencePanel(String id, IModel<MessageBoard> messageBoardModel,
|
||||
Set<SubscriberModel> subscriberModels, IModel<BoardMessage> boardMessageModel) {
|
||||
@ -80,7 +84,7 @@ public class ConferencePanel extends Panel {
|
||||
feedbackPanel = new FeedbackPanel("feedbackPanel");
|
||||
feedbackPanel.setOutputMarkupId(true);
|
||||
add(feedbackPanel);
|
||||
|
||||
|
||||
add(new SendWallMessageForm("sendForm"));
|
||||
webMarkupContainer = new WebMarkupContainer("container");
|
||||
loadUserDataView(new BoardMessageDataProvider(messageBoardModel));
|
||||
@ -88,11 +92,17 @@ public class ConferencePanel extends Panel {
|
||||
webMarkupContainer.setOutputMarkupId(true);
|
||||
webMarkupContainer.add(new PagingNavigator("pagingNavigator", dataView));
|
||||
add(webMarkupContainer);
|
||||
if (boardMessageModel != null) {
|
||||
|
||||
int index = boardMessageDao.getBoardMessageSortOrderIndex(boardMessageModel.getObject());
|
||||
System.out.println(index);
|
||||
dataView.setCurrentPage(index/BOARDMESSAGESPERPAGE);
|
||||
}
|
||||
}
|
||||
|
||||
public void loadUserDataView(IDataProvider<BoardMessage> boardMessageDataProvider) {
|
||||
|
||||
dataView = new DataView<BoardMessage>("boardMessageDataView", boardMessageDataProvider, 10) {
|
||||
dataView = new DataView<BoardMessage>("boardMessageDataView", boardMessageDataProvider, BOARDMESSAGESPERPAGE) {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -112,8 +122,10 @@ public class ConferencePanel extends Panel {
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
|
||||
BoardMessage boardMessageTemp = boardMessageDao.reLoad(bm);
|
||||
boardMessageDao.delete(boardMessageTemp);
|
||||
MessageBoard mb = messageBoardModel.getObject();
|
||||
mb.removeFromBoardMessages(boardMessageDao.reLoad(bm));
|
||||
messageBoardDao.save(mb);
|
||||
boardMessageDao.delete(boardMessageDao.reLoad(bm));
|
||||
webMarkupContainer.removeAll();
|
||||
loadUserDataView(new BoardMessageDataProvider(messageBoardModel));
|
||||
webMarkupContainer.add(dataView);
|
||||
@ -242,23 +254,28 @@ public class ConferencePanel extends Panel {
|
||||
} else {
|
||||
BoardMessage bm = new BoardMessage();
|
||||
bm.setMessage(message);
|
||||
bm.setMessageBoard(messageBoardModel.getObject());
|
||||
bm.setFromUser(SciProSession.get().getUser());
|
||||
bm = boardMessageDao.save(bm);
|
||||
|
||||
MessageBoard mb = messageBoardModel.getObject();
|
||||
mb.addToBoardMessages(bm);
|
||||
messageBoardDao.save(mb);
|
||||
|
||||
for (SubscriberModel subscriberModel : subscriberModels) {
|
||||
notificationController.notifyConferencePost(subscriberModel.getUser(), message, messageBoardModel.getObject().getTitle(),
|
||||
notificationController.notifyConferencePost(subscriberModel.getUser(),
|
||||
message, messageBoardModel.getObject().getTitle(),
|
||||
subscriberModel.getNotificationPriority(),
|
||||
subscriberModel.getAbsolutePath());
|
||||
}
|
||||
|
||||
messageTextArea.setDefaultModelObject("");
|
||||
webMarkupContainer.removeAll();
|
||||
loadUserDataView(new BoardMessageDataProvider(messageBoardModel));
|
||||
webMarkupContainer.add(dataView);
|
||||
webMarkupContainer.add(new PagingNavigator("pagingNavigator", dataView));
|
||||
target.addComponent(webMarkupContainer);
|
||||
target.addComponent(messageTextArea);
|
||||
|
||||
target.addComponent(messageTextArea);
|
||||
|
||||
}
|
||||
target.addComponent(feedbackPanel);
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ public class NotificationControllerImpl implements NotificationController {
|
||||
|
||||
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
||||
mailSubject, mailMessage);
|
||||
processNotification(user, notificationMessage, absolutePath + "&" + classId,
|
||||
processNotification(user, notificationMessage, absolutePath + "/cid/" + classId,
|
||||
notificationPriority);
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,6 @@ import java.util.List;
|
||||
|
||||
import se.su.dsv.scipro.data.dataobjects.BoardMessage;
|
||||
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
|
||||
/**
|
||||
* @author Johan Aschan - aschan@dsv.su.se
|
||||
@ -17,4 +16,6 @@ public interface BoardMessageDao extends Dao<BoardMessage>{
|
||||
final int count);
|
||||
public int getBoardMessageListCount(final MessageBoard mb);
|
||||
|
||||
public int getBoardMessageSortOrderIndex(final BoardMessage bm);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
package se.su.dsv.scipro.data.dao.interfaces;
|
||||
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListAnswer;
|
||||
|
||||
public interface CheckListAnswerDao extends Dao<CheckListAnswer> {
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package se.su.dsv.scipro.data.dao.interfaces;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckList;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
|
||||
public interface CheckListDao extends Dao<CheckList> {
|
||||
|
||||
public List<CheckList> findCheckLists(final Project project);
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package se.su.dsv.scipro.data.dao.interfaces;
|
||||
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
|
||||
|
||||
public interface CheckListQuestionDao extends Dao<CheckListQuestion> {
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package se.su.dsv.scipro.data.dao.interfaces;
|
||||
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListTemplate;
|
||||
|
||||
|
||||
public interface CheckListTemplateDao extends Dao<CheckListTemplate> {
|
||||
|
||||
}
|
@ -4,7 +4,6 @@
|
||||
package se.su.dsv.scipro.data.dao.interfaces;
|
||||
|
||||
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.data.dataobjects.interfaces.Commentable;
|
||||
|
||||
/**
|
||||
@ -15,6 +14,6 @@ import se.su.dsv.scipro.data.dataobjects.interfaces.Commentable;
|
||||
|
||||
public interface MessageBoardDao extends Dao<MessageBoard>{
|
||||
|
||||
public MessageBoard getMessageBoard(Commentable commentableDomainObject);
|
||||
|
||||
public MessageBoard getMessageBoard(final Commentable commentableDomainObject);
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.BoardMessageDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.BoardMessage;
|
||||
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
|
||||
/**
|
||||
* @author Johan Aschan - aschan@dsv.su.se
|
||||
@ -44,7 +43,7 @@ public class BoardMessageDaoJPAImp extends AbstractDaoJPAImp<BoardMessage>
|
||||
TypedQuery<BoardMessage> query = em
|
||||
.createQuery(
|
||||
"select bm FROM BoardMessage bm, MessageBoard mb " +
|
||||
"WHERE bm member of mb.boardMessageSet AND mb = :mb ORDER BY bm.dateCreated DESC", BoardMessage.class);
|
||||
"WHERE bm member of mb.boardMessages AND mb = :mb ORDER BY bm.dateCreated DESC", BoardMessage.class);
|
||||
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
||||
query.setParameter("mb", mb);
|
||||
query.setFirstResult(first);
|
||||
@ -68,7 +67,7 @@ public class BoardMessageDaoJPAImp extends AbstractDaoJPAImp<BoardMessage>
|
||||
TypedQuery<Long> query = em
|
||||
.createQuery(
|
||||
"SELECT COUNT (bm) FROM BoardMessage bm, MessageBoard mb " +
|
||||
"WHERE bm member of mb.boardMessageSet AND mb = :mb", Long.class);
|
||||
"WHERE bm member of mb.boardMessages AND mb = :mb", Long.class);
|
||||
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
||||
query.setParameter("mb", mb);
|
||||
return query.getSingleResult().intValue();
|
||||
@ -77,6 +76,24 @@ public class BoardMessageDaoJPAImp extends AbstractDaoJPAImp<BoardMessage>
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Hibernate seemms not to support the index operator for the moment, but this query should be used if it does in the future.
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public int getBoardMessageSortOrderIndex(final BoardMessage bm){
|
||||
return getJpaTemplate().execute(new JpaCallback<Integer>() {
|
||||
@Override
|
||||
public Integer doInJpa(EntityManager em)
|
||||
throws PersistenceException {
|
||||
TypedQuery<Integer> query = em
|
||||
.createQuery(
|
||||
"SELECT index(b) FROM MessageBoard mb JOIN mb.boardMessages b " +
|
||||
"WHERE b = :bm", Integer.class);
|
||||
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
||||
query.setParameter("bm", bm);
|
||||
return query.getSingleResult().intValue();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
package se.su.dsv.scipro.data.dao.jpa;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListAnswerDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListQuestionDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListAnswer;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Fredrik Norberg - fnorbe@dsv.su.se
|
||||
*
|
||||
*/
|
||||
|
||||
@Repository("checkListAnswerDao")
|
||||
public class CheckListAnswerDaoJPAImp extends AbstractDaoJPAImp<CheckListAnswer>
|
||||
implements CheckListAnswerDao {
|
||||
|
||||
public CheckListAnswerDaoJPAImp() {
|
||||
super(CheckListAnswer.class);
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package se.su.dsv.scipro.data.dao.jpa;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.NoResultException;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.persistence.TypedQuery;
|
||||
|
||||
import org.hibernate.ejb.QueryHints;
|
||||
import org.springframework.orm.jpa.JpaCallback;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckList;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Fredrik Norberg - fnorbe@dsv.su.se
|
||||
*
|
||||
*/
|
||||
|
||||
@Repository("checkListDao")
|
||||
public class CheckListDaoJPAImp extends AbstractDaoJPAImp<CheckList> implements CheckListDao {
|
||||
|
||||
public CheckListDaoJPAImp() {
|
||||
super(CheckList.class);
|
||||
}
|
||||
|
||||
public List<CheckList> findCheckLists(final Project project) {
|
||||
return getJpaTemplate().execute(new JpaCallback<List<CheckList>>() {
|
||||
public List<CheckList> doInJpa(EntityManager em) throws PersistenceException {
|
||||
String q = "select s " + "from CheckList s " + "where s.project = :project";
|
||||
|
||||
TypedQuery<CheckList> query = em.createQuery(q, CheckList.class);
|
||||
query.setParameter("project", project);
|
||||
query.setHint(QueryHints.HINT_CACHEABLE, "true");
|
||||
try {
|
||||
return query.getResultList();
|
||||
} catch (NoResultException e) {
|
||||
return new ArrayList<CheckList>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package se.su.dsv.scipro.data.dao.jpa;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListQuestionDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Fredrik Norberg - fnorbe@dsv.su.se
|
||||
*
|
||||
*/
|
||||
|
||||
@Repository("checkListQuestionDao")
|
||||
public class CheckListQuestionDaoJPAImp extends AbstractDaoJPAImp<CheckListQuestion>
|
||||
implements CheckListQuestionDao {
|
||||
|
||||
public CheckListQuestionDaoJPAImp() {
|
||||
super(CheckListQuestion.class);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package se.su.dsv.scipro.data.dao.jpa;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListQuestionDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.CheckListTemplateDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListQuestion;
|
||||
import se.su.dsv.scipro.data.dataobjects.CheckListTemplate;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Fredrik Norberg - fnorbe@dsv.su.se
|
||||
*
|
||||
*/
|
||||
|
||||
@Repository("checkListTemplateDao")
|
||||
public class CheckListTemplateDaoJPAImp extends AbstractDaoJPAImp<CheckListTemplate>
|
||||
implements CheckListTemplateDao {
|
||||
|
||||
public CheckListTemplateDaoJPAImp() {
|
||||
super(CheckListTemplate.class);
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import se.su.dsv.scipro.data.dao.interfaces.MessageBoardDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.BoardMessage;
|
||||
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.data.dataobjects.interfaces.Commentable;
|
||||
|
@ -7,14 +7,12 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.Cacheable;
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Lob;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Cache;
|
||||
@ -48,9 +46,6 @@ public class BoardMessage extends DomainObject implements Commentable, Comparabl
|
||||
@OneToMany
|
||||
private List<BoardMessage> replyMessageList = new ArrayList<BoardMessage>(0);
|
||||
|
||||
@ManyToOne(optional=false)
|
||||
private MessageBoard messageBoard;
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
@ -65,20 +60,6 @@ public class BoardMessage extends DomainObject implements Commentable, Comparabl
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the messageBoard
|
||||
*/
|
||||
public MessageBoard getMessageBoard() {
|
||||
return messageBoard;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param messageBoard the messageBoard to set
|
||||
*/
|
||||
public void setMessageBoard(MessageBoard messageBoard) {
|
||||
this.messageBoard = messageBoard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommentKey() {
|
||||
return BoardMessage.class.getCanonicalName().toString();
|
||||
@ -140,8 +121,6 @@ public class BoardMessage extends DomainObject implements Commentable, Comparabl
|
||||
}
|
||||
if(this.getId() != null && o.getId() != null)
|
||||
return this.getId().compareTo(o.getId());
|
||||
if(this.message != null && o.message != null)
|
||||
return message.compareTo(o.message);
|
||||
//By now we have to conclude the two objects are basically two objects full of nulls
|
||||
return 0;
|
||||
}
|
||||
|
137
src/main/java/se/su/dsv/scipro/data/dataobjects/CheckList.java
Normal file
137
src/main/java/se/su/dsv/scipro/data/dataobjects/CheckList.java
Normal file
@ -0,0 +1,137 @@
|
||||
package se.su.dsv.scipro.data.dataobjects;
|
||||
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import javax.persistence.Cacheable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Cache;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
import org.hibernate.annotations.Sort;
|
||||
import org.hibernate.annotations.SortType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Fredrik Norberg fnorbe@dsv.su.se
|
||||
*
|
||||
*/
|
||||
|
||||
@Entity
|
||||
@Table(name = "checklist")
|
||||
@Cacheable(true)
|
||||
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||
// Hibernate
|
||||
public class CheckList extends DomainObject {
|
||||
|
||||
private static final long serialVersionUID = 2959377496669050427L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Long id;
|
||||
|
||||
@Column(nullable = false)
|
||||
private String name;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
private Project project;
|
||||
|
||||
|
||||
@OneToMany
|
||||
@Sort(type = SortType.NATURAL)
|
||||
private SortedSet<CheckListQuestion> questions = new TreeSet<CheckListQuestion>();
|
||||
|
||||
public CheckList() {
|
||||
}
|
||||
|
||||
public CheckList(String name, Project project) {
|
||||
this.name = name;
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the questions
|
||||
*/
|
||||
public SortedSet<CheckListQuestion> getQuestions() {
|
||||
return questions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param questions
|
||||
* the questions to set
|
||||
*/
|
||||
public void setQuestions(SortedSet<CheckListQuestion> questions) {
|
||||
this.questions = questions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the project
|
||||
*/
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param project the project to set
|
||||
*/
|
||||
public void setProject(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int weight = 31;
|
||||
int result = 17;
|
||||
|
||||
result = weight * result + ((id == null) ? 0 : (int) (id ^ (id >>> 32)));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (obj instanceof CheckList) {
|
||||
|
||||
CheckList other = (CheckList) obj;
|
||||
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
package se.su.dsv.scipro.data.dataobjects;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Lob;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import se.su.dsv.scipro.data.enums.CheckListQuestionAnswer;
|
||||
|
||||
/**
|
||||
* @author Fredrik Norberg fnorbe@dsv.su.se
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "checklist_answer")
|
||||
public class CheckListAnswer extends DomainObject {
|
||||
|
||||
private static final long serialVersionUID = 2959377496669050427L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Long id;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(nullable=false)
|
||||
private CheckListQuestionAnswer answer;
|
||||
|
||||
@ManyToOne(optional=false)
|
||||
private User user;
|
||||
|
||||
@Lob
|
||||
private String comment;
|
||||
|
||||
public CheckListAnswer() {
|
||||
}
|
||||
|
||||
public CheckListAnswer(User user, CheckListQuestionAnswer answer) {
|
||||
this.user = user;
|
||||
this.answer = answer;
|
||||
}
|
||||
|
||||
public CheckListAnswer(User user, CheckListQuestionAnswer answer, String comment) {
|
||||
this.user = user;
|
||||
this.answer = answer;
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public CheckListQuestionAnswer getAnswer() {
|
||||
return answer;
|
||||
}
|
||||
|
||||
public void setAnswer(CheckListQuestionAnswer answer) {
|
||||
this.answer = answer;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return the comment
|
||||
*/
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param comment the comment to set
|
||||
*/
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int weight = 31;
|
||||
int result = 17;
|
||||
|
||||
result = weight * result + ((id == null) ? 0 : (int) (id ^ (id >>> 32)));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (obj instanceof CheckListAnswer) {
|
||||
|
||||
CheckListAnswer other = (CheckListAnswer) obj;
|
||||
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,133 @@
|
||||
package se.su.dsv.scipro.data.dataobjects;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.Cacheable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Lob;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Cache;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
|
||||
/**
|
||||
* @author Fredrik Norberg - fnorbe@dsv.su.se
|
||||
*/
|
||||
|
||||
@Entity
|
||||
@Table(name = "checklist_question")
|
||||
@Cacheable(true)
|
||||
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||
public class CheckListQuestion extends DomainObject implements
|
||||
Comparable<CheckListQuestion> {
|
||||
|
||||
private static final long serialVersionUID = 2959377496669050427L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Long id;
|
||||
|
||||
@Lob
|
||||
@Column(nullable = false)
|
||||
private String question;
|
||||
|
||||
@Column(nullable = false)
|
||||
private int questionNumber;
|
||||
|
||||
@OneToMany
|
||||
private List<CheckListAnswer> answers = new ArrayList<CheckListAnswer>(1);
|
||||
|
||||
public CheckListQuestion() {
|
||||
}
|
||||
|
||||
public CheckListQuestion(String question) {
|
||||
this.question = question;
|
||||
questionNumber = answers.size() + 1;
|
||||
}
|
||||
|
||||
public String getQuestion() {
|
||||
return question;
|
||||
}
|
||||
|
||||
public void setQuestion(String question) {
|
||||
this.question = question;
|
||||
}
|
||||
|
||||
public int getQuestionNumber() {
|
||||
return questionNumber;
|
||||
}
|
||||
|
||||
public void setQuestionNumber(int questionNumber) {
|
||||
this.questionNumber = questionNumber;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return the answers
|
||||
*/
|
||||
public List<CheckListAnswer> getAnswers() {
|
||||
return answers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param answers the answers to set
|
||||
*/
|
||||
public void setAnswers(List<CheckListAnswer> answers) {
|
||||
this.answers = answers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int weight = 31;
|
||||
int result = 17;
|
||||
|
||||
result = weight * result + ((id == null) ? 0 : (int) (id ^ (id >>> 32)));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (obj instanceof CheckListQuestion) {
|
||||
|
||||
CheckListQuestion other = (CheckListQuestion) obj;
|
||||
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getQuestion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(CheckListQuestion other) {
|
||||
return other.questionNumber - questionNumber;
|
||||
}
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
package se.su.dsv.scipro.data.dataobjects;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.ElementCollection;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Lob;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* @author Fredrik Norberg - fnorbe@dsv.su.se
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="checklist_template")
|
||||
public class CheckListTemplate extends DomainObject {
|
||||
|
||||
private static final long serialVersionUID = 2959377496669050427L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Long id;
|
||||
|
||||
@Column(nullable=false)
|
||||
private String name;
|
||||
|
||||
@Lob
|
||||
@ElementCollection
|
||||
private List<String> questions = new ArrayList<String>(1);
|
||||
|
||||
@ManyToOne(optional=false)
|
||||
private User creator;
|
||||
|
||||
@ManyToOne(optional=false)
|
||||
private ProjectClass level;
|
||||
|
||||
public CheckListTemplate() {}
|
||||
|
||||
public CheckListTemplate(String name, User creator) {
|
||||
this.name = name;
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setCreator(User creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
public User getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
public List<String> getQuestions(){
|
||||
return questions;
|
||||
}
|
||||
|
||||
public void setQuestions(List<String> questions){
|
||||
this.questions = questions;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the level
|
||||
*/
|
||||
public ProjectClass getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param level the level to set
|
||||
*/
|
||||
public void setLevel(ProjectClass level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int weight = 31;
|
||||
int result = 17;
|
||||
|
||||
result = weight * result + ((id == null) ? 0 : (int) (id ^ (id >>> 32)));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (obj instanceof CheckListTemplate){
|
||||
|
||||
CheckListTemplate other = (CheckListTemplate) obj;
|
||||
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@
|
||||
package se.su.dsv.scipro.data.dataobjects;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
@ -15,7 +16,10 @@ import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OrderBy;
|
||||
import javax.persistence.OrderColumn;
|
||||
import javax.persistence.PrePersist;
|
||||
import javax.persistence.PreUpdate;
|
||||
import javax.persistence.Table;
|
||||
@ -70,32 +74,27 @@ public class MessageBoard extends DomainObject{
|
||||
if(getCommentableKey().length() > 255)
|
||||
throw new IllegalArgumentException("CommentThread-commentableKey may not be longer than 255 characters");
|
||||
}
|
||||
|
||||
|
||||
@OrderColumn(name="orderIndex")
|
||||
@ManyToMany
|
||||
private List<BoardMessage> boardMessages = new ArrayList<BoardMessage>();
|
||||
|
||||
|
||||
@Sort(type=SortType.NATURAL)
|
||||
@OneToMany(mappedBy="messageBoard", orphanRemoval=true, cascade=CascadeType.ALL, targetEntity=BoardMessage.class)
|
||||
private SortedSet<BoardMessage> boardMessageSet = new TreeSet<BoardMessage>();
|
||||
|
||||
|
||||
public List<BoardMessage> getBoardMessageList() {
|
||||
return new ArrayList<BoardMessage>(boardMessageSet);
|
||||
}
|
||||
|
||||
public SortedSet<BoardMessage> getBoardMessageSet() {
|
||||
return boardMessageSet;
|
||||
}
|
||||
|
||||
|
||||
public void setBoardMessageSet( SortedSet<BoardMessage> boardMessageList) {
|
||||
this.boardMessageSet = boardMessageList;
|
||||
}
|
||||
/**
|
||||
* @return the commentableKey
|
||||
*/
|
||||
public String getCommentableKey() {
|
||||
return commentableKey;
|
||||
}
|
||||
|
||||
public void addToBoardMessages(BoardMessage boardMessage){
|
||||
int pos = Collections.binarySearch(boardMessages, boardMessage);
|
||||
if (pos < 0) {
|
||||
pos = -pos - 1;
|
||||
}
|
||||
boardMessages.add(pos, boardMessage);
|
||||
}
|
||||
|
||||
public void removeFromBoardMessages(BoardMessage boardMessage){
|
||||
boardMessages.remove(boardMessage);
|
||||
}
|
||||
/**
|
||||
* @param commentableKey the commentableKey to set
|
||||
*/
|
||||
|
@ -0,0 +1,7 @@
|
||||
package se.su.dsv.scipro.data.enums;
|
||||
|
||||
public enum CheckListQuestionAnswer {
|
||||
RED,
|
||||
GREEN,
|
||||
YELLOW
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:extend>
|
||||
<!-- <div wicket:id="trafficLightPanel"></div> -->
|
||||
<!-- <div wicket:id="createCheckList"></div> -->
|
||||
</wicket:extend>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,22 @@
|
||||
package se.su.dsv.scipro.project.pages;
|
||||
|
||||
import org.apache.wicket.PageParameters;
|
||||
|
||||
import se.su.dsv.scipro.security.auth.Authorization;
|
||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||
|
||||
/**
|
||||
* @author Fredrik Norberg - fnorbe@dsv.su.se
|
||||
*
|
||||
*/
|
||||
|
||||
@Authorization(authorizedRoles={Roles.SYSADMIN}) //TODO Hidden for initial deployment
|
||||
public class ProjectChecklistPage extends ProjectPage {
|
||||
|
||||
public ProjectChecklistPage(PageParameters pp) {
|
||||
super(pp);
|
||||
//add(new TrafficLightPanel("trafficLightPanel"));
|
||||
//add(new CreateCheckListTemplatePanel("createCheckList"));
|
||||
}
|
||||
|
||||
}
|
@ -27,6 +27,7 @@ public abstract class ProjectPage extends MenuPage implements FilePanelContainer
|
||||
public ProjectPage(PageParameters pp) {
|
||||
|
||||
Project activeProject = SciProSession.get().getActiveProject();
|
||||
User u = SciProSession.get().getUser();
|
||||
|
||||
if(activeProject == null && (this.getClass() != NoActiveProjectPage.class && this.getClass() != ProjectPartnerPage.class)){
|
||||
User user = SciProSession.get().getUser();
|
||||
|
@ -18,6 +18,7 @@ import se.su.dsv.scipro.project.pages.ProjectPage;
|
||||
import se.su.dsv.scipro.project.pages.ProjectPartnerPage;
|
||||
import se.su.dsv.scipro.project.pages.ProjectSchedulePlannerPage;
|
||||
import se.su.dsv.scipro.project.pages.ProjectStartPage;
|
||||
import se.su.dsv.scipro.project.pages.ProjectChecklistPage;
|
||||
import se.su.dsv.scipro.repository.panels.ProjectFilePanel;
|
||||
|
||||
/**
|
||||
@ -47,6 +48,7 @@ public class ProjectTabMenuPanel extends AbstractMenuPanel {
|
||||
itemList.add(new MenuItem("Peer review", ProjectPeerPortalPage.class));
|
||||
itemList.add(new MenuItem("All Final Seminars", FinalSeminarProjectListPage.class));
|
||||
itemList.add(new MenuItem("Conference", ProjectConferencePage.class));
|
||||
itemList.add(new MenuItem("Checklists", ProjectChecklistPage.class));
|
||||
} else {
|
||||
itemList.add(new MenuItem("No active project!", NoActiveProjectPage.class));
|
||||
itemList.add(new MenuItem("Project Partner", ProjectPartnerPage.class));
|
||||
|
@ -67,6 +67,10 @@
|
||||
<class>se.su.dsv.scipro.data.dataobjects.ProjectPartner</class>
|
||||
<class>se.su.dsv.scipro.data.dataobjects.CheckPlagiarismEvent</class>
|
||||
<class>se.su.dsv.scipro.data.dataobjects.WebNotification</class>
|
||||
<class>se.su.dsv.scipro.data.dataobjects.CheckListTemplate</class>
|
||||
<class>se.su.dsv.scipro.data.dataobjects.CheckList</class>
|
||||
<class>se.su.dsv.scipro.data.dataobjects.CheckListAnswer</class>
|
||||
<class>se.su.dsv.scipro.data.dataobjects.CheckListQuestion</class>
|
||||
|
||||
<properties>
|
||||
|
||||
@ -171,6 +175,10 @@
|
||||
<class>se.su.dsv.scipro.data.dataobjects.ProjectPartner</class>
|
||||
<class>se.su.dsv.scipro.data.dataobjects.CheckPlagiarismEvent</class>
|
||||
<class>se.su.dsv.scipro.data.dataobjects.WebNotification</class>
|
||||
<class>se.su.dsv.scipro.data.dataobjects.CheckListTemplate</class>
|
||||
<class>se.su.dsv.scipro.data.dataobjects.CheckList</class>
|
||||
<class>se.su.dsv.scipro.data.dataobjects.CheckListAnswer</class>
|
||||
<class>se.su.dsv.scipro.data.dataobjects.CheckListQuestion</class>
|
||||
|
||||
|
||||
<properties>
|
||||
|
@ -1,6 +1,6 @@
|
||||
log4j.appender.Stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.Stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.Stdout.layout.conversionPattern=%d{HH:mm:ss,SSS}[%p] - %c{1} - %m\n
|
||||
log4j.appender.Stdout.layout.conversionPattern=%d{yyyy MMM dd HH:mm:ss,SSS}[%p] - %c{1} - %m\n
|
||||
|
||||
log4j.rootLogger=INFO,Stdout
|
||||
|
||||
|
@ -64,8 +64,8 @@
|
||||
<!-- Use deployment for production, development for development -->
|
||||
<context-param>
|
||||
<param-name>configuration</param-name>
|
||||
<!-- <param-value>development</param-value> -->
|
||||
<param-value>deployment</param-value>
|
||||
<param-value>development</param-value>
|
||||
<!-- <param-value>deployment</param-value>-->
|
||||
</context-param>
|
||||
|
||||
|
||||
|
@ -1053,3 +1053,7 @@ div.wicket-aa ul li.selected {
|
||||
font-size: 1.4em;
|
||||
font-style: strong;
|
||||
}
|
||||
|
||||
body {
|
||||
font: 0.8em/21px arial,sans-serif;
|
||||
}
|
||||
|
BIN
src/main/webapp/images/icons/grey_ball_32.png
Normal file
BIN
src/main/webapp/images/icons/grey_ball_32.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 1.1 KiB |
@ -94,17 +94,24 @@ public class TestBoardMessageDaoJPA {
|
||||
|
||||
Set<User> subscribers = new HashSet<User>();
|
||||
subscribers.add(user);
|
||||
messageBoard = new MessageBoard(presenterProject);
|
||||
messageBoard.setTitle("test");
|
||||
messageBoard = messageBoardDao.save(messageBoard);
|
||||
|
||||
|
||||
|
||||
|
||||
boardMessage = new BoardMessage();
|
||||
boardMessage.setFromUser(user);
|
||||
boardMessage.setMessage("Test");
|
||||
boardMessage.setMessageBoard(messageBoard);
|
||||
boardMessage = boardMessageDao.save(boardMessage);
|
||||
|
||||
boardMessage = new BoardMessage();
|
||||
boardMessage.setFromUser(user);
|
||||
boardMessage.setMessage("Test");
|
||||
boardMessage = boardMessageDao.save(boardMessage);
|
||||
|
||||
messageBoard = new MessageBoard(presenterProject);
|
||||
messageBoard.setTitle("test");
|
||||
messageBoard.addToBoardMessages(boardMessage);
|
||||
messageBoard = messageBoardDao.save(messageBoard);
|
||||
|
||||
|
||||
}
|
||||
@ -123,5 +130,11 @@ public class TestBoardMessageDaoJPA {
|
||||
Assert.assertEquals(1, boardMessageDao.getBoardMessageListCount(messageBoard));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
public void getBoardMessageSortOrderIndex() {
|
||||
Assert.assertEquals(0, boardMessageDao.getBoardMessageSortOrderIndex(boardMessage));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user