@Test public void shouldFormatComboboxFields() { FieldDto cbField = FieldTestHelper.comboboxFieldDto("cbSingleNonUS", false, false, DisplayTestEnum.valuesMap()); assertEquals("Monday", exportCustomizer.formatField(cbField, DisplayTestEnum.MONDAY)); assertEquals("", exportCustomizer.formatField(cbField, null)); cbField = FieldTestHelper.comboboxFieldDto("cbSingleUS", false, true, null); assertEquals("something", exportCustomizer.formatField(cbField, "something")); assertEquals("", exportCustomizer.formatField(cbField, null)); cbField = FieldTestHelper.comboboxFieldDto("cbMultiNonUS", true, false, DisplayTestEnum.valuesMap()); assertEquals("Wednesday,Monday", exportCustomizer.formatField(cbField, asList(DisplayTestEnum.WEDNESDAY, DisplayTestEnum.MONDAY))); assertEquals("", exportCustomizer.formatField(cbField, null)); assertEquals("", exportCustomizer.formatField(cbField, emptyList())); cbField = FieldTestHelper.comboboxFieldDto("cbMultiUS", true, true, "one,two,three"); assertEquals("test1,test2", exportCustomizer.formatField(cbField, asList("test1", "test2"))); assertEquals("", exportCustomizer.formatField(cbField, emptyList())); assertEquals("", exportCustomizer.formatField(cbField, null)); }
@Override public String formatField(FieldDto fieldDto, Object object) { Object displayValue = DisplayHelper.getDisplayValueForField(fieldDto, object); if (displayValue == null) { displayValue = object; } else if (displayValue instanceof Map) { Map asMap = (Map) displayValue; displayValue = asMap.values(); } return TypeHelper.format(displayValue, COLL_JOIN_CHAR); }
DefaultCsvExportCustomizer implements CsvExportCustomizer { @Override public String formatField(FieldDto fieldDto, Object object) { Object displayValue = DisplayHelper.getDisplayValueForField(fieldDto, object); if (displayValue == null) { displayValue = object; } else if (displayValue instanceof Map) { Map asMap = (Map) displayValue; displayValue = asMap.values(); } return TypeHelper.format(displayValue, COLL_JOIN_CHAR); } }
DefaultCsvExportCustomizer implements CsvExportCustomizer { @Override public String formatField(FieldDto fieldDto, Object object) { Object displayValue = DisplayHelper.getDisplayValueForField(fieldDto, object); if (displayValue == null) { displayValue = object; } else if (displayValue instanceof Map) { Map asMap = (Map) displayValue; displayValue = asMap.values(); } return TypeHelper.format(displayValue, COLL_JOIN_CHAR); }  }
DefaultCsvExportCustomizer implements CsvExportCustomizer { @Override public String formatField(FieldDto fieldDto, Object object) { Object displayValue = DisplayHelper.getDisplayValueForField(fieldDto, object); if (displayValue == null) { displayValue = object; } else if (displayValue instanceof Map) { Map asMap = (Map) displayValue; displayValue = asMap.values(); } return TypeHelper.format(displayValue, COLL_JOIN_CHAR); }  @Override String formatField(FieldDto fieldDto, Object object); @Override Comparator<FieldDto> columnOrderComparator(BrowsingSettingsDto browsingSettingsDto); @Override String exportDisplayName(FieldDto fieldDto); }
DefaultCsvExportCustomizer implements CsvExportCustomizer { @Override public String formatField(FieldDto fieldDto, Object object) { Object displayValue = DisplayHelper.getDisplayValueForField(fieldDto, object); if (displayValue == null) { displayValue = object; } else if (displayValue instanceof Map) { Map asMap = (Map) displayValue; displayValue = asMap.values(); } return TypeHelper.format(displayValue, COLL_JOIN_CHAR); }  @Override String formatField(FieldDto fieldDto, Object object); @Override Comparator<FieldDto> columnOrderComparator(BrowsingSettingsDto browsingSettingsDto); @Override String exportDisplayName(FieldDto fieldDto);  }