|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.chorem.pollen.services.PollenServiceSupport
org.chorem.pollen.services.impl.PollService
public class PollService
| Field Summary | |
|---|---|
static String |
THUMB_PREFIX
|
| Fields inherited from class org.chorem.pollen.services.PollenServiceSupport |
|---|
serviceContext |
| Constructor Summary | |
|---|---|
PollService()
|
|
| Method Summary | |
|---|---|
void |
addChoice(String pollId,
Choice choice)
|
void |
attachPoll(Poll poll,
UserAccount userAccount)
|
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)
|
File |
generateThumbIfNeeded(File pollChoiceImage)
|
List<Poll> |
getCreatedPolls(org.nuiton.topia.persistence.TopiaFilterPagerUtil.FilterPagerBean 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.TopiaFilterPagerUtil.FilterPagerBean pager,
UserAccount user)
|
Choice |
getNewChoice(ChoiceType choiceType)
|
PersonToList |
getNewPersonToList(PollAccount pollAccount)
|
protected Poll |
getNewPoll(UserAccount user)
Build a new Poll instance with given user as creator |
PollAccount |
getNewPollAccount(UserAccount userAccount)
|
protected Poll |
getNewPollCopy(String pollUid,
UserAccount userAccount,
boolean clone)
Obtains a copy of an existing poll given his pollUid. |
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)
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.TopiaFilterPagerUtil.FilterPagerBean pager)
|
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)
|
Poll |
updatePoll(Poll poll)
|
| Methods inherited from class org.chorem.pollen.services.PollenServiceSupport |
|---|
commitTransaction, create, createWithProperties, decorateDate, decorateDateTime, delete, flushTransaction, generateId, 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 |
| Field Detail |
|---|
public static final String THUMB_PREFIX
| Constructor Detail |
|---|
public PollService()
| Method Detail |
|---|
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 cloning
PollNotFoundExceptiongetNewPoll(UserAccount),
getNewPollCopy(String, UserAccount, boolean)
public Map<String,Object> pollToMap(Poll poll,
org.nuiton.util.beans.Binder<Poll,Poll> binder)
public Poll createPoll(Poll poll)
public Poll updatePoll(Poll poll)
throws PollNotFoundException
PollNotFoundExceptionpublic List<Poll> getPolls(org.nuiton.topia.persistence.TopiaFilterPagerUtil.FilterPagerBean pager)
public List<Poll> getCreatedPolls(org.nuiton.topia.persistence.TopiaFilterPagerUtil.FilterPagerBean pager,
UserAccount user)
public List<org.apache.commons.lang3.tuple.Pair<Poll,PollAccount>> getInvitedPolls(org.nuiton.topia.persistence.TopiaFilterPagerUtil.FilterPagerBean pager,
UserAccount user)
public List<org.apache.commons.lang3.tuple.Pair<Poll,PollAccount>> getParticipatedPolls(org.nuiton.topia.persistence.TopiaFilterPagerUtil.FilterPagerBean pager,
UserAccount user)
public List<Poll> getRunningPolls(boolean withEndDate)
public Poll getPollByPollId(String pollId)
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 added
PollAccountNotFound - if accountId is defined and doesn't match any
existing PollAccountprotected Poll getNewPoll(UserAccount user)
user as creator
user - Build a new Poll instance with given user as creator
user as creator
protected Poll getNewPollCopy(String pollUid,
UserAccount userAccount,
boolean clone)
throws PollNotFoundException
pollUid.
If flag clone is setted to true, then all id will
be removed (pollId, accountId, topiaId).
pollUid - the Poll.getPollId() of the poll to copyuserAccount - optional incoming user account to link to the
Poll.getCreator()clone - flag to clone or not the copy of the poll (if setted
to true then all id will be removed).
PollNotFoundException - if poll was not foundprotected PollAccount copyPollAccount(PollAccount source)
public PollAccount getNewPollAccount(UserAccount userAccount)
public PollAccount getPollAccountByAccountId(String accountId)
throws PollAccountNotFound
PollAccountNotFound
public void deletePoll(String pollId,
UserAccount userAccount,
String accountId)
throws PollNotFoundException,
PollAccountNotFound,
UnauthorizedPollAccessException
PollNotFoundException
PollAccountNotFound
UnauthorizedPollAccessException
public void closePoll(String pollId,
UserAccount userAccount,
String accountId)
throws PollNotFoundException,
PollAccountNotFound,
UnauthorizedPollAccessException
PollNotFoundException
PollAccountNotFound
UnauthorizedPollAccessException
public void attachPoll(Poll poll,
UserAccount userAccount)
public Choice getNewChoice(ChoiceType choiceType)
public void addChoice(String pollId,
Choice choice)
throws PollNotFoundException
PollNotFoundException
protected Choice saveChoice(Poll poll,
Choice choice)
public void deleteChoice(String pollId,
String choiceId)
throws PollNotFoundException,
PollChoiceNotFoundException
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 render
public File getImageThumbFile(File imagePath)
imagePath - location of the image
public 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 miniature
public File generateThumbIfNeeded(File pollChoiceImage)
throws IOException
IOExceptionpublic 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 image
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||