Merge branch 'develop' of ssh://git.dsv.su.se/git/scipro/scipro into develop
This commit is contained in:
commit
fb4d39e40d
src
main
java/se/su/dsv/scipro
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
peer/pages
project
resources/META-INF
webapp/css
test/java/se/su/dsv/scipro/dao/jpa
@ -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.peer.pages.PeerReviewTemplatePage;
|
||||||
import se.su.dsv.scipro.project.pages.FinalSeminarProjectListPage;
|
import se.su.dsv.scipro.project.pages.FinalSeminarProjectListPage;
|
||||||
import se.su.dsv.scipro.project.pages.ProjectOppositionPage;
|
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.ProjectStartPage;
|
||||||
|
import se.su.dsv.scipro.project.pages.ProjectChecklistPage;
|
||||||
import se.su.dsv.scipro.security.auth.MetaDataActionStrategy;
|
import se.su.dsv.scipro.security.auth.MetaDataActionStrategy;
|
||||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||||
import se.su.dsv.scipro.supervisor.pages.SupervisorProjectsFinalSeminarPage;
|
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,29 @@
|
|||||||
|
<!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="stateOfMindContainer">
|
||||||
|
<form wicket:id="form">
|
||||||
|
<table wicket:id="group">
|
||||||
|
<tr wicket:id="persons">
|
||||||
|
<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>
|
||||||
|
</wicket:panel>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,148 @@
|
|||||||
|
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.WebPage;
|
||||||
|
import org.apache.wicket.markup.html.basic.Label;
|
||||||
|
import org.apache.wicket.markup.html.form.Form;
|
||||||
|
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.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 TrafficLightPanel extends Panel {
|
||||||
|
|
||||||
|
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 stateOfMindContainer = new WebMarkupContainer("stateOfMindContainer");
|
||||||
|
add(stateOfMindContainer);
|
||||||
|
|
||||||
|
Form<StateOfMind> f = new Form<StateOfMind>("form");
|
||||||
|
stateOfMindContainer.add(f);
|
||||||
|
RadioGroup<StateOfMind> group = new RadioGroup<StateOfMind>("group");
|
||||||
|
f.add(group);
|
||||||
|
|
||||||
|
ListView<StateOfMind> persons = new ListView<StateOfMind>("persons",
|
||||||
|
Arrays.asList(StateOfMind.values())) {
|
||||||
|
protected void populateItem(ListItem<StateOfMind> item) {
|
||||||
|
StateOfMind stateOfMind = item.getModelObject();
|
||||||
|
item.add(new Radio<StateOfMind>("radio", item.getModel()));
|
||||||
|
StaticImage image = null;
|
||||||
|
if (stateOfMind.equals(StateOfMind.FINE)) {
|
||||||
|
image = new StaticImage("image", new Model<String>(
|
||||||
|
"images/icons/green_ball_32.png"));
|
||||||
|
} else if (stateOfMind.equals(StateOfMind.NEEDHELP)) {
|
||||||
|
image = new StaticImage("image", new Model<String>(
|
||||||
|
"images/icons/red_ball_32.png"));
|
||||||
|
} else if (stateOfMind.equals(StateOfMind.NEUTRAL)) {
|
||||||
|
image = new StaticImage("image", new Model<String>(
|
||||||
|
"images/icons/yellow_ball_32.png"));
|
||||||
|
}
|
||||||
|
item.add(image);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
group.add(persons);
|
||||||
|
|
||||||
|
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.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.StringTokenizer;
|
|
||||||
|
|
||||||
import org.apache.wicket.PageParameters;
|
import org.apache.wicket.PageParameters;
|
||||||
import org.apache.wicket.RequestCycle;
|
import org.apache.wicket.RequestCycle;
|
||||||
import org.apache.wicket.RestartResponseException;
|
import org.apache.wicket.RestartResponseException;
|
||||||
import org.apache.wicket.markup.html.panel.EmptyPanel;
|
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.IModel;
|
||||||
import org.apache.wicket.model.LoadableDetachableModel;
|
import org.apache.wicket.model.LoadableDetachableModel;
|
||||||
import org.apache.wicket.protocol.http.RequestUtils;
|
import org.apache.wicket.protocol.http.RequestUtils;
|
||||||
@ -53,24 +53,10 @@ public class ProjectConferencePage extends ProjectPage {
|
|||||||
|
|
||||||
public ProjectConferencePage(PageParameters pp) {
|
public ProjectConferencePage(PageParameters pp) {
|
||||||
super(pp);
|
super(pp);
|
||||||
String projectId = pp.getString("pid");
|
Long projectId = pp.getAsLong("pid");
|
||||||
String boardMessageId = null;
|
Long boardMessageId = pp.getAsLong("cid");
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (projectId == null && SciProSession.get().getActiveProject() != null) {
|
if (projectId == null && SciProSession.get().getActiveProject() != null) {
|
||||||
projectId = String.valueOf(SciProSession.get().getActiveProject().getId());
|
projectId = SciProSession.get().getActiveProject().getId();
|
||||||
}
|
}
|
||||||
if (projectId != null) {
|
if (projectId != null) {
|
||||||
final Project project = projectDao.load(Long.valueOf(projectId));
|
final Project project = projectDao.load(Long.valueOf(projectId));
|
||||||
@ -126,23 +112,23 @@ public class ProjectConferencePage extends ProjectPage {
|
|||||||
messageBoard.setTitle(projectModel.getObject().getTitle());
|
messageBoard.setTitle(projectModel.getObject().getTitle());
|
||||||
messageBoard = messageBoardDao.save(messageBoard);
|
messageBoard = messageBoardDao.save(messageBoard);
|
||||||
}
|
}
|
||||||
messageBoardModel = new LoadableDetachableModel<MessageBoard>() {
|
messageBoardModel = new AbstractReadOnlyModel<MessageBoard>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected MessageBoard load() {
|
public MessageBoard getObject() {
|
||||||
return messageBoardDao.reLoad(messageBoard);
|
return messageBoardDao.reLoad(messageBoard);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (boardMessageId != null) {
|
if (boardMessageId != null) {
|
||||||
final BoardMessage bm = boardMessageDao.load(Long.valueOf(boardMessageId));
|
final BoardMessage bm = boardMessageDao.load(Long.valueOf(boardMessageId));
|
||||||
|
|
||||||
if (bm != null && messageBoard.getBoardMessageSet().contains(bm)) {
|
if (bm != null) {
|
||||||
boardMessageModel = new LoadableDetachableModel<BoardMessage>() {
|
boardMessageModel = new AbstractReadOnlyModel<BoardMessage>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BoardMessage load() {
|
public BoardMessage getObject() {
|
||||||
return boardMessageDao.reLoad(bm);
|
return boardMessageDao.reLoad(bm);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -11,6 +11,7 @@ import org.apache.wicket.PageParameters;
|
|||||||
import org.apache.wicket.RequestCycle;
|
import org.apache.wicket.RequestCycle;
|
||||||
import org.apache.wicket.RestartResponseException;
|
import org.apache.wicket.RestartResponseException;
|
||||||
import org.apache.wicket.markup.html.panel.EmptyPanel;
|
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.IModel;
|
||||||
import org.apache.wicket.model.LoadableDetachableModel;
|
import org.apache.wicket.model.LoadableDetachableModel;
|
||||||
import org.apache.wicket.protocol.http.RequestUtils;
|
import org.apache.wicket.protocol.http.RequestUtils;
|
||||||
@ -56,22 +57,8 @@ public class SupervisorConferencePage extends AbstractSupervisorPage {
|
|||||||
|
|
||||||
public SupervisorConferencePage(PageParameters pp) {
|
public SupervisorConferencePage(PageParameters pp) {
|
||||||
super(pp);
|
super(pp);
|
||||||
String projectId = pp.getString("pid");
|
Long projectId = pp.getAsLong(PROJECTID);
|
||||||
String boardMessageId = null;
|
Long boardMessageId = pp.getAsLong("cid");
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (projectId == null) {
|
if (projectId == null) {
|
||||||
add(new EmptyPanel("conferencePanel"));
|
add(new EmptyPanel("conferencePanel"));
|
||||||
} else {
|
} else {
|
||||||
@ -122,23 +109,24 @@ public class SupervisorConferencePage extends AbstractSupervisorPage {
|
|||||||
messageBoard.setTitle(projectModel.getObject().getTitle());
|
messageBoard.setTitle(projectModel.getObject().getTitle());
|
||||||
messageBoard = messageBoardDao.save(messageBoard);
|
messageBoard = messageBoardDao.save(messageBoard);
|
||||||
}
|
}
|
||||||
messageBoardModel = new LoadableDetachableModel<MessageBoard>() {
|
messageBoardModel = new AbstractReadOnlyModel<MessageBoard>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected MessageBoard load() {
|
public MessageBoard getObject() {
|
||||||
return messageBoardDao.reLoad(messageBoard);
|
return messageBoardDao.reLoad(messageBoard);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
if (boardMessageId != null) {
|
if (boardMessageId != null) {
|
||||||
final BoardMessage bm = boardMessageDao.load(Long.valueOf(boardMessageId));
|
final BoardMessage bm = boardMessageDao.load(Long.valueOf(boardMessageId));
|
||||||
|
|
||||||
if (bm != null && messageBoard.getBoardMessageSet().contains(bm)) {
|
if (bm != null) {
|
||||||
boardMessageModel = new LoadableDetachableModel<BoardMessage>() {
|
boardMessageModel = new AbstractReadOnlyModel<BoardMessage>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BoardMessage load() {
|
public BoardMessage getObject() {
|
||||||
return boardMessageDao.reLoad(bm);
|
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.controllers.NotificationMessage;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.BoardMessageDao;
|
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.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.BoardMessage;
|
||||||
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
@ -51,6 +52,8 @@ public class ConferencePanel extends Panel {
|
|||||||
private BoardMessageDao boardMessageDao;
|
private BoardMessageDao boardMessageDao;
|
||||||
@SpringBean
|
@SpringBean
|
||||||
private CommentThreadDao commentThreadDao;
|
private CommentThreadDao commentThreadDao;
|
||||||
|
@SpringBean
|
||||||
|
private MessageBoardDao messageBoardDao;
|
||||||
|
|
||||||
@SpringBean
|
@SpringBean
|
||||||
private NotificationController notificationController;
|
private NotificationController notificationController;
|
||||||
@ -61,6 +64,7 @@ public class ConferencePanel extends Panel {
|
|||||||
private IModel<BoardMessage> boardMessageModel;
|
private IModel<BoardMessage> boardMessageModel;
|
||||||
private Set<SubscriberModel> subscriberModels;
|
private Set<SubscriberModel> subscriberModels;
|
||||||
private FeedbackPanel feedbackPanel;
|
private FeedbackPanel feedbackPanel;
|
||||||
|
private final static int BOARDMESSAGESPERPAGE = 10;
|
||||||
|
|
||||||
public ConferencePanel(String id, IModel<MessageBoard> messageBoardModel,
|
public ConferencePanel(String id, IModel<MessageBoard> messageBoardModel,
|
||||||
Set<SubscriberModel> subscriberModels, IModel<BoardMessage> boardMessageModel) {
|
Set<SubscriberModel> subscriberModels, IModel<BoardMessage> boardMessageModel) {
|
||||||
@ -80,7 +84,7 @@ public class ConferencePanel extends Panel {
|
|||||||
feedbackPanel = new FeedbackPanel("feedbackPanel");
|
feedbackPanel = new FeedbackPanel("feedbackPanel");
|
||||||
feedbackPanel.setOutputMarkupId(true);
|
feedbackPanel.setOutputMarkupId(true);
|
||||||
add(feedbackPanel);
|
add(feedbackPanel);
|
||||||
|
|
||||||
add(new SendWallMessageForm("sendForm"));
|
add(new SendWallMessageForm("sendForm"));
|
||||||
webMarkupContainer = new WebMarkupContainer("container");
|
webMarkupContainer = new WebMarkupContainer("container");
|
||||||
loadUserDataView(new BoardMessageDataProvider(messageBoardModel));
|
loadUserDataView(new BoardMessageDataProvider(messageBoardModel));
|
||||||
@ -88,11 +92,17 @@ public class ConferencePanel extends Panel {
|
|||||||
webMarkupContainer.setOutputMarkupId(true);
|
webMarkupContainer.setOutputMarkupId(true);
|
||||||
webMarkupContainer.add(new PagingNavigator("pagingNavigator", dataView));
|
webMarkupContainer.add(new PagingNavigator("pagingNavigator", dataView));
|
||||||
add(webMarkupContainer);
|
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) {
|
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;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ -112,8 +122,10 @@ public class ConferencePanel extends Panel {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(AjaxRequestTarget target) {
|
public void onClick(AjaxRequestTarget target) {
|
||||||
|
|
||||||
BoardMessage boardMessageTemp = boardMessageDao.reLoad(bm);
|
MessageBoard mb = messageBoardModel.getObject();
|
||||||
boardMessageDao.delete(boardMessageTemp);
|
mb.removeFromBoardMessages(boardMessageDao.reLoad(bm));
|
||||||
|
messageBoardDao.save(mb);
|
||||||
|
boardMessageDao.delete(boardMessageDao.reLoad(bm));
|
||||||
webMarkupContainer.removeAll();
|
webMarkupContainer.removeAll();
|
||||||
loadUserDataView(new BoardMessageDataProvider(messageBoardModel));
|
loadUserDataView(new BoardMessageDataProvider(messageBoardModel));
|
||||||
webMarkupContainer.add(dataView);
|
webMarkupContainer.add(dataView);
|
||||||
@ -242,23 +254,28 @@ public class ConferencePanel extends Panel {
|
|||||||
} else {
|
} else {
|
||||||
BoardMessage bm = new BoardMessage();
|
BoardMessage bm = new BoardMessage();
|
||||||
bm.setMessage(message);
|
bm.setMessage(message);
|
||||||
bm.setMessageBoard(messageBoardModel.getObject());
|
|
||||||
bm.setFromUser(SciProSession.get().getUser());
|
bm.setFromUser(SciProSession.get().getUser());
|
||||||
bm = boardMessageDao.save(bm);
|
bm = boardMessageDao.save(bm);
|
||||||
|
|
||||||
|
MessageBoard mb = messageBoardModel.getObject();
|
||||||
|
mb.addToBoardMessages(bm);
|
||||||
|
messageBoardDao.save(mb);
|
||||||
|
|
||||||
for (SubscriberModel subscriberModel : subscriberModels) {
|
for (SubscriberModel subscriberModel : subscriberModels) {
|
||||||
notificationController.notifyConferencePost(subscriberModel.getUser(), message, messageBoardModel.getObject().getTitle(),
|
notificationController.notifyConferencePost(subscriberModel.getUser(),
|
||||||
|
message, messageBoardModel.getObject().getTitle(),
|
||||||
subscriberModel.getNotificationPriority(),
|
subscriberModel.getNotificationPriority(),
|
||||||
subscriberModel.getAbsolutePath());
|
subscriberModel.getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
messageTextArea.setDefaultModelObject("");
|
messageTextArea.setDefaultModelObject("");
|
||||||
webMarkupContainer.removeAll();
|
webMarkupContainer.removeAll();
|
||||||
loadUserDataView(new BoardMessageDataProvider(messageBoardModel));
|
loadUserDataView(new BoardMessageDataProvider(messageBoardModel));
|
||||||
webMarkupContainer.add(dataView);
|
webMarkupContainer.add(dataView);
|
||||||
webMarkupContainer.add(new PagingNavigator("pagingNavigator", dataView));
|
webMarkupContainer.add(new PagingNavigator("pagingNavigator", dataView));
|
||||||
target.addComponent(webMarkupContainer);
|
target.addComponent(webMarkupContainer);
|
||||||
target.addComponent(messageTextArea);
|
target.addComponent(messageTextArea);
|
||||||
|
|
||||||
}
|
}
|
||||||
target.addComponent(feedbackPanel);
|
target.addComponent(feedbackPanel);
|
||||||
}
|
}
|
||||||
|
@ -224,7 +224,7 @@ public class NotificationControllerImpl implements NotificationController {
|
|||||||
|
|
||||||
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
NotificationMessage notificationMessage = new NotificationMessage(webNotificationMessage,
|
||||||
mailSubject, mailMessage);
|
mailSubject, mailMessage);
|
||||||
processNotification(user, notificationMessage, absolutePath + "&" + classId,
|
processNotification(user, notificationMessage, absolutePath + "/cid/" + classId,
|
||||||
notificationPriority);
|
notificationPriority);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.BoardMessage;
|
import se.su.dsv.scipro.data.dataobjects.BoardMessage;
|
||||||
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
* @author Johan Aschan - aschan@dsv.su.se
|
||||||
@ -17,4 +16,6 @@ public interface BoardMessageDao extends Dao<BoardMessage>{
|
|||||||
final int count);
|
final int count);
|
||||||
public int getBoardMessageListCount(final MessageBoard mb);
|
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;
|
package se.su.dsv.scipro.data.dao.interfaces;
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
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;
|
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 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.dao.interfaces.BoardMessageDao;
|
||||||
import se.su.dsv.scipro.data.dataobjects.BoardMessage;
|
import se.su.dsv.scipro.data.dataobjects.BoardMessage;
|
||||||
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
import se.su.dsv.scipro.data.dataobjects.MessageBoard;
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Johan Aschan - aschan@dsv.su.se
|
* @author Johan Aschan - aschan@dsv.su.se
|
||||||
@ -44,7 +43,7 @@ public class BoardMessageDaoJPAImp extends AbstractDaoJPAImp<BoardMessage>
|
|||||||
TypedQuery<BoardMessage> query = em
|
TypedQuery<BoardMessage> query = em
|
||||||
.createQuery(
|
.createQuery(
|
||||||
"select bm FROM BoardMessage bm, MessageBoard mb " +
|
"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.setHint(QueryHints.HINT_CACHEABLE, "true");
|
||||||
query.setParameter("mb", mb);
|
query.setParameter("mb", mb);
|
||||||
query.setFirstResult(first);
|
query.setFirstResult(first);
|
||||||
@ -68,7 +67,7 @@ public class BoardMessageDaoJPAImp extends AbstractDaoJPAImp<BoardMessage>
|
|||||||
TypedQuery<Long> query = em
|
TypedQuery<Long> query = em
|
||||||
.createQuery(
|
.createQuery(
|
||||||
"SELECT COUNT (bm) FROM BoardMessage bm, MessageBoard mb " +
|
"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.setHint(QueryHints.HINT_CACHEABLE, "true");
|
||||||
query.setParameter("mb", mb);
|
query.setParameter("mb", mb);
|
||||||
return query.getSingleResult().intValue();
|
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 org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.MessageBoardDao;
|
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.MessageBoard;
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
import se.su.dsv.scipro.data.dataobjects.interfaces.Commentable;
|
import se.su.dsv.scipro.data.dataobjects.interfaces.Commentable;
|
||||||
|
@ -7,14 +7,12 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.persistence.Cacheable;
|
import javax.persistence.Cacheable;
|
||||||
import javax.persistence.CascadeType;
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Lob;
|
import javax.persistence.Lob;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.OneToOne;
|
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.Cache;
|
import org.hibernate.annotations.Cache;
|
||||||
@ -48,9 +46,6 @@ public class BoardMessage extends DomainObject implements Commentable, Comparabl
|
|||||||
@OneToMany
|
@OneToMany
|
||||||
private List<BoardMessage> replyMessageList = new ArrayList<BoardMessage>(0);
|
private List<BoardMessage> replyMessageList = new ArrayList<BoardMessage>(0);
|
||||||
|
|
||||||
@ManyToOne(optional=false)
|
|
||||||
private MessageBoard messageBoard;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
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
|
@Override
|
||||||
public String getCommentKey() {
|
public String getCommentKey() {
|
||||||
return BoardMessage.class.getCanonicalName().toString();
|
return BoardMessage.class.getCanonicalName().toString();
|
||||||
@ -140,8 +121,6 @@ public class BoardMessage extends DomainObject implements Commentable, Comparabl
|
|||||||
}
|
}
|
||||||
if(this.getId() != null && o.getId() != null)
|
if(this.getId() != null && o.getId() != null)
|
||||||
return this.getId().compareTo(o.getId());
|
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
|
//By now we have to conclude the two objects are basically two objects full of nulls
|
||||||
return 0;
|
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;
|
package se.su.dsv.scipro.data.dataobjects;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
@ -15,7 +16,10 @@ import javax.persistence.Column;
|
|||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.ManyToMany;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
|
import javax.persistence.OrderBy;
|
||||||
|
import javax.persistence.OrderColumn;
|
||||||
import javax.persistence.PrePersist;
|
import javax.persistence.PrePersist;
|
||||||
import javax.persistence.PreUpdate;
|
import javax.persistence.PreUpdate;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
@ -70,32 +74,27 @@ public class MessageBoard extends DomainObject{
|
|||||||
if(getCommentableKey().length() > 255)
|
if(getCommentableKey().length() > 255)
|
||||||
throw new IllegalArgumentException("CommentThread-commentableKey may not be longer than 255 characters");
|
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() {
|
public String getCommentableKey() {
|
||||||
return commentableKey;
|
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
|
* @param commentableKey the commentableKey to set
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
package se.su.dsv.scipro.data.enums;
|
||||||
|
|
||||||
|
public enum CheckListQuestionAnswer {
|
||||||
|
RED,
|
||||||
|
GREEN,
|
||||||
|
YELLOW
|
||||||
|
}
|
@ -21,9 +21,9 @@ public abstract class AbstractSupervisorPeerPage extends AbstractSupervisorPage
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<MenuItem> getItemList() {
|
protected List<MenuItem> getItemList() {
|
||||||
final List<MenuItem> items = new ArrayList<MenuItem>();
|
final List<MenuItem> items = new ArrayList<MenuItem>();
|
||||||
items.add(new MenuItem("My projects", SupervisorPeerStatsPage.class, MenuHighlightReviewPage.class, ImageIcon.ICON_STATISTICS));
|
|
||||||
items.add(new MenuItem("Peer portal", SupervisorPeerPortalPage.class, ImageIcon.ICON_FIND));
|
items.add(new MenuItem("Peer portal", SupervisorPeerPortalPage.class, ImageIcon.ICON_FIND));
|
||||||
|
items.add(new MenuItem("My projects", SupervisorPeerStatsPage.class, MenuHighlightReviewPage.class, ImageIcon.ICON_STATISTICS));
|
||||||
items.add(new MenuItem("How to write a good review", SupervisorPeerReviewGuidePage.class, ImageIcon.ICON_HELP));
|
items.add(new MenuItem("How to write a good review", SupervisorPeerReviewGuidePage.class, ImageIcon.ICON_HELP));
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,10 @@ package se.su.dsv.scipro.peer.pages;
|
|||||||
|
|
||||||
import org.apache.wicket.PageParameters;
|
import org.apache.wicket.PageParameters;
|
||||||
|
|
||||||
|
import se.su.dsv.scipro.security.auth.Authorization;
|
||||||
|
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||||
|
|
||||||
|
@Authorization(authorizedRoles={Roles.SYSADMIN})
|
||||||
public class ProjectPeerReviewGuidePage extends AbstractProjectPeerPage {
|
public class ProjectPeerReviewGuidePage extends AbstractProjectPeerPage {
|
||||||
|
|
||||||
public ProjectPeerReviewGuidePage(PageParameters pp) {
|
public ProjectPeerReviewGuidePage(PageParameters pp) {
|
||||||
|
@ -2,6 +2,10 @@ package se.su.dsv.scipro.peer.pages;
|
|||||||
|
|
||||||
import org.apache.wicket.PageParameters;
|
import org.apache.wicket.PageParameters;
|
||||||
|
|
||||||
|
import se.su.dsv.scipro.security.auth.Authorization;
|
||||||
|
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||||
|
|
||||||
|
@Authorization(authorizedRoles={Roles.SYSADMIN})
|
||||||
public class SupervisorPeerReviewGuidePage extends AbstractSupervisorPeerPage {
|
public class SupervisorPeerReviewGuidePage extends AbstractSupervisorPeerPage {
|
||||||
|
|
||||||
public SupervisorPeerReviewGuidePage(PageParameters pp) {
|
public SupervisorPeerReviewGuidePage(PageParameters pp) {
|
||||||
|
@ -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"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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.ProjectPartnerPage;
|
||||||
import se.su.dsv.scipro.project.pages.ProjectSchedulePlannerPage;
|
import se.su.dsv.scipro.project.pages.ProjectSchedulePlannerPage;
|
||||||
import se.su.dsv.scipro.project.pages.ProjectStartPage;
|
import se.su.dsv.scipro.project.pages.ProjectStartPage;
|
||||||
|
import se.su.dsv.scipro.project.pages.ProjectChecklistPage;
|
||||||
import se.su.dsv.scipro.repository.panels.ProjectFilePanel;
|
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("Peer review", ProjectPeerPortalPage.class));
|
||||||
itemList.add(new MenuItem("All Final Seminars", FinalSeminarProjectListPage.class));
|
itemList.add(new MenuItem("All Final Seminars", FinalSeminarProjectListPage.class));
|
||||||
itemList.add(new MenuItem("Conference", ProjectConferencePage.class));
|
itemList.add(new MenuItem("Conference", ProjectConferencePage.class));
|
||||||
|
itemList.add(new MenuItem("Checklists", ProjectChecklistPage.class));
|
||||||
} else {
|
} else {
|
||||||
itemList.add(new MenuItem("No active project!", NoActiveProjectPage.class));
|
itemList.add(new MenuItem("No active project!", NoActiveProjectPage.class));
|
||||||
itemList.add(new MenuItem("Project Partner", ProjectPartnerPage.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.ProjectPartner</class>
|
||||||
<class>se.su.dsv.scipro.data.dataobjects.CheckPlagiarismEvent</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.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>
|
<properties>
|
||||||
|
|
||||||
@ -171,6 +175,10 @@
|
|||||||
<class>se.su.dsv.scipro.data.dataobjects.ProjectPartner</class>
|
<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.CheckPlagiarismEvent</class>
|
||||||
<class>se.su.dsv.scipro.data.dataobjects.WebNotification</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>
|
<properties>
|
||||||
|
@ -1053,3 +1053,7 @@ div.wicket-aa ul li.selected {
|
|||||||
font-size: 1.4em;
|
font-size: 1.4em;
|
||||||
font-style: strong;
|
font-style: strong;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font: 0.8em/21px arial,sans-serif;
|
||||||
|
}
|
||||||
|
@ -94,17 +94,24 @@ public class TestBoardMessageDaoJPA {
|
|||||||
|
|
||||||
Set<User> subscribers = new HashSet<User>();
|
Set<User> subscribers = new HashSet<User>();
|
||||||
subscribers.add(user);
|
subscribers.add(user);
|
||||||
messageBoard = new MessageBoard(presenterProject);
|
|
||||||
messageBoard.setTitle("test");
|
|
||||||
messageBoard = messageBoardDao.save(messageBoard);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
boardMessage = new BoardMessage();
|
boardMessage = new BoardMessage();
|
||||||
boardMessage.setFromUser(user);
|
boardMessage.setFromUser(user);
|
||||||
boardMessage.setMessage("Test");
|
boardMessage.setMessage("Test");
|
||||||
boardMessage.setMessageBoard(messageBoard);
|
|
||||||
boardMessage = boardMessageDao.save(boardMessage);
|
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.getBoardMessages().add(boardMessage);
|
||||||
|
messageBoard = messageBoardDao.save(messageBoard);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -123,5 +130,11 @@ public class TestBoardMessageDaoJPA {
|
|||||||
Assert.assertEquals(1, boardMessageDao.getBoardMessageListCount(messageBoard));
|
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