Made Lecturer service to work
This commit is contained in:
@ -13,7 +13,10 @@ public class FileToDatabaseMigrator {
|
||||
public static String LECTURER_SURNAME_STRING = "nazwisko";
|
||||
public static String LECTURER_TITLE_STRING = "tytul";
|
||||
|
||||
public FileToDatabaseMigrator() {
|
||||
LecturerService lecturerService;
|
||||
|
||||
public FileToDatabaseMigrator(LecturerService lecturerService) {
|
||||
this.lecturerService = lecturerService;
|
||||
}
|
||||
|
||||
public void migrate(FileData data) {
|
||||
@ -23,13 +26,13 @@ public class FileToDatabaseMigrator {
|
||||
int surname_index = data.getIndexOf(FileToDatabaseMigrator.LECTURER_SURNAME_STRING);
|
||||
int name_index = data.getIndexOf(FileToDatabaseMigrator.LECTURER_NAME_STRING);
|
||||
|
||||
LecturerService lecturerService = new LecturerService();
|
||||
|
||||
while (rows.hasNext()) {
|
||||
Row row = rows.next();
|
||||
Lecturer newLecturer = new Lecturer(row.getCell(title_index).toString(), row.getCell(name_index).toString(),
|
||||
row.getCell(surname_index).toString());
|
||||
|
||||
System.out.println(newLecturer.getSurname());
|
||||
System.out.println(newLecturer.getName());
|
||||
System.out.println(newLecturer.getTitle());
|
||||
lecturerService.save(newLecturer);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user