Package org.apache.ofbiz.content.survey
Class SurveyWrapper
- java.lang.Object
-
- org.apache.ofbiz.content.survey.SurveyWrapper
-
- Direct Known Subclasses:
ProductStoreSurveyWrapper
public class SurveyWrapper extends java.lang.Object
Survey Wrapper - Class to render survey forms
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
SurveyWrapper.SurveyWrapperException
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,java.lang.Object>
defaultValues
protected Delegator
delegator
protected boolean
edit
static java.lang.String
module
protected java.lang.String
partyId
protected java.util.Map<java.lang.String,java.lang.Object>
passThru
protected java.lang.String
responseId
protected java.lang.String
surveyId
protected java.util.Map<java.lang.String,java.lang.Object>
templateContext
-
Constructor Summary
Constructors Modifier Constructor Description protected
SurveyWrapper()
SurveyWrapper(Delegator delegator, java.lang.String surveyId)
SurveyWrapper(Delegator delegator, java.lang.String responseId, java.lang.String partyId, java.lang.String surveyId, java.util.Map<java.lang.String,java.lang.Object> passThru)
SurveyWrapper(Delegator delegator, java.lang.String responseId, java.lang.String partyId, java.lang.String surveyId, java.util.Map<java.lang.String,java.lang.Object> passThru, java.util.Map<java.lang.String,java.lang.Object> defaultValues)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addToTemplateContext(java.lang.String name, java.lang.Object value)
Adds an object to the FTL survey template contextboolean
canRespond()
boolean
canUpdate()
protected void
checkParameters()
long
getNumberResponses()
java.util.List<GenericValue>
getQuestionResponses(GenericValue question, int startIndex, int number)
java.util.Map<java.lang.String,java.lang.Object>
getResponseAnswers(java.lang.String responseId)
java.util.Map<java.lang.String,java.lang.Object>
getResultInfo(GenericValue question)
java.util.Map<java.lang.String,java.lang.Object>
getResults(java.util.List<GenericValue> questions)
GenericValue
getSurvey()
java.lang.String
getSurveyName()
java.util.List<GenericValue>
getSurveyQuestionAndAppls()
java.util.List<GenericValue>
getSurveyResponses(GenericValue question)
protected freemarker.template.Template
getTemplate(java.net.URL templateUrl)
protected java.lang.String
getThisResponseId()
void
removeFromTemplateContext(java.lang.String name)
Removes an object from the FTL survey template contextjava.io.Writer
render(java.lang.String templatePath)
Renders the Surveyvoid
render(java.net.URL templateUrl, java.io.Writer writer)
Renders the Surveyvoid
setDefaultValues(java.util.Map<java.lang.String,java.lang.Object> defaultValues)
Sets the default valuesvoid
setEdit(boolean edit)
void
setPassThru(java.util.Map<java.lang.String,java.lang.Object> passThru)
Sets the pass-thru values (hidden form fields)protected void
setThisResponseId(java.lang.String responseId)
-
-
-
Field Detail
-
module
public static final java.lang.String module
-
delegator
protected Delegator delegator
-
responseId
protected java.lang.String responseId
-
partyId
protected java.lang.String partyId
-
surveyId
protected java.lang.String surveyId
-
templateContext
protected java.util.Map<java.lang.String,java.lang.Object> templateContext
-
passThru
protected java.util.Map<java.lang.String,java.lang.Object> passThru
-
defaultValues
protected java.util.Map<java.lang.String,java.lang.Object> defaultValues
-
edit
protected boolean edit
-
-
Constructor Detail
-
SurveyWrapper
protected SurveyWrapper()
-
SurveyWrapper
public SurveyWrapper(Delegator delegator, java.lang.String responseId, java.lang.String partyId, java.lang.String surveyId, java.util.Map<java.lang.String,java.lang.Object> passThru, java.util.Map<java.lang.String,java.lang.Object> defaultValues)
-
SurveyWrapper
public SurveyWrapper(Delegator delegator, java.lang.String responseId, java.lang.String partyId, java.lang.String surveyId, java.util.Map<java.lang.String,java.lang.Object> passThru)
-
SurveyWrapper
public SurveyWrapper(Delegator delegator, java.lang.String surveyId)
-
-
Method Detail
-
checkParameters
protected void checkParameters()
-
setPassThru
public void setPassThru(java.util.Map<java.lang.String,java.lang.Object> passThru)
Sets the pass-thru values (hidden form fields)- Parameters:
passThru
-
-
setDefaultValues
public void setDefaultValues(java.util.Map<java.lang.String,java.lang.Object> defaultValues)
Sets the default values- Parameters:
defaultValues
-
-
addToTemplateContext
public void addToTemplateContext(java.lang.String name, java.lang.Object value)
Adds an object to the FTL survey template context- Parameters:
name
-value
-
-
removeFromTemplateContext
public void removeFromTemplateContext(java.lang.String name)
Removes an object from the FTL survey template context- Parameters:
name
-
-
render
public java.io.Writer render(java.lang.String templatePath) throws SurveyWrapper.SurveyWrapperException
Renders the Survey- Returns:
- Writer object from the parsed Freemarker Template
- Throws:
SurveyWrapper.SurveyWrapperException
-
render
public void render(java.net.URL templateUrl, java.io.Writer writer) throws SurveyWrapper.SurveyWrapperException
Renders the Survey- Parameters:
templateUrl
- the template URLwriter
- the write- Throws:
SurveyWrapper.SurveyWrapperException
-
getTemplate
protected freemarker.template.Template getTemplate(java.net.URL templateUrl)
-
setEdit
public void setEdit(boolean edit)
-
getSurvey
public GenericValue getSurvey()
-
getSurveyName
public java.lang.String getSurveyName()
-
canUpdate
public boolean canUpdate()
-
canRespond
public boolean canRespond()
-
getSurveyQuestionAndAppls
public java.util.List<GenericValue> getSurveyQuestionAndAppls()
-
getThisResponseId
protected java.lang.String getThisResponseId()
-
setThisResponseId
protected void setThisResponseId(java.lang.String responseId)
-
getNumberResponses
public long getNumberResponses() throws SurveyWrapper.SurveyWrapperException
-
getSurveyResponses
public java.util.List<GenericValue> getSurveyResponses(GenericValue question) throws SurveyWrapper.SurveyWrapperException
-
getResponseAnswers
public java.util.Map<java.lang.String,java.lang.Object> getResponseAnswers(java.lang.String responseId) throws SurveyWrapper.SurveyWrapperException
-
getQuestionResponses
public java.util.List<GenericValue> getQuestionResponses(GenericValue question, int startIndex, int number) throws SurveyWrapper.SurveyWrapperException
-
getResults
public java.util.Map<java.lang.String,java.lang.Object> getResults(java.util.List<GenericValue> questions) throws SurveyWrapper.SurveyWrapperException
-
getResultInfo
public java.util.Map<java.lang.String,java.lang.Object> getResultInfo(GenericValue question) throws SurveyWrapper.SurveyWrapperException
-
-