CsvImportCustomizer¶
-
public interface
CsvImportCustomizer
¶ The
CsvImportCustomizer
interface allows to provide custom methods for finding, creating and updating an instance during csv import.See also:
org.motechproject.mds.domain.Entity
Methods¶
doCreate¶
-
Object
doCreate
(Object instance, MotechDataService dataService)¶ Creates an instance using given dataService
Parameters: - instance – the instance to create
- dataService – the data service of an entity
Returns: the created instance
doUpdate¶
-
Object
doUpdate
(Object instance, MotechDataService dataService)¶ Updates an instance using given dataService
Parameters: - instance – the instance to update
- dataService – the data service of an entity
Returns: the updated instance
findExistingInstance¶
-
Object
findExistingInstance
(Map<String, String> row, MotechDataService dataService)¶ Retrieves an instance based on the fields imported from csv
Parameters: - row – the imported row containing fields of an instance
- dataService – the data service of an entity
Returns: single instance or null if none is found
findField¶
-
FieldDto
findField
(String headerName, List<FieldDto> fieldDtos)¶ Finds entity field, being provided the display name of the column header. The default implementation looks for entity field with matching display name. If such matching cannot be found, it looks for field with matching name. If that also cannot be found, it returns null.
Parameters: - headerName – the column display name from CSV file
- fieldDtos – the list of entity fields
Returns: entity field matching the implemented criteria