Package org.ametys.web
Class FOAmetysObjectCreationHelper
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.web.FOAmetysObjectCreationHelper
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
- Direct Known Subclasses:
FOContentCreationHelper
public class FOAmetysObjectCreationHelper
extends AbstractLogEnabled
implements Serviceable, Component
Helper for creating and editing an ametys object from the submitted form
-
Field Summary
Modifier and TypeFieldDescriptionprotected CurrentUserProvider
The current user providerprotected UploadManager
The upload managerstatic final String
The component role. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription_getElementValue
(Request request, ElementDefinition definition, String dataPath, Multimap<String, I18nizableText> errors) Get the value from the request of given element_getRepeaterEntries
(Request request, ModelViewItemGroup viewItem, String dataPath, Multimap<String, I18nizableText> errors) Get the repeater entries from the request_getTypedValue
(Object formValue, ElementDefinition definition, String dataPath, Multimap<String, I18nizableText> errors) Get the typed value from object_getUploadFileValue
(Part partUploaded, String dataPath, Multimap<String, I18nizableText> errors) Get the uploaded file valuegetFormValues
(Request request, ViewItemContainer viewItemContainer, String prefix, Multimap<String, I18nizableText> errors) Get values from the requestvoid
service
(ServiceManager manager) validateValues
(Map<String, Object> values, View view) Validate the given valuesMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The component role. -
_uploadManager
The upload manager -
_currentUserProvider
The current user provider
-
-
Constructor Details
-
FOAmetysObjectCreationHelper
public FOAmetysObjectCreationHelper()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getFormValues
public Map<String,Object> getFormValues(Request request, ViewItemContainer viewItemContainer, String prefix, Multimap<String, I18nizableText> errors) Get values from the request- Parameters:
request
- the requestviewItemContainer
- the view item container fo the ametys objectprefix
- the prefixerrors
- the errors- Returns:
- the map of values
-
_getElementValue
protected Optional<? extends Object> _getElementValue(Request request, ElementDefinition definition, String dataPath, Multimap<String, I18nizableText> errors) Get the value from the request of given element- Parameters:
request
- the requestdefinition
- the definition of the given elementdataPath
- the data patherrors
- the errors- Returns:
- the element values if exist
-
_getTypedValue
protected Optional<? extends Object> _getTypedValue(Object formValue, ElementDefinition definition, String dataPath, Multimap<String, I18nizableText> errors) Get the typed value from object- Parameters:
formValue
- the object valuedefinition
- the definition of the given elementdataPath
- the data patherrors
- the errors- Returns:
- the typed value if exist
-
_getRepeaterEntries
protected List<Map<String,Object>> _getRepeaterEntries(Request request, ModelViewItemGroup viewItem, String dataPath, Multimap<String, I18nizableText> errors) Get the repeater entries from the request- Parameters:
request
- the requestviewItem
- the view itemdataPath
- the data patherrors
- the errors- Returns:
- list of repeater entries
-
_getUploadFileValue
protected Optional<Binary> _getUploadFileValue(Part partUploaded, String dataPath, Multimap<String, I18nizableText> errors) Get the uploaded file value- Parameters:
partUploaded
- the uploaded partdataPath
- the data patherrors
- the errors- Returns:
- the file binary if exist
-
validateValues
Validate the given values- Parameters:
values
- the values to validateview
- the view of the ametys object- Returns:
- The errors if some values are not valid
-