Closed eleallegue closed 6 years ago
Hi, in your module do you have to read an string describing the kind from the excel or an int representing the kindCode?
In ours we read the integer kindCode from the database and the by means of the master.csv
file and then we resolve each code to its description in the file. Also notice that we look directly in the csv file so if during the execution of the module the master.csv
file changes the module can still resolve the new names properly.
Example:
https://github.com/thewilly/Agents_i3a/blob/9269c254a9bdd2133b661287e845aa9fe6da762f/src/main/java/domain/Agent.java#L153-L162
public String getKind() {
try {
return CSVFile.of( new URL( "src/main/resources/master.csv" ), ",", "id", "kind" )
.getRows().stream()
.filter( r -> r.getColumn( "id" ).equals( Integer.toString( kindCode ) ) )
.findAny().get().getColumn( "kind" );
} catch (NoSuchElementException e) {
return KIND_NOT_FOUND;
}
}
From the excel's files from tests as well as for the normal running of the program, we read the kindCode, so an Integer, and then we use the master.csv file for obtaining the kind's name
okay perfect then, thanks!
Need of creating a master file in cvs format, with the following information: The file contains 2 fields separated by commas, where the first field is the numeric code and the second one is the name of the user kind. 1,Person 2,Entity 3,Sensor
This should be read before inserting all the data in the database