use of org.apache.commons.csv.CSVPrinter in project drools-wb by kiegroup.
the class ScenarioCsvDownloadReportTest method generateAuditLogHeaderDMN.
@Test
public void generateAuditLogHeaderDMN() throws IOException {
StringBuilder stringBuilder = new StringBuilder();
CSVPrinter printer = getCSVPrinter(stringBuilder);
scenarioCsvDownloadReport.generateAuditLogHeader(printer, DMN);
String retrieved = stringBuilder.toString();
commonCheckHeader(DMN_AUDIT_HEADER, retrieved);
}
use of org.apache.commons.csv.CSVPrinter in project drools-wb by kiegroup.
the class ScenarioCsvDownloadReportTest method generateOverallStatsHeaderRULE.
@Test
public void generateOverallStatsHeaderRULE() throws IOException {
StringBuilder stringBuilder = new StringBuilder();
CSVPrinter printer = getCSVPrinter(stringBuilder);
scenarioCsvDownloadReport.generateOverallStatsHeader(printer, ScenarioSimulationModel.Type.RULE);
String retrieved = stringBuilder.toString();
commonCheckHeader(RULE_OVERALL_STATS_HEADER, retrieved);
}
use of org.apache.commons.csv.CSVPrinter in project drools-wb by kiegroup.
the class ScenarioCsvImportExportTest method setup.
@Before
public void setup() throws IOException {
output = new StringBuilder();
printer = new CSVPrinter(output, CSVFormat.EXCEL);
scenarioCsvImportExport = new ScenarioCsvImportExport();
}
use of org.apache.commons.csv.CSVPrinter in project portfolio by buchen.
the class ScatterChartCSVExporter method writeToFile.
@Override
protected void writeToFile(File file) throws IOException {
try (Writer writer = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8)) {
CSVPrinter printer = new CSVPrinter(writer);
printer.setStrategy(STRATEGY);
// write header
printer.print(Messages.ColumnDataSeries);
printer.print(chart.getAxisSet().getXAxis(0).getTitle().getText());
printer.print(chart.getAxisSet().getYAxis(0).getTitle().getText());
printer.println();
// write body
ISeries[] series = chart.getSeriesSet().getSeries();
for (ISeries serie : series) {
printer.print(serie.getId());
printer.print(valueFormat.format(serie.getXSeries()[0]));
printer.print(valueFormat.format(serie.getYSeries()[0]));
printer.println();
}
}
}
use of org.apache.commons.csv.CSVPrinter in project portfolio by buchen.
the class TimelineChartCSVExporter method writeToFile.
@Override
protected void writeToFile(File file) throws IOException {
try (Writer writer = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8)) {
CSVPrinter printer = new CSVPrinter(writer);
printer.setStrategy(STRATEGY);
ISeries[] series = chart.getSeriesSet().getSeries();
// write header
printer.print(Messages.ColumnDate);
for (ISeries s : series) printer.print(s.getId());
printer.println();
// write body
Date[] dateSeries = series[0].getXDateSeries();
SeriesAdapter[] adapters = new SeriesAdapter[series.length];
for (int ii = 0; ii < series.length; ii++) {
if (discontinousSeries.contains(series[ii].getId()))
adapters[ii] = new DiscontinousAdapter(series[ii]);
else
adapters[ii] = new DefaultAdapter(series[ii]);
}
for (int line = 0; line < dateSeries.length; line++) {
printer.print(dateFormat.format(dateSeries[line]));
for (int col = 0; col < adapters.length; col++) printer.print(adapters[col].format(dateSeries[line], line));
printer.println();
}
}
}
Aggregations