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 Details

    • ROLE

      public static final String ROLE
      Avalon Role
  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager serviceManager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • 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 id
      formValues - map of form values
      mappingValues - 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 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 contentType
      formValues - map of form values
      mappingValues - 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