Package org.ametys.plugins.forms.actions
Class AbstractProcessFormAction
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.acting.AbstractAction
org.apache.cocoon.acting.ServiceableAction
org.ametys.plugins.forms.actions.AbstractProcessFormAction
- All Implemented Interfaces:
Component,LogEnabled,Serviceable,Action
- Direct Known Subclasses:
EditFormEntryAction,ProcessFormAction
Abstract action to process form entry inputs
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CurrentUserProviderThe current user providerprotected FormEntryDAOThe form entry DAOprotected FOAmetysObjectCreationHelperThe FO ametys object creation helperprotected FormDAOThe form DAOprotected FormQuestionDAOThe form question DAOprotected FormWorkflowHelperThe form workflow helperprotected AmetysObjectResolverThe ametys object resolverprotected RightManagerThe right managerFields inherited from class org.apache.cocoon.acting.ServiceableAction
managerFields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void_adaptFormValuesForChoiceList(Form form, Map<String, Object> formInputValues) Remove empty value for choice list because empty value is an other valueprotected voidAdapt file question values to handle untouched file input.protected View_getRuleFilteredEntryView(Request request, Form form, View entryView, FormQuestionDAO.FormEntryValues entryValues, Optional<Long> currentStepId) Get a view without elements hidden by a ruleprotected abstract List<FormQuestion> _getRuleFilteredQuestions(Request request, Form form, FormQuestionDAO.FormEntryValues entryValues, Optional<Long> currentStepId) Get the list of active question depending of the form rulesprotected void_handleComputedValues(List<FormQuestion> questions, FormEntry entry, boolean forEdition) Handle computed valuesprotected Multimap<String, I18nizableText> editFormEntryValues(Request request, FormEntry entry, Optional<Long> currentStepId, Map<String, Object> additionalParameters, boolean isCreated) Edit form entry values with form inputs and validate them.voidservice(ServiceManager smanager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
_resolver
The ametys object resolver -
_foAmetysObjectCreationHelper
The FO ametys object creation helper -
_formDAO
The form DAO -
_entryDAO
The form entry DAO -
_formQuestionDAO
The form question DAO -
_rightManager
The right manager -
_currentUserProvider
The current user provider -
_formWorkflowHelper
The form workflow helper
-
-
Constructor Details
-
AbstractProcessFormAction
public AbstractProcessFormAction()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classServiceableAction- Throws:
ServiceException
-
_adaptFormValuesForChoiceList
Remove empty value for choice list because empty value is an other value- Parameters:
form- the formformInputValues- the form inputs to change
-
_adaptFormValuesForFile
Adapt file question values to handle untouched file input.- Parameters:
request- the request containing form parametersform- the form containing questionsvalues- the form values to adapt
-
_getRuleFilteredEntryView
protected View _getRuleFilteredEntryView(Request request, Form form, View entryView, FormQuestionDAO.FormEntryValues entryValues, Optional<Long> currentStepId) Get a view without elements hidden by a rule- Parameters:
request- the requestform- The current formentryView- The entry view with possibly unwanted viewItemsentryValues- The entry valuescurrentStepId- current step of the entry. Can be empty if the form has no workflow- Returns:
- a view with filtered items
-
_getRuleFilteredQuestions
protected abstract List<FormQuestion> _getRuleFilteredQuestions(Request request, Form form, FormQuestionDAO.FormEntryValues entryValues, Optional<Long> currentStepId) Get the list of active question depending of the form rules- Parameters:
request- the requestform- the formentryValues- the entry values to compute rulescurrentStepId- the current step id. Can be empty if the form has no workflow- Returns:
- the list of active question depending of the form rules
-
_handleComputedValues
protected void _handleComputedValues(List<FormQuestion> questions, FormEntry entry, boolean forEdition) Handle computed values- Parameters:
questions- the form questionsentry- the entryforEdition-trueto handle edition
-
editFormEntryValues
protected Multimap<String,I18nizableText> editFormEntryValues(Request request, FormEntry entry, Optional<Long> currentStepId, Map<String, Object> additionalParameters, boolean isCreated) throws ExceptionEdit form entry values with form inputs and validate them. If no error is found, values are saved in the entry and the form is saved.- Parameters:
request- the request containing form parametersentry- the form entry to editcurrentStepId- current step of the entry. Can be empty if the form has no workflowadditionalParameters- additional parameters to provide to question type validationisCreated-trueif the entry is being created,falseif it is an edition.- Returns:
- the map of errors
- Throws:
Exception- if an error occurred
-