Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Antti Väyrynen
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 8474ad8c
authored
Oct 31, 2010
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Testidataa polleihin
1 parent
d6de95c1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
6 deletions
code/LanBortalDatabase/src/fi/insomnia/bortal/model/GenericEventChild.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Poll.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/PollQuestion.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/GenericEventChild.java
View file @
8474ad8
...
@@ -34,7 +34,7 @@ public abstract class GenericEventChild implements EventChildInterface {
...
@@ -34,7 +34,7 @@ public abstract class GenericEventChild implements EventChildInterface {
}
}
public
GenericEventChild
(
EventPk
eventPk
)
{
public
GenericEventChild
(
EventPk
eventPk
)
{
id
=
eventPk
;
id
=
new
EventPk
(
eventPk
.
getEventId
())
;
}
}
@Override
@Override
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Poll.java
View file @
8474ad8
...
@@ -3,6 +3,7 @@ package fi.insomnia.bortal.model;
...
@@ -3,6 +3,7 @@ package fi.insomnia.bortal.model;
import
static
javax
.
persistence
.
TemporalType
.
TIMESTAMP
;
import
static
javax
.
persistence
.
TemporalType
.
TIMESTAMP
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.List
;
import
java.util.List
;
...
@@ -43,7 +44,7 @@ public class Poll extends GenericEventChild implements Serializable {
...
@@ -43,7 +44,7 @@ public class Poll extends GenericEventChild implements Serializable {
private
String
description
;
private
String
description
;
@OneToMany
(
mappedBy
=
"poll"
,
fetch
=
FetchType
.
EAGER
)
@OneToMany
(
mappedBy
=
"poll"
,
fetch
=
FetchType
.
EAGER
)
private
List
<
PollQuestion
>
questions
;
private
List
<
PollQuestion
>
questions
=
new
ArrayList
<
PollQuestion
>()
;
public
Poll
()
{
public
Poll
()
{
super
();
super
();
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/PollQuestion.java
View file @
8474ad8
package
fi
.
insomnia
.
bortal
.
model
;
package
fi
.
insomnia
.
bortal
.
model
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
javax.persistence.Column
;
import
javax.persistence.Column
;
...
@@ -15,6 +16,16 @@ import javax.persistence.Table;
...
@@ -15,6 +16,16 @@ import javax.persistence.Table;
@Table
(
name
=
"poll_question"
)
@Table
(
name
=
"poll_question"
)
public
class
PollQuestion
extends
GenericEventChild
{
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 {
...
@@ -27,7 +38,7 @@ public class PollQuestion extends GenericEventChild {
private
Poll
poll
;
private
Poll
poll
;
@OneToMany
(
mappedBy
=
"question"
)
@OneToMany
(
mappedBy
=
"question"
)
private
List
<
PossibleAnswer
>
answers
;
private
List
<
PossibleAnswer
>
answers
=
new
ArrayList
<
PossibleAnswer
>()
;
@Lob
@Lob
private
String
question
;
private
String
question
;
...
@@ -41,11 +52,12 @@ public class PollQuestion extends GenericEventChild {
...
@@ -41,11 +52,12 @@ public class PollQuestion extends GenericEventChild {
public
String
getQuestion
()
{
public
String
getQuestion
()
{
return
question
;
return
question
;
}
}
public
boolean
isFreeText
()
{
public
boolean
isFreeText
()
{
return
(
answers
.
size
()
==
1
&&
answers
.
get
(
0
).
isText
());
return
(
answers
.
size
()
==
1
&&
answers
.
get
(
0
).
isText
());
}
}
public
void
setQuestion
(
String
question
)
{
public
void
setQuestion
(
String
question
)
{
this
.
question
=
question
;
this
.
question
=
question
;
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment