Class SurveyAccessHelper
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.plugins.survey.repository.SurveyAccessHelper
-
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
,ThreadSafe
public class SurveyAccessHelper extends AbstractLogEnabled implements Component, ThreadSafe, Serviceable
helper to check survey access
-
-
Field Summary
Fields Modifier and Type Field Description protected SurveyAnswerDao
_answerDao
The ametys object resolver.static String
ROLE
Avalon role
-
Constructor Summary
Constructors Constructor Description SurveyAccessHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getCookieName(Request request, Survey survey)
Return the name of cookie if the survey was already taken ornull
otherwise.Date
getSubmissionDate(String surveyId, UserIdentity user)
Returns the date on which the user answered to the survey ornull
if he was never answeredvoid
service(ServiceManager manager)
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_answerDao
protected SurveyAnswerDao _answerDao
The ametys object resolver.
-
-
Constructor Detail
-
SurveyAccessHelper
public SurveyAccessHelper()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getSubmissionDate
public Date getSubmissionDate(String surveyId, UserIdentity user)
Returns the date on which the user answered to the survey ornull
if he was never answered- Parameters:
surveyId
- the survey ID.user
- the user.- Returns:
- the date on which the survey was taken, or
null
if the user never took the survey.
-
getCookieName
public String getCookieName(Request request, Survey survey)
Return the name of cookie if the survey was already taken ornull
otherwise.- Parameters:
request
- the request.survey
- the survey.- Returns:
- the name of cookie if the survey was already taken, or
null
otherwise.
-
-