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.AbstractComponentSessionController
This class contains business layer of survey component
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final intstatic final StringFields inherited from class org.silverpeas.core.web.mvc.controller.AbstractComponentSessionController
context -
Constructor Summary
ConstructorsConstructorDescriptionSurveySessionController(org.silverpeas.core.web.mvc.controller.MainSessionController mainSessionCtrl, org.silverpeas.core.web.mvc.controller.ComponentContext componentContext) -
Method Summary
Modifier and TypeMethodDescriptionvoidcloseSurvey(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>Gets the display result view.List<org.silverpeas.core.admin.component.model.ComponentInstLight>Collection<org.silverpeas.core.questioncontainer.container.model.QuestionContainerHeader>Change this code with an enum list of question style using forCollection<org.silverpeas.core.questioncontainer.container.model.QuestionContainerHeader>org.silverpeas.core.questioncontainer.container.service.QuestionContainerServiceorg.silverpeas.core.questioncontainer.result.service.QuestionResultServicegetResultByUser(String userId) org.silverpeas.core.questioncontainer.result.model.ResultsList<org.silverpeas.core.questioncontainer.question.model.Question>org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetailorg.silverpeas.core.questioncontainer.container.model.QuestionContainerDetailintgetSilverObjectId(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.QuestionContainerDetailCollection<org.silverpeas.core.questioncontainer.container.model.QuestionContainerHeader>getUserByAnswer(String answerId) getUserByQuestion(org.silverpeas.core.ResourceReference questionPK) org.silverpeas.core.admin.user.model.UserDetailgetUserDetail(String userId) getUsersByAnswer(String answerId) getUsersBySurvey(String surveyId) intbooleanvoidhasAlreadyParticipated(boolean state) voidinitAlertResultParticipants(org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail surveyDetail) voidinitAlertResultUsers(org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail surveyDetail) booleanbooleanbooleanisDisplayCommentsEnabled(String userProfile, String userId) Get display comments mode statusbooleanReturn if user can participate more than one timebooleanReturn if participationMultiple is usedbooleanbooleanbooleanmanageQuestionBusiness(String function, jakarta.servlet.http.HttpServletRequest request) voidopenSurvey(String surveyId) voidpaste()Paste surveys which are in the clipboard selectionvoidquestionsUpdateBusinessModel(jakarta.servlet.http.HttpServletRequest request) prepare data inside session controller before sending them to the view layervoidvoidrecordReply(String surveyId, Map<String, List<String>> reply, String comment, boolean isAnonymousComment) voidvoidvoidvoidvoidvoidvoidremoveSynthesisFile(String idDocument) voidsaveSynthesisFile(org.silverpeas.core.util.file.FileItem fileSynthesis) voidsendNewSurveyAction(jakarta.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) voidsetPollingStationMode(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) setSurveyResultViewFromIdentifierOrMainView(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.silverpeas.core.util.file.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 Details
-
OPENED_SURVEYS_VIEW
public static final int OPENED_SURVEYS_VIEW- See Also:
-
CLOSED_SURVEYS_VIEW
public static final int CLOSED_SURVEYS_VIEW- See Also:
-
INWAIT_SURVEYS_VIEW
public static final int INWAIT_SURVEYS_VIEW- See Also:
-
DISPLAY_COMMENTS_FOR_NOBODY
- See Also:
-
DISPLAY_COMMENTS_FOR_MANAGERS
- See Also:
-
DISPLAY_COMMENTS_FOR_ALL
- See Also:
-
PARAM_DISPLAY_COMMENTS
- See Also:
-
COOKIE_NAME
- See Also:
-
-
Constructor Details
-
SurveySessionController
public SurveySessionController(org.silverpeas.core.web.mvc.controller.MainSessionController mainSessionCtrl, org.silverpeas.core.web.mvc.controller.ComponentContext componentContext)
-
-
Method Details
-
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) -
getDisplayCommentsMode
-
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) -
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- if the list cannot be got
-
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- if the survey cannot be got
-
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
- Throws:
SurveyException
-
deleteVotes
- Throws:
SurveyException
-
deleteResponse
- Throws:
SurveyException
-
getUserByQuestion
-
getResultByUser
-
getResults
public org.silverpeas.core.questioncontainer.result.model.Results getResults() -
getUserByAnswer
-
closeSurvey
- Throws:
SurveyException
-
openSurvey
- Throws:
SurveyException
-
recordReply
- 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
-
getUsersBySurvey
- Throws:
SurveyException
-
getUserDetail
- Overrides:
getUserDetailin classorg.silverpeas.core.web.mvc.controller.AbstractComponentSessionController
-
getSilverObjectId
-
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
-
setSessionQuestions
public void setSessionQuestions(List<org.silverpeas.core.questioncontainer.question.model.Question> questions) -
removeSessionQuestions
public void removeSessionQuestions() -
getSessionResponses
-
setSessionResponses
-
removeSessionResponses
public void removeSessionResponses() -
getSessionSurveyId
-
setSessionSurveyId
-
removeSessionSurveyId
public void removeSessionSurveyId() -
getSessionSurveyName
-
setSessionSurveyName
-
removeSessionSurveyName
public void removeSessionSurveyName() -
isPollingStationMode
public boolean isPollingStationMode() -
setPollingStationMode
public void setPollingStationMode(boolean pollingStationMode) -
getGalleries
- Returns:
- a list of component instance light of the silverpeas gallery
-
exportSurveyCSV
-
copySurvey
- 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:
org.silverpeas.kernel.SilverpeasException- if the pasting fails
-
questionsUpdateBusinessModel
public void questionsUpdateBusinessModel(jakarta.servlet.http.HttpServletRequest request) prepare data inside session controller before sending them to the view layer- Parameters:
request- the current HttpServletRequest
-
getListQuestionStyle
Change this code with an enum list of question style using for- Returns:
- a list of question styles
-
manageQuestionBusiness
-
sendNewSurveyAction
public void sendNewSurveyAction(jakarta.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
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.silverpeas.core.util.file.FileItem fileSynthesis) throws SurveyException - Throws:
SurveyException
-
updateSynthesisFile
public void updateSynthesisFile(org.silverpeas.core.util.file.FileItem newFileSynthesis, String idDocument) throws SurveyException - Throws:
SurveyException
-
removeSynthesisFile
-
getAllSynthesisFile
-
getSuggestion
public org.silverpeas.core.questioncontainer.result.model.QuestionResult getSuggestion(String userId, String questionId, String answerId) throws SurveyException - Throws:
SurveyException
-
isDisplayCommentsEnabled
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
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.
-