@Test public void exportRecord() throws IOException { try (final ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { csvExportStrategy.exportRecord(outputStream, Arrays.asList("simple", "", "with ,", "with , and \"")); assertThat(outputStream.toString().trim(), is("simple,,\"with ,\",\"with , and \"\"\"")); } }
@Override public void exportRecord(final OutputStream outputStream, final Iterable<String> values) throws IOException { try (final CSVPrinter csvPrinter = new CSVPrinter(new OutputStreamWriter(outputStream, StandardCharsets.UTF_8), CSVFormat.EXCEL)) { csvPrinter.printRecord(values); } }
CsvExportStrategy implements PlatformDataExportStrategy { @Override public void exportRecord(final OutputStream outputStream, final Iterable<String> values) throws IOException { try (final CSVPrinter csvPrinter = new CSVPrinter(new OutputStreamWriter(outputStream, StandardCharsets.UTF_8), CSVFormat.EXCEL)) { csvPrinter.printRecord(values); } } }
CsvExportStrategy implements PlatformDataExportStrategy { @Override public void exportRecord(final OutputStream outputStream, final Iterable<String> values) throws IOException { try (final CSVPrinter csvPrinter = new CSVPrinter(new OutputStreamWriter(outputStream, StandardCharsets.UTF_8), CSVFormat.EXCEL)) { csvPrinter.printRecord(values); } } @Autowired  CsvExportStrategy(final ConfigService<? extends HavenSearchCapable> configService,
                             final FieldPathNormaliser fieldPathNormaliser,
                             final FieldDisplayNameGenerator fieldDisplayNameGenerator); }
CsvExportStrategy implements PlatformDataExportStrategy { @Override public void exportRecord(final OutputStream outputStream, final Iterable<String> values) throws IOException { try (final CSVPrinter csvPrinter = new CSVPrinter(new OutputStreamWriter(outputStream, StandardCharsets.UTF_8), CSVFormat.EXCEL)) { csvPrinter.printRecord(values); } } @Autowired  CsvExportStrategy(final ConfigService<? extends HavenSearchCapable> configService,
                             final FieldPathNormaliser fieldPathNormaliser,
                             final FieldDisplayNameGenerator fieldDisplayNameGenerator); @Override void writeHeader(final OutputStream outputStream, final Collection<FieldInfo<?>> fieldNames); @Override List<FieldInfo<?>> getFieldNames(final MetadataNode[] metadataNodes, final Collection<String> selectedFieldIds); @Override Map<String, FieldInfo<?>> getConfiguredFieldsById(); @Override Optional<FieldInfo<Serializable>> getFieldInfoForMetadataNode(final String nodeName, final Map<String, ? extends MetadataNode> metadataNodes, final Collection<String> selectedFieldIds); @SuppressWarnings({"unchecked", "rawtypes"}) @Override Optional<FieldInfo<?>> getFieldInfoForNode(final String nodeName, final Collection<String> selectedFieldIds); @Override String getDisplayValue(final FieldInfo<?> fieldInfo, final T value); @Override void exportRecord(final OutputStream outputStream, final Iterable<String> values); @Override // CAUTION: Method has more than one exit point. String combineValues(final List<String> maybeValues); @Override ExportFormat getExportFormat(); }
CsvExportStrategy implements PlatformDataExportStrategy { @Override public void exportRecord(final OutputStream outputStream, final Iterable<String> values) throws IOException { try (final CSVPrinter csvPrinter = new CSVPrinter(new OutputStreamWriter(outputStream, StandardCharsets.UTF_8), CSVFormat.EXCEL)) { csvPrinter.printRecord(values); } } @Autowired  CsvExportStrategy(final ConfigService<? extends HavenSearchCapable> configService,
                             final FieldPathNormaliser fieldPathNormaliser,
                             final FieldDisplayNameGenerator fieldDisplayNameGenerator); @Override void writeHeader(final OutputStream outputStream, final Collection<FieldInfo<?>> fieldNames); @Override List<FieldInfo<?>> getFieldNames(final MetadataNode[] metadataNodes, final Collection<String> selectedFieldIds); @Override Map<String, FieldInfo<?>> getConfiguredFieldsById(); @Override Optional<FieldInfo<Serializable>> getFieldInfoForMetadataNode(final String nodeName, final Map<String, ? extends MetadataNode> metadataNodes, final Collection<String> selectedFieldIds); @SuppressWarnings({"unchecked", "rawtypes"}) @Override Optional<FieldInfo<?>> getFieldInfoForNode(final String nodeName, final Collection<String> selectedFieldIds); @Override String getDisplayValue(final FieldInfo<?> fieldInfo, final T value); @Override void exportRecord(final OutputStream outputStream, final Iterable<String> values); @Override // CAUTION: Method has more than one exit point. String combineValues(final List<String> maybeValues); @Override ExportFormat getExportFormat();  }