Package org.ametys.plugins.contentio.csv
Class ImportCSVFileHelper
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.contentio.csv.ImportCSVFileHelper
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
Import contents from an uploaded CSV file.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteFile
(String path) Delete the file related to the given pathGets the configuration for creating/editing a collection of synchronizable contents.void
service
(ServiceManager serviceManager) Gets the configuration for creating/editing a collection of synchronizable contents.Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
Avalon Role
-
-
Constructor Details
-
ImportCSVFileHelper
public ImportCSVFileHelper()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
validateConfiguration
public Map<String,Object> validateConfiguration(String contentTypeId, Map formValues, List<Map<String, Object>> mappingValues) throws IOExceptionGets the configuration for creating/editing a collection of synchronizable contents.- Parameters:
contentTypeId
- Content type idformValues
- map of form valuesmappingValues
- list of header and content attribute mapping- Returns:
- A map containing information about what is needed to create/edit a collection of synchronizable contents
- Throws:
IOException
- IOException while reading CSV
-
importContents
public Map<String,Object> importContents(Map config, Map formValues, List<Map<String, Object>> mappingValues) throws IOExceptionGets the configuration for creating/editing a collection of synchronizable contents.- Parameters:
config
- get all CSV related parameters: path, separating/escaping char, charset and contentTypeformValues
- map of form valuesmappingValues
- list of header and content attribute mapping- Returns:
- A map containing information about what is needed to create/edit a collection of synchronizable contents
- Throws:
IOException
- IOException while reading CSV
-
deleteFile
Delete the file related to the given path- Parameters:
path
- path of the file- Throws:
IOException
- if an error occurs while deleting the file
-