org.chorem.pollen.services.impl
Class VoteService
java.lang.Object
org.chorem.pollen.services.PollenServiceSupport
org.chorem.pollen.services.impl.VoteService
- All Implemented Interfaces:
- PollenService
public class VoteService
- extends PollenServiceSupport
|
Method Summary |
Vote |
createVote(Vote vote)
|
protected VoteToChoice |
createVoteToChoice(Vote vote,
VoteToChoice source)
|
void |
deleteVote(String voteId)
Delete vote referenced by voteId. |
protected void |
deleteVoteToChoice(Vote vote,
VoteToChoice entity)
|
Vote |
getNewVote(Poll poll,
PollAccount account)
|
String |
getUpdateVoteUrl(PollUri pollUri)
Retrieve the URL to update a vote based on PollUri. |
Vote |
getVoteEditable(Poll poll,
PollAccount accountEditable)
|
List<Vote> |
getVotesByPoll(Poll poll,
org.nuiton.topia.persistence.TopiaFilterPagerUtil.FilterPagerBean pager)
|
boolean |
hasAlreadyVoted(String votingId,
Poll poll)
|
boolean |
isUpdateAllowed(Poll poll,
String voteId,
String accountId,
UserAccount userConnected)
|
boolean |
isVoteAllowed(Poll poll,
PollAccount accountEditable)
Vote is allowed if poll is running and pollAccount is
defined in the poll restricted list if it's not a PollType.FREE
poll. |
List<Vote> |
selectVotes(Map<String,Object> properties)
|
Vote |
updateVote(Vote vote)
|
| Methods inherited from class org.chorem.pollen.services.PollenServiceSupport |
commitTransaction, create, delete, flushTransaction, getConfiguration, getDAO, getEntities, getEntities, getEntityById, getLocale, getTransaction, newInstance, newService, setServiceContext, update |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
VoteService
public VoteService()
getNewVote
public Vote getNewVote(Poll poll,
PollAccount account)
getVoteEditable
public Vote getVoteEditable(Poll poll,
PollAccount accountEditable)
getUpdateVoteUrl
public String getUpdateVoteUrl(PollUri pollUri)
- Retrieve the URL to update a vote based on
PollUri.
- Parameters:
pollUri - Uri with pollId and accountId
- Returns:
- the URL that allow the voting person to update his vote
createVote
public Vote createVote(Vote vote)
throws PollAccountNotFound
- Throws:
PollAccountNotFound
updateVote
public Vote updateVote(Vote vote)
throws VoteNotFoundException
- Throws:
VoteNotFoundException
createVoteToChoice
protected VoteToChoice createVoteToChoice(Vote vote,
VoteToChoice source)
deleteVoteToChoice
protected void deleteVoteToChoice(Vote vote,
VoteToChoice entity)
deleteVote
public void deleteVote(String voteId)
throws VoteNotFoundException
- Delete vote referenced by
voteId. This will also delete all
associated VoteToChoice. The PollAccount could also be
deleted for a PollType.FREE poll where vote will be removed. This
remove implied an new execution of poll vote counting if continuous results
is activated.
- Parameters:
voteId - TopiaId of the vote
- Throws:
VoteNotFoundException - if vote doesn't exist
getVotesByPoll
public List<Vote> getVotesByPoll(Poll poll,
org.nuiton.topia.persistence.TopiaFilterPagerUtil.FilterPagerBean pager)
isVoteAllowed
public boolean isVoteAllowed(Poll poll,
PollAccount accountEditable)
- Vote is allowed if
poll is running and pollAccount is
defined in the poll restricted list if it's not a PollType.FREE
poll. The account must be defined previously using
PollService.getPollAccountEditable(String, UserAccount, Poll) to
have a proper link between userAccount and pollAccount even if not already
created in dabase. The poll creator can't vote. The token is just use
for moderate purpose.
- Parameters:
poll - PollaccountEditable - Account to check
- Returns:
- true if vote is allowed, false otherwise
isUpdateAllowed
public boolean isUpdateAllowed(Poll poll,
String voteId,
String accountId,
UserAccount userConnected)
hasAlreadyVoted
public boolean hasAlreadyVoted(String votingId,
Poll poll)
selectVotes
public List<Vote> selectVotes(Map<String,Object> properties)
Copyright © 2009-2012 CodeLutin. All Rights Reserved.