Class 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:
    Serialized Form
    • 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 -
      • 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
      • 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
      • getUserByQuestion

        public Collection<String> getUserByQuestion​(org.silverpeas.core.ResourceReference questionPK)
      • getResults

        public org.silverpeas.core.questioncontainer.result.model.Results getResults()
      • 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()
      • 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.core.SilverpeasException
        Throws:
        org.silverpeas.core.SilverpeasException
      • isPasteEnabled

        public boolean isPasteEnabled()
                               throws org.silverpeas.core.SilverpeasException
        Throws:
        org.silverpeas.core.SilverpeasException
      • paste

        public void paste()
                   throws org.silverpeas.core.SilverpeasException
        Paste surveys which are in the clipboard selection
        Throws:
        Exception
        org.silverpeas.core.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)