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,Initializable,Component,Serviceable
public class ImportCSVFileHelper extends AbstractLogEnabled implements Component, Serviceable, Initializable
Import contents from an uploaded CSV file.
-
-
Constructor Summary
Constructors Constructor Description ImportCSVFileHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeleteFile(String path)Delete the file related to the given pathMap<String,Object>getImportCSVParametersValues(String contentTypeId)Retrieves the values for import CSV parametersMap<String,Object>importContents(Map<String,Object> config, Map<String,Object> formValues, List<Map<String,Object>> mappingValues)Gets the configuration for creating/editing a collection of synchronizable contents.voidinitialize()voidservice(ServiceManager serviceManager)Map<String,Object>validateConfiguration(String contentTypeId, Map formValues, List<Map<String,Object>> mappingValues)Gets the configuration for creating/editing a collection of synchronizable contents.-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Constructor Detail
-
ImportCSVFileHelper
public ImportCSVFileHelper()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
initialize
public void initialize() throws Exception
- Specified by:
initializein interfaceInitializable- Throws:
Exception
-
getImportCSVParametersValues
public Map<String,Object> getImportCSVParametersValues(String contentTypeId)
Retrieves the values for import CSV parameters- Parameters:
contentTypeId- the configured content type identifier- Returns:
- the values for import CSV parameters
-
validateConfiguration
public Map<String,Object> validateConfiguration(String contentTypeId, Map formValues, List<Map<String,Object>> mappingValues) throws IOException
Gets 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<String,Object> config, Map<String,Object> formValues, List<Map<String,Object>> mappingValues) throws IOException
Gets 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
public void deleteFile(String path) throws IOException
Delete the file related to the given path- Parameters:
path- path of the file- Throws:
IOException- if an error occurs while deleting the file
-
-