@Test public void shouldFindFieldsByNames() { Assert.assertEquals(field1, importCustomizer.findField("name", fields)); Assert.assertEquals(field2, importCustomizer.findField("name2", fields)); Assert.assertEquals(field3, importCustomizer.findField("name3", fields)); }
@Override public FieldDto findField(String headerName, List<FieldDto> fieldDtos) { FieldDto matchingDisplayNameField = null; FieldDto matchingNameField = null; for (FieldDto field : fieldDtos) { if (headerName.equals(field.getBasic().getDisplayName())) { matchingDisplayNameField = field; break; } else if (headerName.equals(field.getBasic().getName())) { matchingNameField = field; } } return matchingDisplayNameField != null ? matchingDisplayNameField : matchingNameField; }
DefaultCsvImportCustomizer implements CsvImportCustomizer { @Override public FieldDto findField(String headerName, List<FieldDto> fieldDtos) { FieldDto matchingDisplayNameField = null; FieldDto matchingNameField = null; for (FieldDto field : fieldDtos) { if (headerName.equals(field.getBasic().getDisplayName())) { matchingDisplayNameField = field; break; } else if (headerName.equals(field.getBasic().getName())) { matchingNameField = field; } } return matchingDisplayNameField != null ? matchingDisplayNameField : matchingNameField; } }
DefaultCsvImportCustomizer implements CsvImportCustomizer { @Override public FieldDto findField(String headerName, List<FieldDto> fieldDtos) { FieldDto matchingDisplayNameField = null; FieldDto matchingNameField = null; for (FieldDto field : fieldDtos) { if (headerName.equals(field.getBasic().getDisplayName())) { matchingDisplayNameField = field; break; } else if (headerName.equals(field.getBasic().getName())) { matchingNameField = field; } } return matchingDisplayNameField != null ? matchingDisplayNameField : matchingNameField; }  }
DefaultCsvImportCustomizer implements CsvImportCustomizer { @Override public FieldDto findField(String headerName, List<FieldDto> fieldDtos) { FieldDto matchingDisplayNameField = null; FieldDto matchingNameField = null; for (FieldDto field : fieldDtos) { if (headerName.equals(field.getBasic().getDisplayName())) { matchingDisplayNameField = field; break; } else if (headerName.equals(field.getBasic().getName())) { matchingNameField = field; } } return matchingDisplayNameField != null ? matchingDisplayNameField : matchingNameField; }  @Override Object findExistingInstance(Map<String, String> row, MotechDataService dataService); @Override Object doCreate(Object instance, MotechDataService dataService); @Override Object doUpdate(Object instance, MotechDataService dataService); @Override FieldDto findField(String headerName, List<FieldDto> fieldDtos); }
DefaultCsvImportCustomizer implements CsvImportCustomizer { @Override public FieldDto findField(String headerName, List<FieldDto> fieldDtos) { FieldDto matchingDisplayNameField = null; FieldDto matchingNameField = null; for (FieldDto field : fieldDtos) { if (headerName.equals(field.getBasic().getDisplayName())) { matchingDisplayNameField = field; break; } else if (headerName.equals(field.getBasic().getName())) { matchingNameField = field; } } return matchingDisplayNameField != null ? matchingDisplayNameField : matchingNameField; }  @Override Object findExistingInstance(Map<String, String> row, MotechDataService dataService); @Override Object doCreate(Object instance, MotechDataService dataService); @Override Object doUpdate(Object instance, MotechDataService dataService); @Override FieldDto findField(String headerName, List<FieldDto> fieldDtos);  }