public class ProcessInputAction extends ServiceableAction
| Modifier and Type | Class and Description |
|---|---|
protected class |
ProcessInputAction.SurveyInput
Survey session with answers.
|
protected class |
ProcessInputAction.SurveyInputAnswer
Class representing a survey answer, i.e.
|
| Modifier and Type | Field and Description |
|---|---|
protected SurveyAccessHelper |
_accessHelper
The survey access helper
|
protected SurveyAnswerDao |
_answerDao
The ametys object resolver.
|
protected org.ametys.runtime.group.GroupsManager |
_foGroupsManager
The FO groups manager
|
protected java.lang.String |
_pluginName
The plugin name
|
protected org.ametys.web.URIPrefixHandler |
_prefixHandler
The uri prefix handler.
|
protected org.ametys.plugins.repository.AmetysObjectResolver |
_resolver
The ametys object resolver.
|
protected org.ametys.runtime.user.CurrentUserProvider |
_userProvider
The user provider.
|
static java.lang.String |
COOKIE_NAME
The name of the cookie storing the taken surveys.
|
managerEMPTY_MAP| Constructor and Description |
|---|
ProcessInputAction() |
| Modifier and Type | Method and Description |
|---|---|
java.util.Map |
act(Redirector redirector,
SourceResolver resolver,
java.util.Map objectModel,
java.lang.String source,
Parameters parameters) |
protected boolean |
checkAccess(Survey survey,
Request request,
SurveyErrors errors)
Check if user can answer to the survey
|
protected SurveyRule |
evaluateChoiceRules(SurveyQuestion question,
ProcessInputAction.SurveyInputAnswer answer)
Evaluate rules on a choice question.
|
protected SurveyRule |
evaluateMatrixRules(SurveyQuestion question,
ProcessInputAction.SurveyInputAnswer answer)
Evaluate rules on a matrix question.
|
protected SurveyRule |
evaluateTextRules(SurveyQuestion question,
ProcessInputAction.SurveyInputAnswer answer)
Evaluate rules on a text question.
|
protected java.lang.String |
getAuthenticatedUser(Request request)
Get the authenticated user
|
protected java.lang.String |
getClientIp(Request request)
Get a forwarded client IP address if available.
|
protected ProcessInputAction.SurveyInput |
getInput(Survey survey,
Request request)
Get the user input.
|
protected java.lang.String |
getPluginName(Request request)
Get the plugin name
|
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
getValues(SurveyQuestion question,
Request request)
Get an answer value from the request.
|
protected boolean |
isBlank(ProcessInputAction.SurveyInputAnswer answer)
Test if the answer is empty.
|
protected boolean |
processPage(SurveyPage page,
SurveyRule rule)
Test if a page is to be processed, depending on the rule.
|
void |
service(ServiceManager serviceManager) |
protected void |
setCookie(Request request,
Response response,
java.lang.String surveyId)
Indicate in a cookie that the survey was taken.
|
protected java.util.List<org.ametys.runtime.util.I18nizableText> |
validateChoice(ProcessInputAction.SurveyInputAnswer answer,
Request request)
Validate a choice question answer.
|
protected void |
validateInput(Survey survey,
ProcessInputAction.SurveyInput input,
SurveyErrors errors,
Request request)
Validate the user input.
|
protected java.util.List<org.ametys.runtime.util.I18nizableText> |
validateMatrix(ProcessInputAction.SurveyInputAnswer answer,
Request request)
Validate a matrix question answer.
|
protected java.util.List<org.ametys.runtime.util.I18nizableText> |
validatePattern(ProcessInputAction.SurveyInputAnswer answer,
java.lang.String keyPrefix)
Validate an answer against a pattern.
|
protected java.util.List<org.ametys.runtime.util.I18nizableText> |
validateText(ProcessInputAction.SurveyInputAnswer answer,
Request request)
Validate a text field.
|
enableLogging, getLogger, setupLogger, setupLogger, setupLoggerpublic static final java.lang.String COOKIE_NAME
protected org.ametys.plugins.repository.AmetysObjectResolver _resolver
protected SurveyAnswerDao _answerDao
protected org.ametys.runtime.user.CurrentUserProvider _userProvider
protected org.ametys.web.URIPrefixHandler _prefixHandler
protected org.ametys.runtime.group.GroupsManager _foGroupsManager
protected SurveyAccessHelper _accessHelper
protected java.lang.String _pluginName
public void service(ServiceManager serviceManager) throws ServiceException
service in interface Serviceableservice in class ServiceableActionServiceExceptionpublic java.util.Map act(Redirector redirector, SourceResolver resolver, java.util.Map objectModel, java.lang.String source, Parameters parameters) throws java.lang.Exception
java.lang.Exceptionprotected java.lang.String getPluginName(Request request)
request - The requestprotected boolean checkAccess(Survey survey, Request request, SurveyErrors errors)
survey - The surveyrequest - The requesterrors - The survey errorsprotected java.lang.String getAuthenticatedUser(Request request)
request - The requestprotected ProcessInputAction.SurveyInput getInput(Survey survey, Request request)
survey - the survey.request - the request.protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getValues(SurveyQuestion question, Request request)
question - the corresponding question.request - the request.protected void validateInput(Survey survey, ProcessInputAction.SurveyInput input, SurveyErrors errors, Request request)
survey - the survey.input - the user input.errors - the errors.request - the request.protected boolean processPage(SurveyPage page, SurveyRule rule)
page - the page to test.rule - the rule to execute.protected SurveyRule evaluateTextRules(SurveyQuestion question, ProcessInputAction.SurveyInputAnswer answer)
question - the text question.answer - the user answer to the question.protected SurveyRule evaluateChoiceRules(SurveyQuestion question, ProcessInputAction.SurveyInputAnswer answer)
question - the choice question.answer - the user answer to the question.protected SurveyRule evaluateMatrixRules(SurveyQuestion question, ProcessInputAction.SurveyInputAnswer answer)
question - the matrix question.answer - the user answer to the question.protected java.util.List<org.ametys.runtime.util.I18nizableText> validateText(ProcessInputAction.SurveyInputAnswer answer, Request request)
answer - the user answer to the question.request - the request.protected java.util.List<org.ametys.runtime.util.I18nizableText> validateChoice(ProcessInputAction.SurveyInputAnswer answer, Request request)
answer - the user answer to the question.request - the request.protected java.util.List<org.ametys.runtime.util.I18nizableText> validateMatrix(ProcessInputAction.SurveyInputAnswer answer, Request request)
answer - the user answer to the question.request - the request.protected java.util.List<org.ametys.runtime.util.I18nizableText> validatePattern(ProcessInputAction.SurveyInputAnswer answer, java.lang.String keyPrefix)
answer - the user answer to the question.keyPrefix - the error i18n key prefix.protected boolean isBlank(ProcessInputAction.SurveyInputAnswer answer)
answer - the user answer.protected void setCookie(Request request, Response response, java.lang.String surveyId)
request - the request.response - the response.surveyId - the ID of the survey that was just taken.protected final java.lang.String getClientIp(Request request)
request - The servlet request object.X-Forwarded-For header value if present,
or the default remote address if not.Copyright © 2010 Anyware Services. All Rights Reserved.