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)
PollServicedoc.
The container is created if it does not exist.
getPollsContainer in interface PollServicedoc - the document where to create the containerpublic List<Poll> getOpenPolls(CoreSession session)
PollServicesession.getOpenPolls in interface PollServicepublic List<Poll> getUnansweredOpenPolls(CoreSession session)
PollServicesession.getUnansweredOpenPolls in interface PollServicepublic boolean hasUserAnswered(String username, Poll poll)
PollServicetrue if the user with the given username has
already answer the poll, false otherwise.hasUserAnswered in interface PollServicepublic void answer(String username, Poll poll, int answerIndex)
PollServicepoll with the answer number answerIndex.answer in interface PollServicepublic PollResult getResultFor(Poll poll)
PollServicePollResult for the given poll.getResultFor in interface PollServicepublic Poll openPoll(Poll poll)
PollServicepoll. 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 PollServicepublic Poll closePoll(Poll poll)
PollServicepoll.
The end date of the poll is set to now.
closePoll in interface PollServicepublic Poll updatePollStatus(Poll poll, Date date)
PollServicepoll according to the given
date.
The poll can be open or closed according to its start date and end date.
updatePollStatus in interface PollServiceCopyright © 2013 Nuxeo SA. All Rights Reserved.