public class PollServiceImpl extends Object implements PollService
PollService
.Modifier and Type | Field and Description |
---|---|
static String |
SURVEYS_CONTAINER_NAME |
Constructor and Description |
---|
PollServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
answer(String username,
Poll poll,
int answerIndex)
Store that the user with the given @{code username} has answered the
poll with the answer number answerIndex . |
Poll |
closePoll(Poll poll)
Close the
poll . |
List<Poll> |
getOpenPolls(CoreSession session)
Returns all open polls available with the given
session . |
DocumentModel |
getPollsContainer(DocumentModel doc)
Returns the polls container located inside the given
doc . |
PollResult |
getResultFor(Poll poll)
Returns the current
PollResult for the given poll . |
List<Poll> |
getUnansweredOpenPolls(CoreSession session)
Returns all unanswered open polls available with the given
session . |
boolean |
hasUserAnswered(String username,
Poll poll)
Returns
true if the user with the given username has
already answer the poll , false otherwise . |
Poll |
openPoll(Poll poll)
Open the
poll . |
Poll |
updatePollStatus(Poll poll,
Date date)
Update the status of the
poll according to the given
date . |
public static final String SURVEYS_CONTAINER_NAME
public DocumentModel getPollsContainer(DocumentModel doc)
PollService
doc
.
The container is created if it does not exist.
getPollsContainer
in interface PollService
doc
- the document where to create the containerpublic List<Poll> getOpenPolls(CoreSession session)
PollService
session
.getOpenPolls
in interface PollService
public List<Poll> getUnansweredOpenPolls(CoreSession session)
PollService
session
.getUnansweredOpenPolls
in interface PollService
public boolean hasUserAnswered(String username, Poll poll)
PollService
true
if the user with the given username
has
already answer the poll
, false otherwise
.hasUserAnswered
in interface PollService
public void answer(String username, Poll poll, int answerIndex)
PollService
poll
with the answer number answerIndex
.answer
in interface PollService
public PollResult getResultFor(Poll poll)
PollService
PollResult
for the given poll
.getResultFor
in interface PollService
public Poll openPoll(Poll poll)
PollService
poll
. The poll will be available through the
PollService.getOpenPolls(org.nuxeo.ecm.core.api.CoreSession)
method.
The start date of the poll is set to now.
openPoll
in interface PollService
public Poll closePoll(Poll poll)
PollService
poll
.
The end date of the poll is set to now.
closePoll
in interface PollService
public Poll updatePollStatus(Poll poll, Date date)
PollService
poll
according to the given
date
.
The poll can be open or closed according to its start date and end date.
updatePollStatus
in interface PollService
Copyright © 2011 Nuxeo SA. All Rights Reserved.