Merge branch 'develop' into uiMods
This commit is contained in:
commit
0ad3de60b6
src
main
java/se/su/dsv/scipro
SciProSession.java
basepages
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.javaEvent.javaFileDescription.javaMessageBoard.javaProjectEventTemplate.java
enums
peer/pages
project
repository
util
resources
webapp
test/java/se/su/dsv/scipro
@ -186,6 +186,8 @@ public class SciProSession extends WebSession {
|
||||
Project activeProject = userSettings.getActiveProject();
|
||||
if(activeProject != null)
|
||||
activeProjectId = activeProject.getId();
|
||||
else
|
||||
activeProjectId = null;
|
||||
}
|
||||
else {
|
||||
userSettings = new UserSettings(user);
|
||||
|
@ -26,7 +26,7 @@
|
||||
<!--<link rel="stylesheet" href="css/scipro.css" media="screen,projection" />-->
|
||||
|
||||
<!-- <link type="text/css" href="css/smoothness/jquery-ui-1.8.10.custom.css" rel="stylesheet" />
|
||||
<script type="text/javascript" src="js/jquery-1.5.1.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery-1.5.2.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery-ui-1.8.10.custom.min.js"></script> -->
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -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,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.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);
|
||||
}
|
||||
|
@ -84,13 +84,15 @@ public class FinalSeminarUploadControllerImpl implements FinalSeminarUploadContr
|
||||
|
||||
public void deleteSeminarFilesRecursive(final FinalSeminar seminar) throws FileStorageException {
|
||||
if (seminar.getDocument() != null) {
|
||||
delete(getRepositorySeminarPath(seminar));
|
||||
//delete(getRepositorySeminarPath(seminar)); Use of deprecated path/method
|
||||
delete(seminar.getDocument().getPath());
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteOpponentFiles(final FinalSeminarOpposition opp) throws FileStorageException {
|
||||
if (opp.getOpponentReport() != null) {
|
||||
delete(getRepositoryOppositionPath(opp));
|
||||
//delete(getRepositoryOppositionPath(opp)); Use of deprecated path/method
|
||||
delete(opp.getOpponentReport().getPath());
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,7 +141,8 @@ public class FinalSeminarUploadControllerImpl implements FinalSeminarUploadContr
|
||||
throw new RuntimeException("The file must be a PDF");
|
||||
}
|
||||
|
||||
String path = getRepositorySeminarPath(seminar);
|
||||
//String path = getRepositorySeminarPath(seminar); Deprecated method call
|
||||
String path = fileRepository.getFinalSeminarPath(seminar.getId());
|
||||
FileDescription fd = null;
|
||||
try {
|
||||
fd = store(upload, path);
|
||||
@ -200,8 +203,9 @@ public class FinalSeminarUploadControllerImpl implements FinalSeminarUploadContr
|
||||
throw new IllegalStateException("Non other than the opponent can upload an opposition");
|
||||
}
|
||||
FileDescription fd = null;
|
||||
String path = getRepositoryOppositionPath(opposition);
|
||||
|
||||
//String path = getRepositoryOppositionPath(opposition); Deprecated method call
|
||||
String path = fileRepository.getFinalSeminarOppositionPath(opposition.getId());
|
||||
|
||||
try {
|
||||
fd = store(upload, path);
|
||||
fd = fileDescriptionDao.save(fd);
|
||||
@ -239,7 +243,11 @@ public class FinalSeminarUploadControllerImpl implements FinalSeminarUploadContr
|
||||
throw new Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The following two methods are deprecated and should not be used, they are left here because the
|
||||
* production system has data generated using these old path-methods. //MP
|
||||
*
|
||||
private String getRepositorySeminarPath(FinalSeminar seminar) {
|
||||
return fileRepository.getRepositoryRootPath() + FINAL_SEMINAR_DIRECTORY
|
||||
+ String.valueOf(seminar.getId()) + "/";
|
||||
@ -249,11 +257,8 @@ public class FinalSeminarUploadControllerImpl implements FinalSeminarUploadContr
|
||||
return getRepositorySeminarPath(o.getFinalSeminar()) + FINAL_SEMINAR_OPPOSITION_DIRECTORY
|
||||
+ String.valueOf(o.getId()) + "/";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -154,11 +154,7 @@ public abstract class Event extends LazyDeletableDomainObject
|
||||
|
||||
@Override
|
||||
public int compareTo(Event other) {
|
||||
int dcomp = dueDate.compareTo(other.dueDate);
|
||||
if(dcomp == 0)
|
||||
return id.compareTo(other.id);
|
||||
else
|
||||
return dcomp;
|
||||
return (int) (dueDate.getTime() - other.dueDate.getTime());
|
||||
}
|
||||
|
||||
public Panel getDisplayPanel(String id){
|
||||
|
@ -3,6 +3,7 @@ package se.su.dsv.scipro.data.dataobjects;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Cacheable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
@ -24,17 +25,22 @@ import org.hibernate.annotations.Index;
|
||||
public class FileDescription extends DomainObject implements Comparable<FileDescription>{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public static final int PATH_MAX_LENGTH = 255;
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Long id;
|
||||
|
||||
@Column(length=255)
|
||||
private String name;
|
||||
private Date targetLastModified;
|
||||
@Column(length=255)
|
||||
private String mimeType;
|
||||
@Index(name="file_description_identifier_index") //Hibernate specific, just for performance
|
||||
@Column(length=255)
|
||||
private String identifier;
|
||||
@Index(name="file_description_path_index") //Hibernate specific, just for performance
|
||||
@Column(length=PATH_MAX_LENGTH)
|
||||
private String path;
|
||||
private Long userId = null;
|
||||
private Long size;
|
||||
|
@ -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;
|
||||
@ -50,7 +54,7 @@ public class MessageBoard extends DomainObject{
|
||||
}
|
||||
|
||||
@Basic(optional=false)
|
||||
public String title;
|
||||
private String title;
|
||||
|
||||
@Basic(optional=false)
|
||||
@Column(length=255)
|
||||
@ -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
|
||||
*/
|
||||
|
@ -38,6 +38,9 @@ public class ProjectEventTemplate extends DomainObject implements Comparable<Pro
|
||||
@Column(nullable=false)
|
||||
private long estimatedTimeConsumption = 0;
|
||||
|
||||
@Column(nullable=false)
|
||||
private int daysOffset;
|
||||
|
||||
@Column(nullable=false)
|
||||
private boolean requireHandIn = false;
|
||||
|
||||
@ -46,6 +49,10 @@ public class ProjectEventTemplate extends DomainObject implements Comparable<Pro
|
||||
|
||||
public ProjectEventTemplate(){}
|
||||
|
||||
public ProjectEventTemplate(int daysOffset){
|
||||
this.daysOffset = daysOffset;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
@ -53,6 +60,14 @@ public class ProjectEventTemplate extends DomainObject implements Comparable<Pro
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setdaysOffset(int daysOffset){
|
||||
this.daysOffset = daysOffset;
|
||||
}
|
||||
|
||||
public int getDaysOffset(){
|
||||
return daysOffset;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
|
@ -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
|
||||
protected List<MenuItem> getItemList() {
|
||||
final List<MenuItem> items = new ArrayList<MenuItem>();
|
||||
items.add(new MenuItem("My projects", SupervisorPeerStatsPage.class, MenuHighlightReviewPage.class, ImageIcon.ICON_STATISTICS));
|
||||
final List<MenuItem> items = new ArrayList<MenuItem>();
|
||||
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));
|
||||
return items;
|
||||
}
|
||||
|
@ -2,6 +2,10 @@ package se.su.dsv.scipro.peer.pages;
|
||||
|
||||
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 ProjectPeerReviewGuidePage(PageParameters pp) {
|
||||
|
@ -2,6 +2,10 @@ package se.su.dsv.scipro.peer.pages;
|
||||
|
||||
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 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.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));
|
||||
|
@ -161,6 +161,18 @@ public interface FileRepository {
|
||||
* @return
|
||||
*/
|
||||
String getResourcePath(Long fileResourceId);
|
||||
/**
|
||||
* Get the repository path associated with a certain FinalSeminar
|
||||
* @param finalSeminarId
|
||||
* @return
|
||||
*/
|
||||
String getFinalSeminarPath(Long finalSeminarId);
|
||||
/**
|
||||
* Get the repository path associated with a certain FinalSeminarOpposition
|
||||
* @param finalSeminarOppositionId
|
||||
* @return
|
||||
*/
|
||||
String getFinalSeminarOppositionPath(Long finalSeminarOppositionId);
|
||||
/**
|
||||
* Convenience method to sort folders according to the input parameters
|
||||
* @param list
|
||||
|
@ -62,14 +62,19 @@ import eu.medsea.mimeutil.detector.ExtensionMimeDetector;
|
||||
@Repository
|
||||
public class FileRepositoryImpl implements FileRepository {
|
||||
|
||||
protected static final int STANDARD_INTERVAL_LENGTH = 100;
|
||||
protected static final String ROOT_PATH = "root/";
|
||||
protected static final String PROJECTS_PATH = "projects/";
|
||||
protected static final String RESOURCES_PATH = "resources/";
|
||||
protected static final String FINAL_SEMINAR_ROOT_PATH = "final_seminars/";
|
||||
protected static final String FINAL_SEMINARS_PATH = "final_seminar_reports/";
|
||||
protected static final String FINAL_SEMINAR_OPPOSITION_REPORT_PATH = "opposition_reports/";
|
||||
|
||||
@Autowired(required=false)
|
||||
private RepositoryManager repositoryManager;
|
||||
|
||||
public String storeFile(String name, String mimeType, InputStream fileStream) {
|
||||
|
||||
if (StringUtils.isEmpty(name)) {
|
||||
return null;
|
||||
}
|
||||
@ -89,6 +94,9 @@ public class FileRepositoryImpl implements FileRepository {
|
||||
Node folder = RepositoryHelper.findOrCreateFolder(session, splitWithoutFile, rootNode);
|
||||
|
||||
Node file = folder.addNode(itemName, "nt:file");
|
||||
if( file.getPath().length() > FileDescription.PATH_MAX_LENGTH ){
|
||||
throw new IllegalStateException("Trying to store a node with a path length that is too long");
|
||||
}
|
||||
file.addMixin("sp:fileMixin");
|
||||
Node fileContent = file.addNode ("jcr:content", "nt:resource");
|
||||
fileContent.addMixin("mix:referenceable");
|
||||
@ -384,35 +392,37 @@ public class FileRepositoryImpl implements FileRepository {
|
||||
}
|
||||
|
||||
public String getProjectRootPath(Long projectId){
|
||||
return ROOT_PATH+PROJECTS_PATH+getProjectSubFolder(projectId);
|
||||
return ROOT_PATH+PROJECTS_PATH+getIntervalSubFolder(projectId, STANDARD_INTERVAL_LENGTH);
|
||||
}
|
||||
|
||||
public String getFinalSeminarPath(Long finalSeminarId){
|
||||
return ROOT_PATH+FINAL_SEMINAR_ROOT_PATH+FINAL_SEMINARS_PATH+getIntervalSubFolder(finalSeminarId, STANDARD_INTERVAL_LENGTH);
|
||||
}
|
||||
|
||||
public String getFinalSeminarOppositionPath(Long finalSeminarOppositionId){
|
||||
return ROOT_PATH+FINAL_SEMINAR_ROOT_PATH+FINAL_SEMINAR_OPPOSITION_REPORT_PATH+getIntervalSubFolder(finalSeminarOppositionId, STANDARD_INTERVAL_LENGTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to split the projects folder into subfolders containing projects. Precaution because jackrabbit can
|
||||
* Method used to split the folders into subfolders containing for example projects. Precaution because jackrabbit can
|
||||
* get slow when faced with huge number of subnodes in one node (10.000+).
|
||||
* @param projectId id of the project, for example 54
|
||||
* @param id id of the domain object used as key, for example projectId, for example 54
|
||||
* @param intervalLength, should be a CONSTANT for any given uses
|
||||
* @return result looking like for example: "0-99/54
|
||||
*/
|
||||
protected String getProjectSubFolder(Long projectId){
|
||||
int intervalLength = 100;
|
||||
Long startId = ( projectId / intervalLength ) * intervalLength;
|
||||
protected String getIntervalSubFolder(final Long id, final int intervalLength){
|
||||
if(id == null)
|
||||
throw new IllegalStateException("Attempting to calculate a repository path using a null-id, that's not allowed!");
|
||||
Long startId = ( id / intervalLength ) * intervalLength;
|
||||
Long endId = startId + intervalLength - 1;
|
||||
String result = startId.toString() + "-" + endId.toString() + "/" + projectId.toString() +"/";
|
||||
String result = startId.toString() + "-" + endId.toString() + "/" + id.toString() +"/";
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getResourcePath(Long fileResourceId){
|
||||
if(fileResourceId == null)
|
||||
throw new NullPointerException("Null value for FileResource-id cannot generate a valid path to store a file resource!");
|
||||
return ROOT_PATH+RESOURCES_PATH+getResourceSubFolder(fileResourceId);
|
||||
}
|
||||
|
||||
protected String getResourceSubFolder(Long fileResourceId){
|
||||
int intervalLength = 1000;
|
||||
Long startId = ( fileResourceId / intervalLength ) * intervalLength;
|
||||
Long endId = startId + intervalLength - 1;
|
||||
String result = startId.toString() + "-" + endId.toString() + "/" + fileResourceId.toString() +"/";
|
||||
return result;
|
||||
return ROOT_PATH+RESOURCES_PATH+getIntervalSubFolder(fileResourceId, 1000); //TODO If resources are ever used with files, make this a static constant
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -416,13 +416,21 @@ public abstract class AbstractFilePanel extends Panel {
|
||||
protected void onSubmit() {
|
||||
final FileUpload upload = fileUploadField.getFileUpload();
|
||||
|
||||
fileRepository.storeFile(upload, absolutePath);
|
||||
|
||||
setRedirect(true);
|
||||
|
||||
pp.put("i", relativePath.replaceAll("/", "."));
|
||||
|
||||
setResponsePage(fpc.getSurroundingPageClass(), pp);
|
||||
try{
|
||||
fileRepository.storeFile(upload, absolutePath);
|
||||
|
||||
setRedirect(true);
|
||||
pp.put("i", relativePath.replaceAll("/", "."));
|
||||
setResponsePage(fpc.getSurroundingPageClass(), pp);
|
||||
|
||||
} catch (FileStorageException fse){
|
||||
if(fse.getCause().getClass().equals(IllegalStateException.class)){
|
||||
error("Cannot save file into this directory, the resulting path is to long/deep. Try a shorter name or a different directory.");
|
||||
}
|
||||
else{
|
||||
error(fse.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,10 @@ import org.joda.time.DateMidnight;
|
||||
import org.joda.time.DateTimeConstants;
|
||||
import org.joda.time.Days;
|
||||
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.EventDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectEventDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ScheduleTemplateDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectEvent;
|
||||
@ -27,6 +30,9 @@ public class ScheduleGenerator {
|
||||
@SpringBean
|
||||
private ProjectDao projectDao;
|
||||
|
||||
@SpringBean
|
||||
private ProjectEventDao projectEventDao;
|
||||
|
||||
private Project project;
|
||||
private ScheduleTemplate template;
|
||||
private List<ProjectEventTemplate> eventTemplates;
|
||||
@ -72,14 +78,17 @@ public class ScheduleGenerator {
|
||||
|
||||
List<ProjectEvent> events = new ArrayList<ProjectEvent>();
|
||||
DateMidnight datePointer = new DateMidnight(startDate);
|
||||
DateMidnight tempPointer;
|
||||
|
||||
int totalDuration = 0;
|
||||
for(ProjectEventTemplate e : eventTemplates){
|
||||
tempPointer = new DateMidnight(datePointer);
|
||||
ProjectEvent event = e.createEventFromTemplate();
|
||||
event.setParticipants(project.getProjectParticipants());
|
||||
event.setParticipants(project.getProjectParticipants());//might have to remove this
|
||||
if(e.getEstimatedTimeConsumption() <= 1){
|
||||
datePointer = new DateMidnight(startDate).plusDays(e.getDaysOffset());
|
||||
}
|
||||
double duration = (double) e.getEstimatedTimeConsumption() * ratio;
|
||||
if(duration < 1.0)
|
||||
duration = 1.0;
|
||||
|
||||
datePointer = datePointer.plusDays((int) duration);
|
||||
totalDuration += (int)duration;
|
||||
@ -94,6 +103,9 @@ public class ScheduleGenerator {
|
||||
}
|
||||
event.setDueDate(datePointer.toDate());
|
||||
events.add(event);
|
||||
if(e.getEstimatedTimeConsumption() <= 1){
|
||||
datePointer = tempPointer;
|
||||
}
|
||||
}
|
||||
return new ScheduleGeneratorResult(template, events, totalDuration, templateEstimatedDays, startDate.toDate(), endDate.toDate());
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ public class TemplateGenerator { //based on ScheduleGenerator
|
||||
|
||||
private int templateEstimatedDays = 0;
|
||||
private int durationInDays = 0;
|
||||
private int daysOffset;
|
||||
|
||||
private DateMidnight startDate;
|
||||
|
||||
@ -56,12 +57,9 @@ public class TemplateGenerator { //based on ScheduleGenerator
|
||||
if(schedule.getStartDate() != null){
|
||||
this.startDate = new DateMidnight(schedule.getStartDate());
|
||||
}else{
|
||||
this.startDate = new DateMidnight(projectEvents.first().getDueDate());
|
||||
int days = (new DateMidnight(projectEvents.first().getDueDate()).getDayOfYear() - new DateMidnight(schedule.getStartDate()).getDayOfYear());
|
||||
this.startDate = new DateMidnight(projectEvents.first().getDueDate()).minusDays(days);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public ScheduleTemplate generate(){
|
||||
@ -94,9 +92,12 @@ public class TemplateGenerator { //based on ScheduleGenerator
|
||||
pet.setRequireHandIn(pe.isRequireHandIn());
|
||||
pet.setScheduleTemplate(template);
|
||||
|
||||
int daysOffset = (new DateMidnight(pe.getDueDate()).getDayOfYear() - startDate.getDayOfYear());
|
||||
|
||||
pet.setdaysOffset(daysOffset);
|
||||
|
||||
datePointer = datePointer.plusDays(durationInDays);
|
||||
templateEstimatedDays += durationInDays;
|
||||
setTemplateEstimatedDays(getTemplateEstimatedDays() + durationInDays);
|
||||
projectEventTemplate.add(pet);
|
||||
}
|
||||
|
||||
@ -158,5 +159,21 @@ public class TemplateGenerator { //based on ScheduleGenerator
|
||||
this.startDate = new DateMidnight(startDate);
|
||||
}
|
||||
|
||||
public int getTemplateEstimatedDays() {
|
||||
return templateEstimatedDays;
|
||||
}
|
||||
|
||||
public void setTemplateEstimatedDays(int templateEstimatedDays) {
|
||||
this.templateEstimatedDays = templateEstimatedDays;
|
||||
}
|
||||
|
||||
public int getDaysOffset() {
|
||||
return daysOffset;
|
||||
}
|
||||
|
||||
public void setDaysOffset(int daysOffset) {
|
||||
this.daysOffset = daysOffset;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
@ -1059,3 +1059,7 @@ div.wicket-aa ul li.selected {
|
||||
font-size: 1.4em;
|
||||
font-style: strong;
|
||||
}
|
||||
|
||||
body {
|
||||
font: 0.8em/21px arial,sans-serif;
|
||||
}
|
||||
|
16
src/main/webapp/js/jquery-1.5.1.min.js
vendored
16
src/main/webapp/js/jquery-1.5.1.min.js
vendored
File diff suppressed because one or more lines are too long
16
src/main/webapp/js/jquery-1.6.min.js
vendored
16
src/main/webapp/js/jquery-1.6.min.js
vendored
File diff suppressed because one or more lines are too long
@ -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.getBoardMessages().add(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));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ import se.su.dsv.scipro.repository.util.RepositoryManager;
|
||||
*
|
||||
*/
|
||||
@Ignore
|
||||
public class BaseWicketTest {
|
||||
public abstract class BaseWicketTest {
|
||||
|
||||
protected WicketTester tester;
|
||||
|
||||
@ -112,7 +112,9 @@ public class BaseWicketTest {
|
||||
|
||||
@Mock EntityManagerFactoryInfo entityManagerFactory = Mockito.mock(LocalEntityManagerFactoryBean.class);
|
||||
|
||||
//@Before
|
||||
/**
|
||||
* Call this method within as the first call in @Before annotated method in an overriding test case class, see example in {@link TestWicketPages}
|
||||
*/
|
||||
public void setup() {
|
||||
/*
|
||||
* Setup a new mock applicationContext
|
||||
@ -174,7 +176,10 @@ public class BaseWicketTest {
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The following methods are added for convenience
|
||||
*/
|
||||
protected void setLoggedIn(boolean loggedIn){
|
||||
MockSciProSession.currentSession.setLoggedIn(loggedIn);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user