Class CsvServiceImpl
- java.lang.Object
-
- org.opennms.netmgt.flows.classification.internal.csv.CsvServiceImpl
-
- All Implemented Interfaces:
CsvService
public class CsvServiceImpl extends Object implements CsvService
-
-
Field Summary
Fields Modifier and Type Field Description static String[]HEADERSstatic StringHEADERS_STRING
-
Constructor Summary
Constructors Constructor Description CsvServiceImpl(RuleValidator ruleValidator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcreateCSV(List<Rule> rules)Creates a CSV string from the given rules.CsvImportResultparseCSV(Group group, 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, InputStream inputStream, boolean hasHeader) throws CSVImportException
Description copied from interface:CsvServiceParses the given CSV stream into rules.- Specified by:
parseCSVin interfaceCsvServiceinputStream- 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 String createCSV(List<Rule> rules)
Description copied from interface:CsvServiceCreates a CSV string from the given rules.- Specified by:
createCSVin interfaceCsvService- Returns:
- CSV string representation of given rules.
-
-