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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
CLOSED_SURVEYS_VIEW
static String
COOKIE_NAME
static String
DISPLAY_COMMENTS_FOR_ALL
static String
DISPLAY_COMMENTS_FOR_MANAGERS
static String
DISPLAY_COMMENTS_FOR_NOBODY
static int
INWAIT_SURVEYS_VIEW
static int
OPENED_SURVEYS_VIEW
static String
PARAM_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 void
closeSurvey(String surveyId)
void
copySurvey(String surveyId)
org.silverpeas.core.questioncontainer.container.model.QuestionContainerPK
createSurvey(org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail surveyDetail)
org.silverpeas.core.questioncontainer.container.model.QuestionContainerPK
createSurvey(org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail surveyDetail, String componentId)
void
deleteResponse(String surveyId)
void
deleteSurvey(String surveyId)
void
deleteVotes(String surveyId)
org.silverpeas.core.web.export.ExportCSVBuilder
exportSurveyCSV(String surveyId)
List<org.silverpeas.core.contribution.attachment.model.SimpleDocument>
getAllSynthesisFile(String surveyId)
Collection<org.silverpeas.core.questioncontainer.container.model.QuestionContainerHeader>
getClosedSurveys()
String
getDisplayCommentsMode()
Get display comments ModeDisplayResultView
getDisplayResultView()
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.QuestionContainerService
getQuestionContainerService()
org.silverpeas.core.questioncontainer.result.service.QuestionResultService
getQuestionResultService()
Collection<String>
getResultByUser(String userId)
org.silverpeas.core.questioncontainer.result.model.Results
getResults()
List<org.silverpeas.core.questioncontainer.question.model.Question>
getSessionQuestions()
Map<String,List<String>>
getSessionResponses()
org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail
getSessionSurvey()
String
getSessionSurveyId()
String
getSessionSurveyName()
org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail
getSessionSurveyUnderConstruction()
int
getSilverObjectId(String objectId)
org.silverpeas.core.questioncontainer.result.model.QuestionResult
getSuggestion(String userId, String questionId, String answerId)
Collection<org.silverpeas.core.questioncontainer.result.model.QuestionResult>
getSuggestions(String surveyId)
org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail
getSurvey(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.UserDetail
getUserDetail(String userId)
Collection<String>
getUsersByAnswer(String answerId)
Collection<String>
getUsersBySurvey(String surveyId)
int
getViewType()
boolean
hasAlreadyParticipated()
void
hasAlreadyParticipated(boolean state)
Set status of anonymous user (if he has already participated with this ip)void
initAlertResultParticipants(org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail surveyDetail)
void
initAlertResultUsers(org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail surveyDetail)
boolean
isAnonymousModeAuthorized()
boolean
isAnonymousModeEnabled()
boolean
isDisplayCommentsEnabled(String userProfile, String userId)
Get display comments mode statusboolean
isParticipationMultipleAllowedForUser()
Return if user can participate more than one timeboolean
isParticipationMultipleUsed()
Return if participationMultiple is usedboolean
isPasteEnabled()
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 selectionvoid
questionsUpdateBusinessModel(javax.servlet.http.HttpServletRequest request)
prepare data inside session controller before sending them to the view layervoid
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 controllervoid
setNewSurveyPositionsFromJSON(String positions)
Set new survey positions (axis classification) from JSON stringvoid
setParticipationMultipleAllowedForUser(boolean state)
Set user status to know if he can participate more than one timevoid
setPollingStationMode(boolean pollingStationMode)
void
setSessionQuestions(List<org.silverpeas.core.questioncontainer.question.model.Question> questions)
void
setSessionResponses(Map<String,List<String>> responses)
void
setSessionSurvey(org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail survey)
void
setSessionSurveyId(String surveyId)
void
setSessionSurveyName(String surveyName)
void
setSessionSurveyUnderConstruction(org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail surveyUnderConstruction)
DisplayResultView
setSurveyResultViewFromIdentifierOrMainView(org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail survey, String identifierOrMainView)
Sets the display result view according to given identifier or main view.void
setViewType(int viewType)
void
updateQuestions(Collection<org.silverpeas.core.questioncontainer.question.model.Question> questions, String surveyId)
void
updateSurveyHeader(org.silverpeas.core.questioncontainer.container.model.QuestionContainerHeader surveyHeader, String surveyId)
void
updateSynthesisFile(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:
getUserDetail
in 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.SilverpeasException
Paste surveys which are in the clipboard selection- Throws:
Exception
org.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
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.
-
-