Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Riina Antikainen
/
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 570f8f38
authored
Oct 31, 2010
by
Juho Juopperi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of dev.intra.insomnia.fi:/data/bortal
2 parents
b6075f7e
54ec9825
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
116 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/PollAnswer.java
code/LanBortalWeb/src/fi/insomnia/bortal/view/PollView.java
code/LanBortalWeb/src/fi/insomnia/bortal/view/helpers/PollWrapper.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/GenericEventChild.java
View file @
570f8f3
...
...
@@ -33,6 +33,10 @@ public abstract class GenericEventChild implements EventChildInterface {
super
();
}
public
GenericEventChild
(
EventPk
eventPk
)
{
id
=
eventPk
;
}
@Override
public
final
boolean
equals
(
Object
object
)
{
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Poll.java
View file @
570f8f3
package
fi
.
insomnia
.
bortal
.
model
;
import
fi.insomnia.bortal.model.GenericEntity
;
import
static
javax
.
persistence
.
TemporalType
.
TIMESTAMP
;
import
java.io.Serializable
;
import
java.util.Calendar
;
import
java.util.List
;
import
javax.persistence.*
;
import
static
javax
.
persistence
.
TemporalType
.
TIMESTAMP
;
import
javax.persistence.Entity
;
import
javax.persistence.Lob
;
import
javax.persistence.OneToMany
;
import
javax.persistence.Table
;
import
javax.persistence.Temporal
;
/**
* Entity implementation class for Entity: Poll
...
...
@@ -73,4 +76,12 @@ public class Poll extends GenericEventChild implements Serializable {
this
.
description
=
description
;
}
public
void
setQuestions
(
List
<
PollQuestion
>
questions
)
{
this
.
questions
=
questions
;
}
public
List
<
PollQuestion
>
getQuestions
()
{
return
questions
;
}
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/PollAnswer.java
View file @
570f8f3
...
...
@@ -34,12 +34,17 @@ public class PollAnswer extends GenericEventChild implements Serializable {
this
.
answerText
=
answerText
;
}
public
PollAnswer
(
PollQuestion
q
)
{
super
(
new
EventPk
(
q
.
getId
().
getId
()));
}
public
String
getAnswerText
()
{
return
answerText
;
}
public
void
setChoi
ce
(
PossibleAnswer
chois
e
)
{
this
.
choice
=
choi
s
e
;
public
void
setChoi
se
(
PossibleAnswer
choic
e
)
{
this
.
choice
=
choi
c
e
;
}
public
PossibleAnswer
getChoice
()
{
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/view/PollView.java
0 → 100644
View file @
570f8f3
package
fi
.
insomnia
.
bortal
.
view
;
import
java.util.List
;
import
javax.ejb.EJB
;
import
javax.faces.bean.ManagedBean
;
import
javax.faces.bean.SessionScoped
;
import
javax.faces.model.ListDataModel
;
import
fi.insomnia.bortal.model.Poll
;
import
fi.insomnia.bortal.view.helpers.PollWrapper
;
@ManagedBean
(
name
=
"pollView"
)
@SessionScoped
public
class
PollView
extends
GenericView
{
@EJB
private
PollBeanLocal
pollBean
;
private
PollWrapper
pollwrapper
;
private
ListDataModel
<
Poll
>
polls
;
public
void
initPollList
()
{
polls
=
new
ListDataModel
<
Poll
>(
pollBean
.
findPolls
());
}
public
String
beginPoll
()
{
pollwrapper
=
new
PollWrapper
(
polls
.
getRowData
());
}
}
code/LanBortalWeb/src/fi/insomnia/bortal/view/helpers/PollWrapper.java
0 → 100644
View file @
570f8f3
package
fi
.
insomnia
.
bortal
.
view
.
helpers
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Map.Entry
;
import
javax.faces.model.ListDataModel
;
import
fi.insomnia.bortal.model.Poll
;
import
fi.insomnia.bortal.model.PollAnswer
;
import
fi.insomnia.bortal.model.PollQuestion
;
import
fi.insomnia.bortal.view.helpers.PollWrapper.QuestionWrapper
;
public
class
PollWrapper
{
HashMap
<
Integer
,
List
<
QuestionWrapper
>>
pages
;
public
PollWrapper
(
Poll
poll
)
{
pages
=
new
HashMap
<
Integer
,
List
<
QuestionWrapper
>>();
for
(
PollQuestion
q
:
poll
.
getQuestions
())
{
if
(!
pages
.
containsKey
(
q
.
getPage
()))
{
pages
.
put
(
q
.
getPage
(),
new
LinkedList
<
QuestionWrapper
>());
}
pages
.
get
(
q
.
getPage
()).
add
(
new
QuestionWrapper
(
q
));
}
}
public
class
QuestionWrapper
{
private
PollQuestion
question
;
private
PollAnswer
answer
;
public
QuestionWrapper
(
PollQuestion
q
)
{
question
=
q
;
answer
=
new
PollAnswer
(
q
);
}
public
PollQuestion
getQuestion
()
{
return
question
;
}
public
void
setQuestion
(
PollQuestion
question
)
{
this
.
question
=
question
;
}
public
PollAnswer
getAnswer
()
{
return
answer
;
}
public
void
setAnswer
(
PollAnswer
answer
)
{
this
.
answer
=
answer
;
}
}
}
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