org.chorem.pollen.services.impl
Class PollService
java.lang.Object
org.chorem.pollen.services.PollenServiceSupport
org.chorem.pollen.services.impl.PollService
- All Implemented Interfaces:
- PollenService
public class PollService
- extends PollenServiceSupport
|
Method Summary |
void |
addChoice(String pollId,
Choice choice)
|
void |
addVoteToPoll(Poll poll,
Vote vote)
|
void |
checkPoll(PollUri uri)
|
void |
checkPollAccount(PollUri uri)
|
void |
checkPollCreator(PollUri uri)
|
void |
checkPollResult(PollUri uri)
|
void |
closePoll(String pollId,
UserAccount userAccount,
String accountId)
|
protected PollAccount |
copyPollAccount(PollAccount source)
|
Poll |
createPoll(Poll poll)
|
protected static void |
createThumbnail(File img,
File thumbCopied,
int width)
Création d'une miniature. |
void |
deleteChoice(String pollId,
String choiceId)
|
void |
deletePoll(String pollId,
UserAccount userAccount,
String accountId)
|
List<Poll> |
getCreatedPolls(org.nuiton.topia.persistence.TopiaFilterPagerUtil.FilterPagerBean pager,
UserAccount user)
|
List<org.apache.commons.lang3.tuple.Pair<Poll,PollAccount>> |
getInvitedPolls(org.nuiton.topia.persistence.TopiaFilterPagerUtil.FilterPagerBean pager,
UserAccount user)
|
Choice |
getNewChoice(org.chorem.pollen.common.ChoiceType choiceType)
|
PersonToList |
getNewPersonToList(PollAccount pollAccount)
|
Poll |
getNewPoll(UserAccount user)
Build a new Poll instance with given user as creator |
PollAccount |
getNewPollAccount(UserAccount userAccount)
|
protected Poll |
getNewPollCopy(Poll source,
UserAccount userAccount,
boolean clone)
|
List<org.apache.commons.lang3.tuple.Pair<Poll,PollAccount>> |
getParticipatedPolls(org.nuiton.topia.persistence.TopiaFilterPagerUtil.FilterPagerBean pager,
UserAccount user)
|
PollAccount |
getPollAccountByAccountId(String accountId)
|
PollAccount |
getPollAccountEditable(String accountId,
UserAccount userAccount,
Poll poll)
Retrieve a pollAccount with accountId. |
Poll |
getPollByPollId(String pollId)
|
File |
getPollChoiceImageFile(String pollId,
String choiceId,
boolean thumb)
|
Poll |
getPollEditable(String pollUid,
UserAccount userAccount,
boolean clone)
Retrieve a Poll for edition. |
PollUrl |
getPollEditUrl(Poll poll)
|
PollUrl |
getPollResultUrl(Poll poll)
|
List<Poll> |
getPolls(org.nuiton.topia.persistence.TopiaFilterPagerUtil.FilterPagerBean pager)
|
PollUrl |
getPollVoteUrl(Poll poll,
boolean moderate)
|
List<Poll> |
getRunningPolls(boolean withEndDate)
|
Map<String,Object> |
pollToMap(Poll poll,
org.nuiton.util.beans.Binder<Poll,Poll> binder)
|
protected Choice |
saveChoice(Poll poll,
Choice choice)
|
void |
saveImages(Poll poll,
PollImageChoice choice)
Sauvegarde des images d'un choix de type image. |
protected void |
savePreventRule(Poll poll,
PreventRule preventRule)
|
protected void |
saveVotingList(Poll poll,
VotingList votingList,
EmailService emailService)
|
void |
updatePoll(Poll poll)
|
| Methods inherited from class org.chorem.pollen.services.PollenServiceSupport |
commitTransaction, create, decorateDate, decorateDateTime, delete, flushTransaction, getConfiguration, getDAO, getDatePattern, getDateTimePattern, 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 |
THUMB_PREFIX
public static final String THUMB_PREFIX
- See Also:
- Constant Field Values
PollService
public PollService()
getNewPoll
public Poll getNewPoll(UserAccount user)
- Build a new Poll instance with given
user as creator
- Parameters:
user - Build a new Poll instance with given user as creator
- Returns:
- Build a new Poll instance with given
user as creator
getPollEditable
public Poll getPollEditable(String pollUid,
UserAccount userAccount,
boolean clone)
- Retrieve a Poll for edition. It is loaded from database if
pollUid
is defined, otherwise a new instance is returned. The clone
parameter will return the poll without any technical properties (topiaId)
and ensure business ids (accountUid, pollUid) with new values. If userId
matches an existing UserAccount, the resulting poll creator will
be attached to it.
- Parameters:
pollUid - Uid of the poll to edit, if not defined, a new poll is instanciateduserAccount - User account to attach to the creatorclone - Flag to copy or not ids in case of poll cloning
- Returns:
- the Poll ready for edition (no longer linked to the topia context)
- See Also:
getNewPoll(UserAccount),
getNewPollCopy(Poll, UserAccount, boolean)
getNewPollCopy
protected Poll getNewPollCopy(Poll source,
UserAccount userAccount,
boolean clone)
pollToMap
public Map<String,Object> pollToMap(Poll poll,
org.nuiton.util.beans.Binder<Poll,Poll> binder)
createPoll
public Poll createPoll(Poll poll)
updatePoll
public void updatePoll(Poll poll)
throws PollNotFoundException
- Throws:
PollNotFoundException
getPollVoteUrl
public PollUrl getPollVoteUrl(Poll poll,
boolean moderate)
getPollEditUrl
public PollUrl getPollEditUrl(Poll poll)
getPollResultUrl
public PollUrl getPollResultUrl(Poll poll)
getPolls
public List<Poll> getPolls(org.nuiton.topia.persistence.TopiaFilterPagerUtil.FilterPagerBean pager)
getCreatedPolls
public List<Poll> getCreatedPolls(org.nuiton.topia.persistence.TopiaFilterPagerUtil.FilterPagerBean pager,
UserAccount user)
getInvitedPolls
public List<org.apache.commons.lang3.tuple.Pair<Poll,PollAccount>> getInvitedPolls(org.nuiton.topia.persistence.TopiaFilterPagerUtil.FilterPagerBean pager,
UserAccount user)
getParticipatedPolls
public List<org.apache.commons.lang3.tuple.Pair<Poll,PollAccount>> getParticipatedPolls(org.nuiton.topia.persistence.TopiaFilterPagerUtil.FilterPagerBean pager,
UserAccount user)
getRunningPolls
public List<Poll> getRunningPolls(boolean withEndDate)
getPollByPollId
public Poll getPollByPollId(String pollId)
getPollAccountEditable
public PollAccount getPollAccountEditable(String accountId,
UserAccount userAccount,
Poll poll)
throws PollAccountNotFound
- Retrieve a pollAccount with
accountId. This pollAccount will be
attached to the given userAccount (only if not already attached).
If the accountId is undefined, a new instance of PollAccount will
be retrieved, otherwise a copy of the existing PollAccount is used. No
create or update is done here. The poll is used to retrieve a potential
existing vote with pollAccount linked to userAccount.
- Parameters:
accountId - Id of the existing account (optional)userAccount - UserAccount where account will be attached (optional)poll - Poll where pollAccount will be added
- Returns:
- the existing PollAccount or a new instance
- Throws:
PollAccountNotFound - if accountId is defined and doesn't match any
existing PollAccount
copyPollAccount
protected PollAccount copyPollAccount(PollAccount source)
getNewPollAccount
public PollAccount getNewPollAccount(UserAccount userAccount)
getPollAccountByAccountId
public PollAccount getPollAccountByAccountId(String accountId)
throws PollAccountNotFound
- Throws:
PollAccountNotFound
deletePoll
public void deletePoll(String pollId,
UserAccount userAccount,
String accountId)
throws PollNotFoundException,
PollAccountNotFound,
UnauthorizedPollAccessException
- Throws:
PollNotFoundException
PollAccountNotFound
UnauthorizedPollAccessException
closePoll
public void closePoll(String pollId,
UserAccount userAccount,
String accountId)
throws PollNotFoundException,
PollAccountNotFound,
UnauthorizedPollAccessException
- Throws:
PollNotFoundException
PollAccountNotFound
UnauthorizedPollAccessException
getNewChoice
public Choice getNewChoice(org.chorem.pollen.common.ChoiceType choiceType)
addChoice
public void addChoice(String pollId,
Choice choice)
throws PollNotFoundException
- Throws:
PollNotFoundException
saveChoice
protected Choice saveChoice(Poll poll,
Choice choice)
deleteChoice
public void deleteChoice(String pollId,
String choiceId)
throws PollNotFoundException,
PollChoiceNotFoundException
- Throws:
PollNotFoundException
PollChoiceNotFoundException
checkPoll
public void checkPoll(PollUri uri)
throws PollNotFoundException
- Throws:
PollNotFoundException
checkPollResult
public void checkPollResult(PollUri uri)
throws PollNotFoundException,
UnauthorizedPollAccessException
- Throws:
PollNotFoundException
UnauthorizedPollAccessException
checkPollAccount
public void checkPollAccount(PollUri uri)
throws PollNotFoundException,
UnauthorizedPollAccessException
- Throws:
PollNotFoundException
UnauthorizedPollAccessException
checkPollCreator
public void checkPollCreator(PollUri uri)
throws PollNotFoundException,
UnauthorizedPollAccessException
- Throws:
PollNotFoundException
UnauthorizedPollAccessException
getPollChoiceImageFile
public File getPollChoiceImageFile(String pollId,
String choiceId,
boolean thumb)
saveImages
public void saveImages(Poll poll,
PollImageChoice choice)
throws IOException
- Sauvegarde des images d'un choix de type image.
- Parameters:
poll - le sondage contenant le choixchoice - le choix à sauvegarder.
- Throws:
IOException - si un problème IO lors de la copie ou génération de la miniature
addVoteToPoll
public void addVoteToPoll(Poll poll,
Vote vote)
getNewPersonToList
public PersonToList getNewPersonToList(PollAccount pollAccount)
saveVotingList
protected void saveVotingList(Poll poll,
VotingList votingList,
EmailService emailService)
throws org.nuiton.topia.TopiaException
- Throws:
org.nuiton.topia.TopiaException
savePreventRule
protected void savePreventRule(Poll poll,
PreventRule preventRule)
createThumbnail
protected static void createThumbnail(File img,
File thumbCopied,
int width)
throws IOException
- Création d'une miniature.
- Parameters:
img - L'image à miniaturiser.thumbCopied - le chemin complet vers la miniature.width - La largeur de la miniature.
- Throws:
IOException - if could not create thumb image
Copyright © 2009-2012 CodeLutin. All Rights Reserved.