Package org.apache.ofbiz.content.survey
Class SurveyWrapper
java.lang.Object
org.apache.ofbiz.content.survey.SurveyWrapper
- Direct Known Subclasses:
ProductStoreSurveyWrapper
Survey Wrapper - Class to render survey forms
-
Nested Class Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
SurveyWrapper
(Delegator delegator, String surveyId) SurveyWrapper
(Delegator delegator, String responseId, String partyId, String surveyId, Map<String, Object> passThru) SurveyWrapper
(Delegator delegator, String responseId, String partyId, String surveyId, Map<String, Object> passThru, Map<String, Object> defaultValues) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addToTemplateContext
(String name, Object value) Adds an object to the FTL survey template contextboolean
Can respond boolean.boolean
Can update boolean.protected void
Check parameters.long
Gets number responses.getQuestionResponses
(GenericValue question, int startIndex, int number) Gets question responses.getResponseAnswers
(String responseId) returns a Map of answers keyed on SurveyQuestion ID from the most current SurveyResponse IDgetResultInfo
(GenericValue question) Gets result info.getResults
(List<GenericValue> questions) Gets results.returns the GenericValue object for the current SurveyGets survey name.returns a list of SurveyQuestions (in order by sequence number) for the current SurveygetSurveyResponses
(GenericValue question) Gets survey responses.protected freemarker.template.Template
getTemplate
(URL templateUrl) Gets template.protected String
returns the most current SurveyResponse ID for a survey; null if no party is foundvoid
Removes an object from the FTL survey template contextRenders the Surveyvoid
Renders the Surveyvoid
setDefaultValues
(Map<String, Object> defaultValues) Sets the default valuesvoid
setDelegator
(Delegator delegator) Sets delegator.void
setEdit
(boolean edit) Sets edit.void
setPartyId
(String partyId) Sets party id.void
setPassThru
(Map<String, Object> passThru) Sets the pass-thru values (hidden form fields)void
setSurveyId
(String surveyId) Sets survey id.protected void
setThisResponseId
(String responseId) Sets this response id.
-
Constructor Details
-
SurveyWrapper
protected SurveyWrapper() -
SurveyWrapper
-
SurveyWrapper
-
SurveyWrapper
-
-
Method Details
-
setDelegator
Sets delegator.- Parameters:
delegator
- the delegator
-
setPartyId
Sets party id.- Parameters:
partyId
- the party id
-
setSurveyId
Sets survey id.- Parameters:
surveyId
- the survey id
-
checkParameters
protected void checkParameters()Check parameters. -
setPassThru
Sets the pass-thru values (hidden form fields)- Parameters:
passThru
-
-
setDefaultValues
Sets the default values- Parameters:
defaultValues
-
-
addToTemplateContext
Adds an object to the FTL survey template context- Parameters:
name
-value
-
-
removeFromTemplateContext
Removes an object from the FTL survey template context- Parameters:
name
-
-
render
Renders the Survey- Returns:
- Writer object from the parsed Freemarker Template
- Throws:
SurveyWrapper.SurveyWrapperException
-
render
Renders the Survey- Parameters:
templateUrl
- the template URLwriter
- the write- Throws:
SurveyWrapper.SurveyWrapperException
-
getTemplate
Gets template.- Parameters:
templateUrl
- the template url- Returns:
- the template
-
setEdit
public void setEdit(boolean edit) Sets edit.- Parameters:
edit
- the edit
-
getSurvey
returns the GenericValue object for the current Survey -
getSurveyName
Gets survey name.- Returns:
- the survey name
-
canUpdate
public boolean canUpdate()Can update boolean.- Returns:
- the boolean
-
canRespond
public boolean canRespond()Can respond boolean.- Returns:
- the boolean
-
getSurveyQuestionAndAppls
returns a list of SurveyQuestions (in order by sequence number) for the current Survey -
getThisResponseId
returns the most current SurveyResponse ID for a survey; null if no party is found -
setThisResponseId
Sets this response id.- Parameters:
responseId
- the response id
-
getNumberResponses
Gets number responses.- Returns:
- the number responses
- Throws:
SurveyWrapper.SurveyWrapperException
- the survey wrapper exception
-
getSurveyResponses
public List<GenericValue> getSurveyResponses(GenericValue question) throws SurveyWrapper.SurveyWrapperException Gets survey responses.- Parameters:
question
- the question- Returns:
- the survey responses
- Throws:
SurveyWrapper.SurveyWrapperException
- the survey wrapper exception
-
getResponseAnswers
public Map<String,Object> getResponseAnswers(String responseId) throws SurveyWrapper.SurveyWrapperException returns a Map of answers keyed on SurveyQuestion ID from the most current SurveyResponse ID -
getQuestionResponses
public List<GenericValue> getQuestionResponses(GenericValue question, int startIndex, int number) throws SurveyWrapper.SurveyWrapperException Gets question responses.- Parameters:
question
- the questionstartIndex
- the start indexnumber
- the number- Returns:
- the question responses
- Throws:
SurveyWrapper.SurveyWrapperException
- the survey wrapper exception
-
getResults
public Map<String,Object> getResults(List<GenericValue> questions) throws SurveyWrapper.SurveyWrapperException Gets results.- Parameters:
questions
- the questions- Returns:
- the results
- Throws:
SurveyWrapper.SurveyWrapperException
- the survey wrapper exception
-
getResultInfo
public Map<String,Object> getResultInfo(GenericValue question) throws SurveyWrapper.SurveyWrapperException Gets result info.- Parameters:
question
- the question- Returns:
- the result info
- Throws:
SurveyWrapper.SurveyWrapperException
- the survey wrapper exception
-