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
FieldsModifier and TypeFieldDescriptionprotected CurrentUserProviderThe current user providerprotected FormDAOThe form DAOprotected FormEntryDAOThe form entry DAOprotected FormMailHelperThe form mail helperprotected ObservationManagerObserver manager.protected AmetysObjectResolverAmetys object resolver.static final StringAvalon ROLE. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the waiting list sort by the submiting datebooleancanUserSubmit(Form form, UserIdentity user, String clientIp) trueif the user can submit the form depending of the form limitationvoiddeactivateEntry(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 numberbooleanhasUserAlreadyAnswer(Form form, UserIdentity user, String clientIp) trueif the user has already answer to the formbooleanisFormLimitIsReached(Form form) trueif the form limit is reachbooleantrueif the entry is in queuevoidservice(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. -
_formEntryDAO
The form entry DAO
-
-
Constructor Details
-
LimitedEntriesHelper
public LimitedEntriesHelper()
-
-
Method Details
-
service
- Specified by:
servicein 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
trueif 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:
trueif the user can submit the form depending of the form limitation
-
hasUserAlreadyAnswer
trueif 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:
trueif 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-Forheader value if present, or the default remote address if not.
-
isInQueue
trueif the entry is in queue- Parameters:
entry- the entry- Returns:
trueif 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
trueif the form limit is reach- Parameters:
form- the form- Returns:
trueif the form limit is reach
-