org.chorem.pollen.ui.actions.poll
Class AbstractPollForm

java.lang.Object
  extended by com.opensymphony.xwork2.ActionSupport
      extended by org.nuiton.web.struts2.BaseAction
          extended by org.chorem.pollen.ui.actions.PollenActionSupport
              extended by org.chorem.pollen.ui.actions.poll.AbstractPollForm
All Implemented Interfaces:
com.opensymphony.xwork2.Action, com.opensymphony.xwork2.LocaleProvider, com.opensymphony.xwork2.Preparable, com.opensymphony.xwork2.TextProvider, com.opensymphony.xwork2.Validateable, com.opensymphony.xwork2.ValidationAware, Serializable, org.apache.struts2.interceptor.ParameterAware, org.apache.struts2.interceptor.ServletRequestAware, FileUploadAware, org.nuiton.topia.framework.TopiaTransactionAware
Direct Known Subclasses:
ClonePoll, CreatePoll, EditPoll

public abstract class AbstractPollForm
extends PollenActionSupport
implements com.opensymphony.xwork2.Preparable, org.apache.struts2.interceptor.ParameterAware, FileUploadAware, org.apache.struts2.interceptor.ServletRequestAware

Created: 04/04/12

Author:
fdesbois $Id: AbstractPollForm.java 3534 2012-06-19 15:50:53Z tchemit $
See Also:
Serialized Form

Field Summary
static String IMAGECHOICES_THUMB_PREFIX
           
protected  boolean informationsError
          Flag when there is some errors on the information panel.
protected  Map<String,String[]> parameters
          All the parameters send by request used to build back choices of the poll.
protected  Poll poll
           
 
Fields inherited from class org.chorem.pollen.ui.actions.PollenActionSupport
SAFE_LANGUAGES, serviceContext, serviceFactory, transaction
 
Fields inherited from class com.opensymphony.xwork2.ActionSupport
LOG
 
Fields inherited from interface com.opensymphony.xwork2.Action
ERROR, INPUT, LOGIN, NONE, SUCCESS
 
Constructor Summary
AbstractPollForm()
           
 
Method Summary
 void addFieldError(String fieldName, String errorMessage)
           
 void addFile(int index, File file)
           
 void addFileContentType(int index, String contentType)
           
 void addFileName(int index, String fileName)
           
protected  void addInformationsError(String fieldName, String errorMessage)
           
protected  void addOptionsError(String fieldName, String errorMessage)
           
protected  Map<Integer,Choice> buildDateChoices()
           
protected  Map<Integer,Choice> buildImageChoices()
           
protected  Map<Integer,Choice> buildTextChoices()
           
protected  Map<Integer,VotingList> buildVotingLists(PollType pollType)
           
 String execute()
           
protected  void fillLists(int defaultMaxChoices, int defaultMaxVoting)
           
 String getActionLabel()
           
 Map<String,String> getChoiceTypes()
           
 com.google.common.base.Function<Choice,Choice> getDateChoiceCreator()
           
 List<Choice> getDateChoices()
           
 Object getDateChoiceValue(PollDateChoice choice)
           
 List<VotingList> getGroupVotingList()
           
 com.google.common.base.Function<Choice,Choice> getImageChoiceCreator()
           
 List<Choice> getImageChoices()
           
 Integer getMaxChoices()
           
protected  String getNonEmptyParameterValue(String paramName)
           
 String getPageTitle()
           
 com.google.common.base.Function<PersonToList,PersonToList> getPersontoListCreator()
           
 Poll getPoll()
           
 Map<String,String> getPollTypes()
           
 Integer getReminderHourCountdown()
           
 List<VotingList> getRestrictedVotingList()
           
 int getSelectedTab()
           
 PageSkin getSkin()
           
 com.google.common.base.Function<Choice,Choice> getTextChoiceCreator()
           
 List<Choice> getTextChoices()
           
 PollUri getUriId()
           
 Map<String,String> getVoteCountingTypes()
           
 com.google.common.base.Function<VotingList,VotingList> getVotingListCreator()
           
 String input()
           
 String inputAfterValidationError()
           
abstract  boolean isClone()
           
 boolean isCreatorUserAccountDefined()
           
protected  boolean isDateChoiceEmpty(PollDateChoice dateChoice)
           
abstract  boolean isEdit()
           
 boolean isFreePoll()
           
protected  boolean isGetMethod()
           
 boolean isGroupPoll()
           
protected  boolean isImageChoiceEmpty(PollImageChoice imageChoice)
           
protected  boolean isImageUploadEmpty(PollImageChoice imageChoice)
           
 boolean isInformationsError()
           
 boolean isLimitChoice()
           
 boolean isNotification()
           
 boolean isOptionsError()
           
protected  boolean isPersonToListEmpty(PersonToList personToList)
           
 boolean isReminder()
           
protected  boolean isTextChoiceEmpty(Choice textChoice)
           
 boolean isVoteStarted()
           
protected  void loadChoicesAndvotingLists(Poll poll, Collection<Choice> pollChoices, Collection<VotingList> pollVotinLists, boolean fillLists)
           
 void prepare()
           
 void prepareFormPage()
           
protected
<T> Map<Integer,T>
reindexChoiceMap(Map<Integer,T> result, int maxNumber)
           
protected
<T> Map<Integer,T>
reindexMap(Map<Integer,T> result, int maxNumber)
           
protected abstract  Poll savePoll(Poll poll)
           
 void setLimitChoice(boolean limitChoice)
           
 void setMaxChoices(Integer maxChoices)
           
 void setNotification(boolean notification)
           
 void setParameters(Map<String,String[]> parameters)
           
 void setReminder(boolean reminder)
           
 void setReminderHourCountdown(Integer reminderHourCountdown)
           
 void setServletRequest(javax.servlet.http.HttpServletRequest request)
           
 void setUriId(PollUri pollUri)
           
 void validate()
           
protected  void validateDateChoices()
           
protected  boolean validateEndDate(Date begin, Date end)
           
protected  void validateImageChoices()
           
protected  void validateInformations()
           
protected  void validateOptions()
           
protected  void validatePersonList(int personToListNumber, String votingListFieldNamePrefix, PersonToList personToList, Set<String> voters, Set<String> emails)
           
protected  void validateTextChoices()
           
protected  void validateVotingList(int votingListNumber, VotingList votingList, Set<String> groups, Set<String> voters, Set<String> emails)
           
 
Methods inherited from class org.chorem.pollen.ui.actions.PollenActionSupport
addFlashError, addFlashMessage, addFlashWarning, clearFlashErrors, clearFlashMessages, getActionContext, getApplicationUrl, getApplicationVersion, getConfiguration, getCurrentDateTime, getCurrentUrl, getFavoriteService, getFlashErrors, getFlashMessages, getFlashWarnings, getJqueryTheme, getPageLogo, getPollCommentService, getPollenApplicationContext, getPollenSession, getPollenUserAccount, getPollFeedService, getPollResultsService, getPollService, getPollUrlService, getPreventRuleService, getSafeLanguage, getSecurityService, getServiceContext, getServiceFactory, getTransaction, getUserService, getVoteCountingTypeHelp, getVoteService, hasAnyErrors, hasFlashErrors, hasFlashMessages, hasFlashWarnings, isUserAdmin, isUserLoggued, newService, setTransaction
 
Methods inherited from class org.nuiton.web.struts2.BaseAction
_
 
Methods inherited from class com.opensymphony.xwork2.ActionSupport
addActionError, addActionMessage, clearActionErrors, clearErrors, clearErrorsAndMessages, clearFieldErrors, clearMessages, clone, doDefault, getActionErrors, getActionMessages, getErrorMessages, getErrors, getFieldErrors, getLocale, getText, getText, getText, getText, getText, getText, getText, getText, getText, getTexts, getTexts, hasActionErrors, hasActionMessages, hasErrors, hasFieldErrors, hasKey, pause, setActionErrors, setActionMessages, setContainer, setFieldErrors
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IMAGECHOICES_THUMB_PREFIX

public static final String IMAGECHOICES_THUMB_PREFIX
See Also:
Constant Field Values

poll

protected Poll poll

informationsError

protected boolean informationsError
Flag when there is some errors on the information panel.

Since:
1.3

parameters

protected final Map<String,String[]> parameters
All the parameters send by request used to build back choices of the poll.

Since:
1.3
Constructor Detail

AbstractPollForm

public AbstractPollForm()
Method Detail

isClone

public abstract boolean isClone()

savePoll

protected abstract Poll savePoll(Poll poll)
                          throws PollNotFoundException
Throws:
PollNotFoundException

isEdit

public abstract boolean isEdit()

setServletRequest

public void setServletRequest(javax.servlet.http.HttpServletRequest request)
Specified by:
setServletRequest in interface org.apache.struts2.interceptor.ServletRequestAware

prepare

public void prepare()
             throws Exception
Specified by:
prepare in interface com.opensymphony.xwork2.Preparable
Throws:
Exception

input

public String input()
             throws Exception
Overrides:
input in class com.opensymphony.xwork2.ActionSupport
Throws:
Exception

inputAfterValidationError

public String inputAfterValidationError()
                                 throws Exception
Throws:
Exception

execute

public String execute()
               throws Exception
Specified by:
execute in interface com.opensymphony.xwork2.Action
Overrides:
execute in class com.opensymphony.xwork2.ActionSupport
Throws:
Exception

isGetMethod

protected boolean isGetMethod()

validate

public void validate()
Specified by:
validate in interface com.opensymphony.xwork2.Validateable
Overrides:
validate in class com.opensymphony.xwork2.ActionSupport

addFile

public void addFile(int index,
                    File file)
Specified by:
addFile in interface FileUploadAware

addFileContentType

public void addFileContentType(int index,
                               String contentType)
Specified by:
addFileContentType in interface FileUploadAware

addFileName

public void addFileName(int index,
                        String fileName)
Specified by:
addFileName in interface FileUploadAware

setParameters

public void setParameters(Map<String,String[]> parameters)
Specified by:
setParameters in interface org.apache.struts2.interceptor.ParameterAware

getSkin

public PageSkin getSkin()
Overrides:
getSkin in class PollenActionSupport

isInformationsError

public boolean isInformationsError()

isOptionsError

public boolean isOptionsError()

getSelectedTab

public int getSelectedTab()

getUriId

public PollUri getUriId()

setUriId

public void setUriId(PollUri pollUri)

getPoll

public Poll getPoll()

getPollTypes

public Map<String,String> getPollTypes()

getVoteCountingTypes

public Map<String,String> getVoteCountingTypes()

getChoiceTypes

public Map<String,String> getChoiceTypes()

getTextChoices

public List<Choice> getTextChoices()

getImageChoices

public List<Choice> getImageChoices()

getDateChoices

public List<Choice> getDateChoices()

getRestrictedVotingList

public List<VotingList> getRestrictedVotingList()

getGroupVotingList

public List<VotingList> getGroupVotingList()

isNotification

public boolean isNotification()

setNotification

public void setNotification(boolean notification)

getMaxChoices

public Integer getMaxChoices()

setMaxChoices

public void setMaxChoices(Integer maxChoices)

isReminder

public boolean isReminder()

setReminder

public void setReminder(boolean reminder)

isLimitChoice

public boolean isLimitChoice()

setLimitChoice

public void setLimitChoice(boolean limitChoice)

getReminderHourCountdown

public Integer getReminderHourCountdown()

setReminderHourCountdown

public void setReminderHourCountdown(Integer reminderHourCountdown)

isFreePoll

public boolean isFreePoll()

isGroupPoll

public boolean isGroupPoll()

getActionLabel

public String getActionLabel()

getPageTitle

public String getPageTitle()

isVoteStarted

public boolean isVoteStarted()

isCreatorUserAccountDefined

public boolean isCreatorUserAccountDefined()

prepareFormPage

public void prepareFormPage()
                     throws Exception
Throws:
Exception

getPersontoListCreator

public com.google.common.base.Function<PersonToList,PersonToList> getPersontoListCreator()

getVotingListCreator

public com.google.common.base.Function<VotingList,VotingList> getVotingListCreator()

getTextChoiceCreator

public com.google.common.base.Function<Choice,Choice> getTextChoiceCreator()

getDateChoiceCreator

public com.google.common.base.Function<Choice,Choice> getDateChoiceCreator()

getImageChoiceCreator

public com.google.common.base.Function<Choice,Choice> getImageChoiceCreator()

validateInformations

protected void validateInformations()

validateTextChoices

protected void validateTextChoices()

validateDateChoices

protected void validateDateChoices()

validateImageChoices

protected void validateImageChoices()

validateOptions

protected void validateOptions()

validateVotingList

protected void validateVotingList(int votingListNumber,
                                  VotingList votingList,
                                  Set<String> groups,
                                  Set<String> voters,
                                  Set<String> emails)

validatePersonList

protected void validatePersonList(int personToListNumber,
                                  String votingListFieldNamePrefix,
                                  PersonToList personToList,
                                  Set<String> voters,
                                  Set<String> emails)

validateEndDate

protected boolean validateEndDate(Date begin,
                                  Date end)

getDateChoiceValue

public Object getDateChoiceValue(PollDateChoice choice)

addFieldError

public void addFieldError(String fieldName,
                          String errorMessage)
Specified by:
addFieldError in interface com.opensymphony.xwork2.ValidationAware
Overrides:
addFieldError in class com.opensymphony.xwork2.ActionSupport

addInformationsError

protected void addInformationsError(String fieldName,
                                    String errorMessage)

addOptionsError

protected void addOptionsError(String fieldName,
                               String errorMessage)

loadChoicesAndvotingLists

protected void loadChoicesAndvotingLists(Poll poll,
                                         Collection<Choice> pollChoices,
                                         Collection<VotingList> pollVotinLists,
                                         boolean fillLists)
                                  throws IOException
Throws:
IOException

fillLists

protected void fillLists(int defaultMaxChoices,
                         int defaultMaxVoting)

isTextChoiceEmpty

protected boolean isTextChoiceEmpty(Choice textChoice)

isDateChoiceEmpty

protected boolean isDateChoiceEmpty(PollDateChoice dateChoice)

isImageChoiceEmpty

protected boolean isImageChoiceEmpty(PollImageChoice imageChoice)

isImageUploadEmpty

protected boolean isImageUploadEmpty(PollImageChoice imageChoice)

isPersonToListEmpty

protected boolean isPersonToListEmpty(PersonToList personToList)

buildTextChoices

protected Map<Integer,Choice> buildTextChoices()

buildDateChoices

protected Map<Integer,Choice> buildDateChoices()

buildImageChoices

protected Map<Integer,Choice> buildImageChoices()

buildVotingLists

protected Map<Integer,VotingList> buildVotingLists(PollType pollType)

reindexMap

protected <T> Map<Integer,T> reindexMap(Map<Integer,T> result,
                                        int maxNumber)

reindexChoiceMap

protected <T> Map<Integer,T> reindexChoiceMap(Map<Integer,T> result,
                                              int maxNumber)

getNonEmptyParameterValue

protected String getNonEmptyParameterValue(String paramName)


Copyright © 2009-2012 CodeLutin. All Rights Reserved.