@@ -131,17 +146,18 @@ class KafkaTopology(private val settings: SettingsLoader) {
headerProperties=line
headerProperties.forEachIndexed{index,property->
if(property.isEmpty()){
throwInvalidInputException("Missing a property name on row $count in column $index!")
throwInvalidInputException("Missing a property name on row $count in column ${index + 1}!")
}
if(property.contains(Regex("[+,.]"))){
throwInvalidInputException("Invalid property name $property on row $count in column ${index + 1}! You may not use the any of the following characters: + , . ")
}
// TODO: Any validations on the field names themselves?
// Like no special characters? might be a good idea for processing
}
}
continue
}
// the +1 ensures, that users can start columns beginning at 1!
validentifier=line[identifierIndex+1]
// the -1 ensures, that users can start columns beginning at 1!
validentifier=line[identifierIndex-1]
when{
identifier.isEmpty()->{
throwInvalidInputException("The unique identifier in column $identifierIndex in row $count is empty!")
...
...
@@ -153,20 +169,16 @@ class KafkaTopology(private val settings: SettingsLoader) {
mutableSet.add(identifier)
}
}
valkeyValueMap=json{
obj(
headerProperties.zip(line)
)
}
valresult=Pair(identifier,keyValueMap)
valreport=Report(
identifier,
"SUCCESS",
"Successfully created record with identifier $identifier with format CSV!",
1
"Successfully created record with identifier $identifier from row $count!"