Commit 8474ad8c by Tuomas Riihimäki

Testidataa polleihin

1 parent d6de95c1
......@@ -34,7 +34,7 @@ public abstract class GenericEventChild implements EventChildInterface {
}
public GenericEventChild(EventPk eventPk) {
id = eventPk;
id = new EventPk(eventPk.getEventId());
}
@Override
......
......@@ -3,6 +3,7 @@ package fi.insomnia.bortal.model;
import static javax.persistence.TemporalType.TIMESTAMP;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
......@@ -43,7 +44,7 @@ public class Poll extends GenericEventChild implements Serializable {
private String description;
@OneToMany(mappedBy = "poll", fetch = FetchType.EAGER)
private List<PollQuestion> questions;
private List<PollQuestion> questions = new ArrayList<PollQuestion>();
public Poll() {
super();
......
package fi.insomnia.bortal.model;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
......@@ -15,6 +16,16 @@ import javax.persistence.Table;
@Table(name = "poll_question")
public class PollQuestion extends GenericEventChild {
public PollQuestion() {
super();
}
public PollQuestion(Poll p) {
super(p.getId());
this.poll = p;
}
/**
*
*/
......@@ -27,7 +38,7 @@ public class PollQuestion extends GenericEventChild {
private Poll poll;
@OneToMany(mappedBy = "question")
private List<PossibleAnswer> answers;
private List<PossibleAnswer> answers = new ArrayList<PossibleAnswer>();
@Lob
private String question;
......@@ -41,10 +52,11 @@ public class PollQuestion extends GenericEventChild {
public String getQuestion() {
return question;
}
public boolean isFreeText()
{
public boolean isFreeText() {
return (answers.size() == 1 && answers.get(0).isText());
}
public void setQuestion(String question) {
this.question = question;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!