public class PollService extends PollenServiceSupport
Modifier and Type | Field and Description |
---|---|
static String |
THUMB_PREFIX |
serviceContext
Constructor and Description |
---|
PollService() |
Modifier and Type | Method and Description |
---|---|
void |
addChoice(String pollId,
Choice choice) |
void |
attachPoll(String pollId,
UserAccount userAccount) |
void |
closePoll(String pollId) |
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) |
File |
generateThumbIfNeeded(File pollChoiceImage) |
List<Poll> |
getCreatedPolls(org.nuiton.topia.persistence.pager.TopiaPagerBean pager,
UserAccount user) |
Poll |
getExistingPollByPollId(String pollId) |
File |
getImageThumbFile(File imagePath)
given the location of an image, gets his name as a thumb image.
|
List<org.apache.commons.lang3.tuple.Pair<Poll,PollAccount>> |
getInvitedPolls(org.nuiton.topia.persistence.pager.TopiaPagerBean pager,
UserAccount user) |
Choice |
getNewChoice(ChoiceType choiceType) |
PersonToList |
getNewPersonToList(PollAccount pollAccount) |
List<org.apache.commons.lang3.tuple.Pair<Poll,PollAccount>> |
getParticipatedPolls(org.nuiton.topia.persistence.pager.TopiaPagerBean pager,
UserAccount user) |
PollAccount |
getPollAccountEditable(String accountId,
UserAccount userAccount,
Poll poll)
Retrieve a pollAccount with
accountId . |
Poll |
getPollByPollId(String pollId) |
File |
getPollChoiceImageFile(String pollId,
String choiceId)
Obtain the location of an image choice.
|
Poll |
getPollEditable(String pollUid,
UserAccount userAccount,
boolean clone)
Retrieve a Poll for edition.
|
List<Poll> |
getPolls(org.nuiton.topia.persistence.pager.TopiaPagerBean pager) |
List<Poll> |
getRunningPollsWithEndTime(Date currentTime) |
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) |
Poll |
updatePoll(Poll poll) |
commitTransaction, create, createWithProperties, decorateDate, decorateDateTime, delete, flushTransaction, getConfiguration, getDAO, getDatePattern, getDateTimePattern, getEntities, getEntities, getEntityById, getLocale, getTransaction, newInstance, newService, setServiceContext, update
public static final String THUMB_PREFIX
public Poll getPollEditable(String pollUid, UserAccount userAccount, boolean clone) throws PollNotFoundException
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.pollUid
- Uid of the poll to edit, if not defined, a new poll is instanciateduserAccount
- Optinal User account to attach to the creatorclone
- Flag to copy or not ids in case of poll cloningPollNotFoundException
public Map<String,Object> pollToMap(Poll poll, org.nuiton.util.beans.Binder<Poll,Poll> binder)
public Poll updatePoll(Poll poll) throws PollNotFoundException
PollNotFoundException
public List<Poll> getCreatedPolls(org.nuiton.topia.persistence.pager.TopiaPagerBean pager, UserAccount user)
public List<org.apache.commons.lang3.tuple.Pair<Poll,PollAccount>> getInvitedPolls(org.nuiton.topia.persistence.pager.TopiaPagerBean pager, UserAccount user)
public List<org.apache.commons.lang3.tuple.Pair<Poll,PollAccount>> getParticipatedPolls(org.nuiton.topia.persistence.pager.TopiaPagerBean pager, UserAccount user)
public Poll getExistingPollByPollId(String pollId) throws PollNotFoundException
PollNotFoundException
public PollAccount getPollAccountEditable(String accountId, UserAccount userAccount, Poll poll) throws PollAccountNotFound
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
.accountId
- Id of the existing account (optional)userAccount
- UserAccount where account will be attached (optional)poll
- Poll where pollAccount will be addedPollAccountNotFound
- if accountId is defined and doesn't match any
existing PollAccountpublic void deletePoll(String pollId) throws PollNotFoundException
PollNotFoundException
public void closePoll(String pollId) throws PollNotFoundException
PollNotFoundException
public void attachPoll(String pollId, UserAccount userAccount) throws PollNotFoundException
PollNotFoundException
public Choice getNewChoice(ChoiceType choiceType)
public void addChoice(String pollId, Choice choice) throws PollNotFoundException
PollNotFoundException
public void deleteChoice(String pollId, String choiceId) throws PollNotFoundException, PollChoiceNotFoundException
public File getPollChoiceImageFile(String pollId, String choiceId)
pollId
- the id of the poll containing the image choicechoiceId
- the id of the choice to renderpublic File getImageThumbFile(File imagePath)
imagePath
- location of the imagepublic void saveImages(Poll poll, PollImageChoice choice) throws IOException
poll
- le sondage contenant le choixchoice
- le choix à sauvegarder.IOException
- si un problème IO lors de la copie ou
génération de la miniaturepublic File generateThumbIfNeeded(File pollChoiceImage) throws IOException
IOException
public PersonToList getNewPersonToList(PollAccount pollAccount)
protected void saveVotingList(Poll poll, VotingList votingList, EmailService emailService) throws org.nuiton.topia.TopiaException
org.nuiton.topia.TopiaException
protected void savePreventRule(Poll poll, PreventRule preventRule)
protected static void createThumbnail(File img, File thumbCopied, int width) throws IOException
img
- L'image à miniaturiser.thumbCopied
- le chemin complet vers la miniature.width
- La largeur de la miniature.IOException
- if could not create thumb imageCopyright © 2009–2014 CodeLutin. All rights reserved.