Class SurveySessionController
- java.lang.Object
-
- org.silverpeas.core.web.mvc.controller.AbstractComponentSessionController
-
- org.silverpeas.components.survey.control.SurveySessionController
-
- All Implemented Interfaces:
Serializable,org.silverpeas.core.web.mvc.controller.ComponentSessionController,org.silverpeas.core.web.session.SessionCloseable
public class SurveySessionController extends org.silverpeas.core.web.mvc.controller.AbstractComponentSessionControllerThis class contains business layer of survey component- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intCLOSED_SURVEYS_VIEWstatic StringCOOKIE_NAMEstatic StringDISPLAY_COMMENTS_FOR_ALLstatic StringDISPLAY_COMMENTS_FOR_MANAGERSstatic StringDISPLAY_COMMENTS_FOR_NOBODYstatic intINWAIT_SURVEYS_VIEWstatic intOPENED_SURVEYS_VIEWstatic StringPARAM_DISPLAY_COMMENTS
-
Constructor Summary
Constructors Constructor Description SurveySessionController(org.silverpeas.core.web.mvc.controller.MainSessionController mainSessionCtrl, org.silverpeas.core.web.mvc.controller.ComponentContext componentContext)Creates new sessionClientController
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseSurvey(String surveyId)voidcopySurvey(String surveyId)org.silverpeas.core.questioncontainer.container.model.QuestionContainerPKcreateSurvey(org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail surveyDetail)org.silverpeas.core.questioncontainer.container.model.QuestionContainerPKcreateSurvey(org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail surveyDetail, String componentId)voiddeleteResponse(String surveyId)voiddeleteSurvey(String surveyId)voiddeleteVotes(String surveyId)org.silverpeas.core.web.export.ExportCSVBuilderexportSurveyCSV(String surveyId)List<org.silverpeas.core.contribution.attachment.model.SimpleDocument>getAllSynthesisFile(String surveyId)Collection<org.silverpeas.core.questioncontainer.container.model.QuestionContainerHeader>getClosedSurveys()StringgetDisplayCommentsMode()Get display comments ModeDisplayResultViewgetDisplayResultView()Gets the display result view.List<org.silverpeas.core.admin.component.model.ComponentInstLight>getGalleries()Collection<org.silverpeas.core.questioncontainer.container.model.QuestionContainerHeader>getInWaitSurveys()List<String>getListQuestionStyle()Change this code with an enum list of question style using forCollection<org.silverpeas.core.questioncontainer.container.model.QuestionContainerHeader>getOpenedSurveys()org.silverpeas.core.questioncontainer.container.service.QuestionContainerServicegetQuestionContainerService()org.silverpeas.core.questioncontainer.result.service.QuestionResultServicegetQuestionResultService()Collection<String>getResultByUser(String userId)org.silverpeas.core.questioncontainer.result.model.ResultsgetResults()List<org.silverpeas.core.questioncontainer.question.model.Question>getSessionQuestions()Map<String,List<String>>getSessionResponses()org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetailgetSessionSurvey()StringgetSessionSurveyId()StringgetSessionSurveyName()org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetailgetSessionSurveyUnderConstruction()intgetSilverObjectId(String objectId)org.silverpeas.core.questioncontainer.result.model.QuestionResultgetSuggestion(String userId, String questionId, String answerId)Collection<org.silverpeas.core.questioncontainer.result.model.QuestionResult>getSuggestions(String surveyId)org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetailgetSurvey(String surveyId)Collection<org.silverpeas.core.questioncontainer.container.model.QuestionContainerHeader>getSurveys()Collection<String>getUserByAnswer(String answerId)Collection<String>getUserByQuestion(org.silverpeas.core.ResourceReference questionPK)org.silverpeas.core.admin.user.model.UserDetailgetUserDetail(String userId)Collection<String>getUsersByAnswer(String answerId)Collection<String>getUsersBySurvey(String surveyId)intgetViewType()booleanhasAlreadyParticipated()voidhasAlreadyParticipated(boolean state)Set status of anonymous user (if he has already participated with this ip)voidinitAlertResultParticipants(org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail surveyDetail)voidinitAlertResultUsers(org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail surveyDetail)booleanisAnonymousModeAuthorized()booleanisAnonymousModeEnabled()booleanisDisplayCommentsEnabled(String userProfile, String userId)Get display comments mode statusbooleanisParticipationMultipleAllowedForUser()Return if user can participate more than one timebooleanisParticipationMultipleUsed()Return if participationMultiple is usedbooleanisPasteEnabled()booleanisPdcUsed()booleanisPollingStationMode()StringmanageQuestionBusiness(String function, javax.servlet.http.HttpServletRequest request)voidopenSurvey(String surveyId)voidpaste()Paste surveys which are in the clipboard selectionvoidquestionsUpdateBusinessModel(javax.servlet.http.HttpServletRequest request)prepare data inside session controller before sending them to the view layervoidrecordReply(String surveyId, Map<String,List<String>> reply)voidrecordReply(String surveyId, Map<String,List<String>> reply, String comment, boolean isAnonymousComment)voidremoveSessionQuestions()voidremoveSessionResponses()voidremoveSessionSurvey()voidremoveSessionSurveyId()voidremoveSessionSurveyName()voidremoveSessionSurveyUnderConstruction()voidremoveSynthesisFile(String idDocument)voidsaveSynthesisFile(org.apache.commons.fileupload.FileItem fileSynthesis)voidsendNewSurveyAction(javax.servlet.http.HttpServletRequest request)Refactoring : get code from view JSP and add it inside controllervoidsetNewSurveyPositionsFromJSON(String positions)Set new survey positions (axis classification) from JSON stringvoidsetParticipationMultipleAllowedForUser(boolean state)Set user status to know if he can participate more than one timevoidsetPollingStationMode(boolean pollingStationMode)voidsetSessionQuestions(List<org.silverpeas.core.questioncontainer.question.model.Question> questions)voidsetSessionResponses(Map<String,List<String>> responses)voidsetSessionSurvey(org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail survey)voidsetSessionSurveyId(String surveyId)voidsetSessionSurveyName(String surveyName)voidsetSessionSurveyUnderConstruction(org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail surveyUnderConstruction)DisplayResultViewsetSurveyResultViewFromIdentifierOrMainView(org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail survey, String identifierOrMainView)Sets the display result view according to given identifier or main view.voidsetViewType(int viewType)voidupdateQuestions(Collection<org.silverpeas.core.questioncontainer.question.model.Question> questions, String surveyId)voidupdateSurveyHeader(org.silverpeas.core.questioncontainer.container.model.QuestionContainerHeader surveyHeader, String surveyId)voidupdateSynthesisFile(org.apache.commons.fileupload.FileItem newFileSynthesis, String idDocument)-
Methods inherited from class org.silverpeas.core.web.mvc.controller.AbstractComponentSessionController
addClipboardSelection, clipboardPasteDone, close, getClipboardErrorMessage, getClipboardExceptionError, getClipboardObjects, getClipboardSelectedObjects, getClipboardSize, getComponentAccessController, getComponentId, getComponentLabel, getComponentName, getComponentParameterValue, getComponentParameterValue, getComponentRootName, getComponentUrl, getHighestSilverpeasUserRole, getIcon, getLanguage, getLook, getMultilang, getOrganisationController, getPersonalization, getRSSUrl, getSelection, getSettings, getSilverpeasUserRoles, getSpaceId, getSpaceLabel, getString, getSubscriptionContext, getUrlEncodedParameter, getUserAccessLevel, getUserAvailComponentIds, getUserDetail, getUserId, getUserManageableGroupIds, getUserManageableSpaceIds, getUserRoles, getZoneId, isAppInMaintenance, isGroupManager, isPasswordChangeAllowed, isSpaceInMaintenance, removeClipboardElement, setAppModeMaintenance, setClipboardSelectedElement, setComponentRootName, setSpaceModeMaintenance
-
-
-
-
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
-
DISPLAY_COMMENTS_FOR_NOBODY
public static final String DISPLAY_COMMENTS_FOR_NOBODY
- See Also:
- Constant Field Values
-
DISPLAY_COMMENTS_FOR_MANAGERS
public static final String DISPLAY_COMMENTS_FOR_MANAGERS
- See Also:
- Constant Field Values
-
DISPLAY_COMMENTS_FOR_ALL
public static final String DISPLAY_COMMENTS_FOR_ALL
- See Also:
- Constant Field Values
-
PARAM_DISPLAY_COMMENTS
public static final String PARAM_DISPLAY_COMMENTS
- See Also:
- Constant Field Values
-
COOKIE_NAME
public static final String COOKIE_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SurveySessionController
public SurveySessionController(org.silverpeas.core.web.mvc.controller.MainSessionController mainSessionCtrl, org.silverpeas.core.web.mvc.controller.ComponentContext componentContext)Creates new sessionClientController- Parameters:
mainSessionCtrl-componentContext-
-
-
Method Detail
-
getQuestionContainerService
public org.silverpeas.core.questioncontainer.container.service.QuestionContainerService getQuestionContainerService()
-
getQuestionResultService
public org.silverpeas.core.questioncontainer.result.service.QuestionResultService getQuestionResultService()
-
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-
-
getDisplayCommentsMode
public String getDisplayCommentsMode()
Get display comments Mode- Returns:
-
isParticipationMultipleUsed
public boolean isParticipationMultipleUsed()
Return if participationMultiple is used- Returns:
- true or false
-
isAnonymousModeAuthorized
public boolean isAnonymousModeAuthorized()
- Returns:
- if anonymous mode is authorized
-
isAnonymousModeEnabled
public boolean isAnonymousModeEnabled()
- Returns:
- if anonymous mode is enabled
-
hasAlreadyParticipated
public boolean hasAlreadyParticipated()
- Returns:
- if anonymous user has already participated with this ip
-
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<org.silverpeas.core.questioncontainer.container.model.QuestionContainerHeader> getSurveys() throws SurveyException
- Returns:
- a list of survey of the current instance of component.
- Throws:
SurveyException
-
getOpenedSurveys
public Collection<org.silverpeas.core.questioncontainer.container.model.QuestionContainerHeader> getOpenedSurveys() throws SurveyException
- Throws:
SurveyException
-
getClosedSurveys
public Collection<org.silverpeas.core.questioncontainer.container.model.QuestionContainerHeader> getClosedSurveys() throws SurveyException
- Throws:
SurveyException
-
getInWaitSurveys
public Collection<org.silverpeas.core.questioncontainer.container.model.QuestionContainerHeader> getInWaitSurveys() throws SurveyException
- Throws:
SurveyException
-
getSurvey
public org.silverpeas.core.questioncontainer.container.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 org.silverpeas.core.questioncontainer.container.model.QuestionContainerPK createSurvey(org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail surveyDetail) throws SurveyException- Throws:
SurveyException
-
createSurvey
public org.silverpeas.core.questioncontainer.container.model.QuestionContainerPK createSurvey(org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail surveyDetail, String componentId) throws SurveyException- Throws:
SurveyException
-
updateSurveyHeader
public void updateSurveyHeader(org.silverpeas.core.questioncontainer.container.model.QuestionContainerHeader surveyHeader, String surveyId) throws SurveyException- Throws:
SurveyException
-
updateQuestions
public void updateQuestions(Collection<org.silverpeas.core.questioncontainer.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(org.silverpeas.core.ResourceReference questionPK)
-
getResultByUser
public Collection<String> getResultByUser(String userId)
-
getResults
public org.silverpeas.core.questioncontainer.result.model.Results getResults()
-
getUserByAnswer
public Collection<String> getUserByAnswer(String answerId)
-
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<org.silverpeas.core.questioncontainer.result.model.QuestionResult> getSuggestions(String surveyId) throws SurveyException
- Throws:
SurveyException
-
getUsersByAnswer
public Collection<String> getUsersByAnswer(String answerId)
-
getUsersBySurvey
public Collection<String> getUsersBySurvey(String surveyId) throws SurveyException
- Throws:
SurveyException
-
getUserDetail
public org.silverpeas.core.admin.user.model.UserDetail getUserDetail(String userId)
- Overrides:
getUserDetailin classorg.silverpeas.core.web.mvc.controller.AbstractComponentSessionController
-
getSilverObjectId
public int getSilverObjectId(String objectId)
-
getSessionSurveyUnderConstruction
public org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail getSessionSurveyUnderConstruction()
-
setSessionSurveyUnderConstruction
public void setSessionSurveyUnderConstruction(org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail surveyUnderConstruction)
-
removeSessionSurveyUnderConstruction
public void removeSessionSurveyUnderConstruction()
-
getSessionSurvey
public org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail getSessionSurvey()
-
setSessionSurvey
public void setSessionSurvey(org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail survey)
-
removeSessionSurvey
public void removeSessionSurvey()
-
getSessionQuestions
public List<org.silverpeas.core.questioncontainer.question.model.Question> getSessionQuestions()
-
setSessionQuestions
public void setSessionQuestions(List<org.silverpeas.core.questioncontainer.question.model.Question> questions)
-
removeSessionQuestions
public void removeSessionQuestions()
-
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()
-
isPollingStationMode
public boolean isPollingStationMode()
-
setPollingStationMode
public void setPollingStationMode(boolean pollingStationMode)
-
getGalleries
public List<org.silverpeas.core.admin.component.model.ComponentInstLight> getGalleries()
- Returns:
- a list of component instance light of the silverpeas gallery
-
exportSurveyCSV
public org.silverpeas.core.web.export.ExportCSVBuilder exportSurveyCSV(String surveyId)
-
copySurvey
public void copySurvey(String surveyId) throws org.silverpeas.kernel.SilverpeasException
- Throws:
org.silverpeas.kernel.SilverpeasException
-
isPasteEnabled
public boolean isPasteEnabled() throws org.silverpeas.kernel.SilverpeasException- Throws:
org.silverpeas.kernel.SilverpeasException
-
paste
public void paste() throws org.silverpeas.kernel.SilverpeasExceptionPaste surveys which are in the clipboard selection- Throws:
Exceptionorg.silverpeas.kernel.SilverpeasException
-
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(org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail surveyDetail) throws SurveyException- Throws:
SurveyException
-
initAlertResultUsers
public void initAlertResultUsers(org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail surveyDetail)
-
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.core.contribution.attachment.model.SimpleDocument> getAllSynthesisFile(String surveyId)
-
getSuggestion
public org.silverpeas.core.questioncontainer.result.model.QuestionResult getSuggestion(String userId, String questionId, String answerId) throws SurveyException
- Throws:
SurveyException
-
isDisplayCommentsEnabled
public boolean isDisplayCommentsEnabled(String userProfile, String userId)
Get display comments mode status- Parameters:
userProfile- the user role profile of a useruserId- the unique identifier of the user- Returns:
- true or false
-
getDisplayResultView
public DisplayResultView getDisplayResultView()
Gets the display result view.- Returns:
- the
DisplayResultViewinstance representing the result vew.
-
setSurveyResultViewFromIdentifierOrMainView
public DisplayResultView setSurveyResultViewFromIdentifierOrMainView(org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail survey, String identifierOrMainView)
Sets the display result view according to given identifier or main view.The result view is set into session.
- Parameters:
survey- the representation of the survey.identifierOrMainView- the name (or full name) or the main part of name of a view.- Returns:
- the
DisplayResultViewinstance.
-
-