Class CsvServiceImpl
- java.lang.Object
-
- org.opennms.netmgt.flows.classification.internal.csv.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
-
Constructor Summary
Constructors Constructor Description CsvServiceImpl(RuleValidator ruleValidator)
-
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.
-
-
-
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 interfaceCsvService
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 interfaceCsvService
- Returns:
- CSV string representation of given rules.
-
-