com.stratelia.webactiv.survey.control
Class SurveySessionController

java.lang.Object
  extended by com.stratelia.silverpeas.peasCore.AbstractComponentSessionController
      extended by com.stratelia.webactiv.survey.control.SurveySessionController
All Implemented Interfaces:
com.stratelia.silverpeas.peasCore.ComponentSessionController

public class SurveySessionController
extends com.stratelia.silverpeas.peasCore.AbstractComponentSessionController

This class contains business layer of survey component


Field Summary
static int CLOSED_SURVEYS_VIEW
           
static String COOKIE_NAME
           
static int INWAIT_SURVEYS_VIEW
           
static int OPENED_SURVEYS_VIEW
           
 
Fields inherited from class com.stratelia.silverpeas.peasCore.AbstractComponentSessionController
CHARACTER_ENCODING, context
 
Constructor Summary
SurveySessionController(com.stratelia.silverpeas.peasCore.MainSessionController mainSessionCtrl, com.stratelia.silverpeas.peasCore.ComponentContext componentContext)
          Creates new sessionClientController
 
Method Summary
 void close()
           
 void closeSurvey(String surveyId)
           
 void copySurvey(String surveyId)
           
 com.stratelia.webactiv.util.questionContainer.model.QuestionContainerPK createSurvey(com.stratelia.webactiv.util.questionContainer.model.QuestionContainerDetail surveyDetail)
           
 com.stratelia.webactiv.util.questionContainer.model.QuestionContainerPK createSurvey(com.stratelia.webactiv.util.questionContainer.model.QuestionContainerDetail surveyDetail, String componentId)
           
 void deleteResponse(String surveyId)
           
 void deleteSurvey(String surveyId)
           
 void deleteVotes(String surveyId)
           
 String exportSurveyCSV(String surveyId)
           
 List<org.silverpeas.attachment.model.SimpleDocument> getAllSynthesisFile(String surveyId)
           
 Collection<com.stratelia.webactiv.util.questionContainer.model.QuestionContainerHeader> getClosedSurveys()
           
 List<com.stratelia.webactiv.beans.admin.ComponentInstLight> getGalleries()
           
 Collection<com.stratelia.webactiv.util.questionContainer.model.QuestionContainerHeader> getInWaitSurveys()
           
 List<String> getListQuestionStyle()
          Change this code with an enum list of question style using for
protected  com.silverpeas.util.template.SilverpeasTemplate getNewTemplate()
           
 Collection<com.stratelia.webactiv.util.questionContainer.model.QuestionContainerHeader> getOpenedSurveys()
           
 com.stratelia.webactiv.util.questionContainer.control.QuestionContainerBm getQuestionContainerBm()
           
 com.stratelia.webactiv.util.questionResult.control.QuestionResultBm getQuestionResultBm()
           
 Collection<String> getResultByUser(String userId)
           
 Collection<com.stratelia.webactiv.util.questionResult.model.QuestionResult> getResultByUser(String userId, com.silverpeas.util.ForeignPK questionPK)
           
 List<com.stratelia.webactiv.util.question.model.Question> getSessionQuestions()
           
 Map<String,List<String>> getSessionResponses()
           
 com.stratelia.webactiv.util.questionContainer.model.QuestionContainerDetail getSessionSurvey()
           
 String getSessionSurveyId()
           
 String getSessionSurveyName()
           
 com.stratelia.webactiv.util.questionContainer.model.QuestionContainerDetail getSessionSurveyUnderConstruction()
           
 int getSilverObjectId(String objectId)
           
 com.stratelia.webactiv.util.questionResult.model.QuestionResult getSuggestion(String userId, String questionId, String answerId)
           
 Collection<com.stratelia.webactiv.util.questionResult.model.QuestionResult> getSuggestions(String surveyId)
           
 com.stratelia.webactiv.util.questionContainer.model.QuestionContainerDetail getSurvey(String surveyId)
           
 Collection<com.stratelia.webactiv.util.questionContainer.model.QuestionContainerHeader> getSurveys()
           
 Collection<String> getUserByAnswer(String answerId)
           
 Collection<String> getUserByQuestion(com.silverpeas.util.ForeignPK questionPK)
           
 Collection<String> getUserByQuestion(com.silverpeas.util.ForeignPK questionPK, boolean withName)
           
 com.stratelia.webactiv.beans.admin.UserDetail getUserDetail(String userId)
           
 Collection<String> getUsersByAnswer(String answerId)
           
 Collection<String> getUsersBySurvey(String surveyId)
           
 int getViewType()
           
 boolean hasAlreadyParticipated()
          Return if anonymous user has already participated with this ip
 void hasAlreadyParticipated(boolean state)
          Set status of anonymous user (if he has already participated with this ip)
 void initAlertResultParticipants(com.stratelia.webactiv.util.questionContainer.model.QuestionContainerDetail surveyDetail)
           
 void initAlertResultUsers(com.stratelia.webactiv.util.questionContainer.model.QuestionContainerDetail surveyDetail)
           
 String initAlertUser(String surveyId)
           
 boolean isAnonymousModeAuthorized()
          Return if anonymous mode is authorized
 boolean isAnonymousModeEnabled()
          Return if anonymous mode is enabled
 boolean isParticipationMultipleAllowedForUser()
          Return if user can participate more than one time
 boolean isParticipationMultipleUsed()
          Return if participationMultiple is used
 boolean isPdcUsed()
           
 boolean isPollingStationMode()
           
 String manageQuestionBusiness(String function, javax.servlet.http.HttpServletRequest request)
           
 void openSurvey(String surveyId)
           
 void paste()
          Paste surveys which are in the clipboard selection
 void questionsUpdateBusinessModel(javax.servlet.http.HttpServletRequest request)
          prepare data inside session controller before sending them to the view layer
 void recordReply(String surveyId, Map<String,List<String>> reply)
           
 void recordReply(String surveyId, Map<String,List<String>> reply, String comment, boolean isAnonymousComment)
           
 void removeSessionQuestions()
           
 void removeSessionResponses()
           
 void removeSessionSurvey()
           
 void removeSessionSurveyId()
           
 void removeSessionSurveyName()
           
 void removeSessionSurveyUnderConstruction()
           
 void removeSynthesisFile(String idDocument)
           
 void saveSynthesisFile(org.apache.commons.fileupload.FileItem fileSynthesis)
           
 void sendNewSurveyAction(javax.servlet.http.HttpServletRequest request)
          Refactoring : get code from view JSP and add it inside controller
 void setNewSurveyPositionsFromJSON(String positions)
          Set new survey positions (axis classification) from JSON string
 void setParticipationMultipleAllowedForUser(boolean state)
          Set user status to know if he can participate more than one time
 void setPollingStationMode(boolean pollingStationMode)
           
 void setSessionQuestions(List<com.stratelia.webactiv.util.question.model.Question> questions)
           
 void setSessionResponses(Map<String,List<String>> responses)
           
 void setSessionSurvey(com.stratelia.webactiv.util.questionContainer.model.QuestionContainerDetail survey)
           
 void setSessionSurveyId(String surveyId)
           
 void setSessionSurveyName(String surveyName)
           
 void setSessionSurveyUnderConstruction(com.stratelia.webactiv.util.questionContainer.model.QuestionContainerDetail surveyUnderConstruction)
           
 void setViewType(int viewType)
           
 void updateQuestions(Collection<com.stratelia.webactiv.util.question.model.Question> questions, String surveyId)
           
 void updateSurveyHeader(com.stratelia.webactiv.util.questionContainer.model.QuestionContainerHeader surveyHeader, String surveyId)
           
 void updateSynthesisFile(org.apache.commons.fileupload.FileItem newFileSynthesis, String idDocument)
           
 
Methods inherited from class com.stratelia.silverpeas.peasCore.AbstractComponentSessionController
addClipboardSelection, clipboardPasteDone, getAlertUser, getClipboardCount, getClipboardErrorMessage, getClipboardExceptionError, getClipboardName, getClipboardObjects, getClipboardSelectedObjects, getClipboardSize, getComponentAccessController, getComponentId, getComponentLabel, getComponentName, getComponentParameters, getComponentParameterValue, getComponentParameterValue, getComponentRootName, getComponentUrl, getFavoriteSpace, getGenericPanel, getHighestSilverpeasUserRole, getIcon, getLanguage, getLastResults, getLook, getMultilang, getOrganisationController, getPersonalization, getRSSUrl, getSelection, getServerNameAndPort, getSettings, getSilverpeasUserRoles, getSpaceId, getSpaceLabel, getString, getSubscriptionContext, getUrlEncodedParameter, getUserAccessLevel, getUserAvailComponentIds, getUserAvailSpaceIds, getUserDetail, getUserId, getUserManageableGroupIds, getUserManageableSpaceIds, getUserRoleLevel, getUserRoles, isAppInMaintenance, isGroupManager, isPasswordChangeAllowed, isSpaceInMaintenance, removeClipboardElement, setAppModeMaintenance, setClipboardError, setClipboardSelectedElement, setComponentRootName, setFavoriteSpaceToMainSessionController, setGenericPanel, setIconFileName, setLastResults, setMultilangFileName, setResourceFileName, setSpaceModeMaintenance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPENED_SURVEYS_VIEW

public static final int OPENED_SURVEYS_VIEW
See Also:
Constant Field Values

CLOSED_SURVEYS_VIEW

public static final int CLOSED_SURVEYS_VIEW
See Also:
Constant Field Values

INWAIT_SURVEYS_VIEW

public static final int INWAIT_SURVEYS_VIEW
See Also:
Constant Field Values

COOKIE_NAME

public static final String COOKIE_NAME
See Also:
Constant Field Values
Constructor Detail

SurveySessionController

public SurveySessionController(com.stratelia.silverpeas.peasCore.MainSessionController mainSessionCtrl,
                               com.stratelia.silverpeas.peasCore.ComponentContext componentContext)
Creates new sessionClientController

Parameters:
mainSessionCtrl -
componentContext -
Method Detail

getQuestionContainerBm

public com.stratelia.webactiv.util.questionContainer.control.QuestionContainerBm getQuestionContainerBm()

getQuestionResultBm

public com.stratelia.webactiv.util.questionResult.control.QuestionResultBm getQuestionResultBm()

isPdcUsed

public boolean isPdcUsed()

isParticipationMultipleAllowedForUser

public boolean isParticipationMultipleAllowedForUser()
Return if user can participate more than one time

Returns:
true or false

setParticipationMultipleAllowedForUser

public void setParticipationMultipleAllowedForUser(boolean state)
Set user status to know if he can participate more than one time

Parameters:
state -

isParticipationMultipleUsed

public boolean isParticipationMultipleUsed()
Return if participationMultiple is used

Returns:
true or false

isAnonymousModeAuthorized

public boolean isAnonymousModeAuthorized()
Return if anonymous mode is authorized

Returns:

isAnonymousModeEnabled

public boolean isAnonymousModeEnabled()
Return if anonymous mode is enabled

Returns:

hasAlreadyParticipated

public boolean hasAlreadyParticipated()
Return if anonymous user has already participated with this ip

Returns:

hasAlreadyParticipated

public void hasAlreadyParticipated(boolean state)
Set status of anonymous user (if he has already participated with this ip)

Parameters:
state -

setViewType

public void setViewType(int viewType)

getViewType

public int getViewType()

getSurveys

public Collection<com.stratelia.webactiv.util.questionContainer.model.QuestionContainerHeader> getSurveys()
                                                                                                   throws SurveyException
Returns:
a list of survey of the current instance of component.
Throws:
SurveyException

getOpenedSurveys

public Collection<com.stratelia.webactiv.util.questionContainer.model.QuestionContainerHeader> getOpenedSurveys()
                                                                                                         throws SurveyException
Throws:
SurveyException

getClosedSurveys

public Collection<com.stratelia.webactiv.util.questionContainer.model.QuestionContainerHeader> getClosedSurveys()
                                                                                                         throws SurveyException
Throws:
SurveyException

getInWaitSurveys

public Collection<com.stratelia.webactiv.util.questionContainer.model.QuestionContainerHeader> getInWaitSurveys()
                                                                                                         throws SurveyException
Throws:
SurveyException

getSurvey

public com.stratelia.webactiv.util.questionContainer.model.QuestionContainerDetail getSurvey(String surveyId)
                                                                                      throws SurveyException
Parameters:
surveyId - the survey identifier
Returns:
the question container detail of the survey given in parameter
Throws:
SurveyException

createSurvey

public com.stratelia.webactiv.util.questionContainer.model.QuestionContainerPK createSurvey(com.stratelia.webactiv.util.questionContainer.model.QuestionContainerDetail surveyDetail)
                                                                                     throws SurveyException
Throws:
SurveyException

createSurvey

public com.stratelia.webactiv.util.questionContainer.model.QuestionContainerPK createSurvey(com.stratelia.webactiv.util.questionContainer.model.QuestionContainerDetail surveyDetail,
                                                                                            String componentId)
                                                                                     throws SurveyException
Throws:
SurveyException

updateSurveyHeader

public void updateSurveyHeader(com.stratelia.webactiv.util.questionContainer.model.QuestionContainerHeader surveyHeader,
                               String surveyId)
                        throws SurveyException
Throws:
SurveyException

updateQuestions

public void updateQuestions(Collection<com.stratelia.webactiv.util.question.model.Question> questions,
                            String surveyId)
                     throws SurveyException
Throws:
SurveyException

deleteSurvey

public void deleteSurvey(String surveyId)
                  throws SurveyException
Throws:
SurveyException

deleteVotes

public void deleteVotes(String surveyId)
                 throws SurveyException
Throws:
SurveyException

deleteResponse

public void deleteResponse(String surveyId)
                    throws SurveyException
Throws:
SurveyException

getUserByQuestion

public Collection<String> getUserByQuestion(com.silverpeas.util.ForeignPK questionPK)
                                     throws RemoteException
Throws:
RemoteException

getUserByQuestion

public Collection<String> getUserByQuestion(com.silverpeas.util.ForeignPK questionPK,
                                            boolean withName)
                                     throws RemoteException
Throws:
RemoteException

getResultByUser

public Collection<com.stratelia.webactiv.util.questionResult.model.QuestionResult> getResultByUser(String userId,
                                                                                                   com.silverpeas.util.ForeignPK questionPK)
                                                                                            throws RemoteException
Throws:
RemoteException

getResultByUser

public Collection<String> getResultByUser(String userId)
                                   throws RemoteException
Throws:
RemoteException

getUserByAnswer

public Collection<String> getUserByAnswer(String answerId)
                                   throws RemoteException
Throws:
RemoteException

closeSurvey

public void closeSurvey(String surveyId)
                 throws SurveyException
Throws:
SurveyException

openSurvey

public void openSurvey(String surveyId)
                throws SurveyException
Throws:
SurveyException

recordReply

public void recordReply(String surveyId,
                        Map<String,List<String>> reply)
                 throws SurveyException
Throws:
SurveyException

recordReply

public void recordReply(String surveyId,
                        Map<String,List<String>> reply,
                        String comment,
                        boolean isAnonymousComment)
                 throws SurveyException
Throws:
SurveyException

getSuggestions

public Collection<com.stratelia.webactiv.util.questionResult.model.QuestionResult> getSuggestions(String surveyId)
                                                                                           throws SurveyException
Throws:
SurveyException

getUsersByAnswer

public Collection<String> getUsersByAnswer(String answerId)
                                    throws RemoteException
Throws:
RemoteException

getUsersBySurvey

public Collection<String> getUsersBySurvey(String surveyId)
                                    throws RemoteException,
                                           SurveyException
Throws:
RemoteException
SurveyException

getUserDetail

public com.stratelia.webactiv.beans.admin.UserDetail getUserDetail(String userId)
Overrides:
getUserDetail in class com.stratelia.silverpeas.peasCore.AbstractComponentSessionController

getSilverObjectId

public int getSilverObjectId(String objectId)

getSessionSurveyUnderConstruction

public com.stratelia.webactiv.util.questionContainer.model.QuestionContainerDetail getSessionSurveyUnderConstruction()

setSessionSurveyUnderConstruction

public void setSessionSurveyUnderConstruction(com.stratelia.webactiv.util.questionContainer.model.QuestionContainerDetail surveyUnderConstruction)

removeSessionSurveyUnderConstruction

public void removeSessionSurveyUnderConstruction()

getSessionSurvey

public com.stratelia.webactiv.util.questionContainer.model.QuestionContainerDetail getSessionSurvey()

setSessionSurvey

public void setSessionSurvey(com.stratelia.webactiv.util.questionContainer.model.QuestionContainerDetail survey)

removeSessionSurvey

public void removeSessionSurvey()

getSessionQuestions

public List<com.stratelia.webactiv.util.question.model.Question> getSessionQuestions()

setSessionQuestions

public void setSessionQuestions(List<com.stratelia.webactiv.util.question.model.Question> questions)

removeSessionQuestions

public void removeSessionQuestions()

getSessionResponses

public Map<String,List<String>> getSessionResponses()

setSessionResponses

public void setSessionResponses(Map<String,List<String>> responses)

removeSessionResponses

public void removeSessionResponses()

getSessionSurveyId

public String getSessionSurveyId()

setSessionSurveyId

public void setSessionSurveyId(String surveyId)

removeSessionSurveyId

public void removeSessionSurveyId()

getSessionSurveyName

public String getSessionSurveyName()

setSessionSurveyName

public void setSessionSurveyName(String surveyName)

removeSessionSurveyName

public void removeSessionSurveyName()

close

public void close()
Overrides:
close in class com.stratelia.silverpeas.peasCore.AbstractComponentSessionController

initAlertUser

public String initAlertUser(String surveyId)
                     throws RemoteException,
                            SurveyException
Throws:
RemoteException
SurveyException

isPollingStationMode

public boolean isPollingStationMode()

setPollingStationMode

public void setPollingStationMode(boolean pollingStationMode)

getGalleries

public List<com.stratelia.webactiv.beans.admin.ComponentInstLight> getGalleries()
Returns:
a list of component instance light of the silverpeas gallery

exportSurveyCSV

public String exportSurveyCSV(String surveyId)

copySurvey

public void copySurvey(String surveyId)
                throws com.silverpeas.util.clipboard.ClipboardException,
                       SurveyException
Throws:
com.silverpeas.util.clipboard.ClipboardException
SurveyException

paste

public void paste()
           throws Exception
Paste surveys which are in the clipboard selection

Throws:
Exception

getNewTemplate

protected com.silverpeas.util.template.SilverpeasTemplate getNewTemplate()
Returns:
a SilverpeasTemplate

questionsUpdateBusinessModel

public void questionsUpdateBusinessModel(javax.servlet.http.HttpServletRequest request)
prepare data inside session controller before sending them to the view layer

Parameters:
request - the current HttpServletRequest

getListQuestionStyle

public List<String> getListQuestionStyle()
Change this code with an enum list of question style using for

Returns:
a list of question styles

manageQuestionBusiness

public String manageQuestionBusiness(String function,
                                     javax.servlet.http.HttpServletRequest request)
Parameters:
function -
request -
Returns:
the view to display

sendNewSurveyAction

public void sendNewSurveyAction(javax.servlet.http.HttpServletRequest request)
Refactoring : get code from view JSP and add it inside controller

Parameters:
request - the HttpServletRequest which contains all the request parameter

setNewSurveyPositionsFromJSON

public void setNewSurveyPositionsFromJSON(String positions)
Set new survey positions (axis classification) from JSON string

Parameters:
positions: - the JSON string positions

initAlertResultParticipants

public void initAlertResultParticipants(com.stratelia.webactiv.util.questionContainer.model.QuestionContainerDetail surveyDetail)
                                 throws RemoteException,
                                        SurveyException
Throws:
RemoteException
SurveyException

initAlertResultUsers

public void initAlertResultUsers(com.stratelia.webactiv.util.questionContainer.model.QuestionContainerDetail surveyDetail)
                          throws RemoteException
Throws:
RemoteException

saveSynthesisFile

public void saveSynthesisFile(org.apache.commons.fileupload.FileItem fileSynthesis)
                       throws SurveyException
Throws:
SurveyException

updateSynthesisFile

public void updateSynthesisFile(org.apache.commons.fileupload.FileItem newFileSynthesis,
                                String idDocument)
                         throws SurveyException
Throws:
SurveyException

removeSynthesisFile

public void removeSynthesisFile(String idDocument)

getAllSynthesisFile

public List<org.silverpeas.attachment.model.SimpleDocument> getAllSynthesisFile(String surveyId)

getSuggestion

public com.stratelia.webactiv.util.questionResult.model.QuestionResult getSuggestion(String userId,
                                                                                     String questionId,
                                                                                     String answerId)
                                                                              throws SurveyException
Throws:
SurveyException


Copyright © 2016 Silverpeas. All Rights Reserved.