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 Details

  • 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

      public String 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
    • createSurveyUnderConstruction

      public String createSurveyUnderConstruction() throws SurveyException
      Creates the survey currently under construction in the user session, with the questions that were defined in the session for it. Once created, the construction context is cleared.
      Returns:
      the unique identifier of the created survey.
      Throws:
      SurveyException - if the survey cannot be created.
    • 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:
      getUserDetail in class org.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()
    • 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()
    • 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.SilverpeasException
      Paste 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

      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, jakarta.servlet.http.HttpServletRequest request)
    • 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

      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.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

      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 user
      userId - the unique identifier of the user
      Returns:
      true or false
    • getDisplayResultView

      public DisplayResultView getDisplayResultView()
      Gets the display result view.
      Returns:
      the DisplayResultView instance 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 DisplayResultView instance.