@Test public void shouldExportInstancesFromTableAsCsv() { when(mdsLookupService.<Record2>findMany((any(String.class)), eq("lookup"), any(Map.class), any(QueryParams.class))).thenReturn(testInstances(IdMode.INCLUDE_ID)); StringWriter writer = new StringWriter(); List<String> headers = Arrays.asList("ID", "Creator", "Owner", "Modified By", "Creation date", "Modification date", "Value Disp", "Date disp", "dateIgnoredByRest disp", "enumField Disp", "enumListField Disp", "singleRelationship Disp", "multiRelationship Disp"); long result = csvImporterExporter.exportCsv(ENTITY_ID, writer, "lookup", null, headers, null); assertEquals(INSTANCE_COUNT, result); assertEquals(getTestEntityRecordsAsCsv(IdMode.INCLUDE_ID), writer.toString()); }
@Transactional public long exportCsv(final long entityId, final Writer writer) { EntityInfo entityInfo = getEntity(entityId); try (CsvTableWriter tableWriter = new CsvTableWriter(writer)) { return exportData(entityInfo, tableWriter); } }
CsvImporterExporter extends AbstractMdsExporter { @Transactional public long exportCsv(final long entityId, final Writer writer) { EntityInfo entityInfo = getEntity(entityId); try (CsvTableWriter tableWriter = new CsvTableWriter(writer)) { return exportData(entityInfo, tableWriter); } } }
CsvImporterExporter extends AbstractMdsExporter { @Transactional public long exportCsv(final long entityId, final Writer writer) { EntityInfo entityInfo = getEntity(entityId); try (CsvTableWriter tableWriter = new CsvTableWriter(writer)) { return exportData(entityInfo, tableWriter); } }  }
CsvImporterExporter extends AbstractMdsExporter { @Transactional public long exportCsv(final long entityId, final Writer writer) { EntityInfo entityInfo = getEntity(entityId); try (CsvTableWriter tableWriter = new CsvTableWriter(writer)) { return exportData(entityInfo, tableWriter); } }  @Transactional CsvImportResults importCsv(final long entityId, final Reader reader, boolean continueOnError, boolean clearData); @Transactional CsvImportResults importCsv(final long entityId, final Reader reader, CsvImportCustomizer importCustomizer, boolean continueOnError, boolean clearData); @Transactional CsvImportResults importCsv(final String entityClassName, final Reader reader, boolean continueOnError); @Transactional long exportCsv(final long entityId, final Writer writer); @Transactional long exportCsv(final String entityClassName, final Writer writer); @Transactional long exportCsv(final long entityId, final Writer writer, final CsvExportCustomizer exportCustomizer); @Transactional long exportCsv(final String entityClassName, final Writer writer, final CsvExportCustomizer exportCustomizer); @Transactional long exportCsv(long entityId, Writer writer, String lookupName, QueryParams params, List<String> headers,
                          Map<String, Object> lookupFields); @Transactional long exportCsv(String entityClassName, Writer writer, String lookupName, QueryParams params, List<String> headers,
                          Map<String, Object> lookupFields); @Transactional long exportCsv(long entityId, Writer writer, String lookupName, QueryParams params, List<String> headers,
                          Map<String, Object> lookupFields, CsvExportCustomizer exportCustomizer); @Transactional long exportCsv(String entityClassName, Writer writer, String lookupName, QueryParams params, List<String> headers,
                          Map<String, Object> lookupFields, CsvExportCustomizer exportCustomizer); }
CsvImporterExporter extends AbstractMdsExporter { @Transactional public long exportCsv(final long entityId, final Writer writer) { EntityInfo entityInfo = getEntity(entityId); try (CsvTableWriter tableWriter = new CsvTableWriter(writer)) { return exportData(entityInfo, tableWriter); } }  @Transactional CsvImportResults importCsv(final long entityId, final Reader reader, boolean continueOnError, boolean clearData); @Transactional CsvImportResults importCsv(final long entityId, final Reader reader, CsvImportCustomizer importCustomizer, boolean continueOnError, boolean clearData); @Transactional CsvImportResults importCsv(final String entityClassName, final Reader reader, boolean continueOnError); @Transactional long exportCsv(final long entityId, final Writer writer); @Transactional long exportCsv(final String entityClassName, final Writer writer); @Transactional long exportCsv(final long entityId, final Writer writer, final CsvExportCustomizer exportCustomizer); @Transactional long exportCsv(final String entityClassName, final Writer writer, final CsvExportCustomizer exportCustomizer); @Transactional long exportCsv(long entityId, Writer writer, String lookupName, QueryParams params, List<String> headers,
                          Map<String, Object> lookupFields); @Transactional long exportCsv(String entityClassName, Writer writer, String lookupName, QueryParams params, List<String> headers,
                          Map<String, Object> lookupFields); @Transactional long exportCsv(long entityId, Writer writer, String lookupName, QueryParams params, List<String> headers,
                          Map<String, Object> lookupFields, CsvExportCustomizer exportCustomizer); @Transactional long exportCsv(String entityClassName, Writer writer, String lookupName, QueryParams params, List<String> headers,
                          Map<String, Object> lookupFields, CsvExportCustomizer exportCustomizer);  }