Class CsvServiceImpl

  • All Implemented Interfaces:
    CsvService

    public class CsvServiceImpl
    extends java.lang.Object
    implements CsvService
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String[] HEADERS  
      static java.lang.String HEADERS_STRING  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String createCSV​(java.util.List<Rule> rules)
      Creates a CSV string from the given rules.
      CsvImportResult parseCSV​(Group group, java.io.InputStream inputStream, boolean hasHeader)
      Parses the given CSV stream into rules.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • HEADERS

        public static final java.lang.String[] HEADERS
      • HEADERS_STRING

        public static final java.lang.String HEADERS_STRING
    • Constructor Detail

      • CsvServiceImpl

        public CsvServiceImpl​(RuleValidator ruleValidator)
    • Method Detail

      • parseCSV

        public CsvImportResult parseCSV​(Group group,
                                        java.io.InputStream inputStream,
                                        boolean hasHeader)
                                 throws CSVImportException
        Description copied from interface: CsvService
        Parses the given CSV stream into rules.
        Specified by:
        parseCSV in interface CsvService
        inputStream - The inputstream to read the CSV from.
        hasHeader - If defined, the csv defined by the inputStream has an header, and this is skipped (not considered as a Rule).
        Returns:
        The list of rules. Only returns, if ALL rules are valid, otherwise the CSVImportException is thrown.
        Throws:
        CSVImportException - is thrown when parsing the CSV fails.
      • createCSV

        public java.lang.String createCSV​(java.util.List<Rule> rules)
        Description copied from interface: CsvService
        Creates a CSV string from the given rules.
        Specified by:
        createCSV in interface CsvService
        Returns:
        CSV string representation of given rules.