43 lines
1.1 KiB
Java
Executable File
43 lines
1.1 KiB
Java
Executable File
package com.plannaplan;
|
|
|
|
import com.plannaplan.interfaces.ProtectedAction;
|
|
import com.plannaplan.models.ConfigData;
|
|
import com.plannaplan.models.FileData;
|
|
import com.plannaplan.services.CourseService;
|
|
import com.plannaplan.services.GroupService;
|
|
import com.plannaplan.services.LecturerService;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import com.plannaplan.configutils.*;
|
|
|
|
@Component
|
|
public class Configurator implements ProtectedAction {
|
|
|
|
@Autowired
|
|
private LecturerService lecturerService;
|
|
|
|
@Autowired
|
|
private CourseService courseService;
|
|
|
|
@Autowired
|
|
private GroupService groupService;
|
|
|
|
public Configurator() {
|
|
}
|
|
|
|
public void config(ConfigData data) {
|
|
FileReader reader = new FileReader(data.getFilestream());
|
|
FileData coursesData = reader.read();
|
|
FileToDatabaseMigrator mgtr = new FileToDatabaseMigrator(lecturerService, courseService, groupService);
|
|
mgtr.migrate(coursesData);
|
|
}
|
|
|
|
@Override
|
|
public void validateAction() {
|
|
// TODO Auto-generated method stub
|
|
|
|
}
|
|
|
|
} |