Package org.ametys.plugins.forms.helper
Class LimitedEntriesHelper
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.forms.helper.LimitedEntriesHelper
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
The helper to handler limited entries
-
Field Summary
Modifier and TypeFieldDescriptionprotected CurrentUserProvider
The current user providerprotected FormDAO
The form DAOprotected FormMailHelper
The form mail helperprotected ObservationManager
Observer manager.protected AmetysObjectResolver
Ametys object resolver.static final String
Avalon ROLE. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet the waiting list sort by the submiting dateboolean
canUserSubmit
(Form form, UserIdentity user, String clientIp) true
if the user can submit the form depending of the form limitationvoid
deactivateEntry
(String entryId) Deactivate an entry handling the form limitationgetClientIp
(Request request) Get a forwarded client IP address if available.getLimitedEntriesProperties
(String formId) Get the form properties relevant for limiting entries numberboolean
hasUserAlreadyAnswer
(Form form, UserIdentity user, String clientIp) true
if the user has already answer to the formboolean
isFormLimitIsReached
(Form form) true
if the form limit is reachboolean
true
if the entry is in queuevoid
service
(ServiceManager manager) setEntriesLimitProperties
(Map<String, Object> limitParameters) Set the form properties relevant for limiting entries numberMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
Avalon ROLE. -
_resolver
Ametys object resolver. -
_formMailHelper
The form mail helper -
_formDAO
The form DAO -
_currentUserProvider
The current user provider -
_observationManager
Observer manager.
-
-
Constructor Details
-
LimitedEntriesHelper
public LimitedEntriesHelper()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getLimitedEntriesProperties
Get the form properties relevant for limiting entries number- Parameters:
formId
- Id of the current form- Returns:
- a map of the form properties
-
setEntriesLimitProperties
Set the form properties relevant for limiting entries number- Parameters:
limitParameters
- the limit parameters- Returns:
- the map of results
-
canUserSubmit
true
if the user can submit the form depending of the form limitation- Parameters:
form
- the formuser
- the user. Can be null if the form is anonymousclientIp
- the client ip of the user- Returns:
true
if the user can submit the form depending of the form limitation
-
hasUserAlreadyAnswer
true
if the user has already answer to the form- Parameters:
form
- the formuser
- the user. Can be null if the form is anonymousclientIp
- the client ip of the user- Returns:
true
if the user has already answer to the form
-
getClientIp
Get a forwarded client IP address if available.- Parameters:
request
- The servlet request object.- Returns:
- The HTTP
X-Forwarded-For
header value if present, or the default remote address if not.
-
isInQueue
true
if the entry is in queue- Parameters:
entry
- the entry- Returns:
true
if the entry is in queue
-
deactivateEntry
Deactivate an entry handling the form limitation- Parameters:
entryId
- the entry id
-
_getQueue
Get the waiting list sort by the submiting date- Parameters:
form
- the form- Returns:
- the waiting list
-
isFormLimitIsReached
true
if the form limit is reach- Parameters:
form
- the form- Returns:
true
if the form limit is reach
-