/
main68.py
43 lines (39 loc) · 1.9 KB
/
main68.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
'''
Created on Nov 18, 2019
@author: flavi
'''
from validare.validatoare import ValidatorStudent, ValidatorDiscipline, ValidatorGrade
from infrastructure.repos import Repo
from business.services import ServiceStudents, ServiceDisciplines, ServiceGrades
from presentation.ui import Console
from business.services import ServiceUndo
from AppSettings import *
from infrastructure.RepoTextFile import StudentTextFileRepo, DisciplineTextFileRepo, GradesTextFileRepo
from infrastructure.RepoBinaryFile import BinaryFileRepo
from infrastructure.JSONFile import JSONRepo
validatorStudent = ValidatorStudent()
validatorDiscipline = ValidatorDiscipline()
validatorGrade = ValidatorGrade()
appsettings = AppSettings()
if appsettings.Data["repository"] == "inmemory":
repoStudents = Repo()
repoDisciplines = Repo()
repoGrades = Repo()
elif appsettings.Data["repository"] == "textfiles":
repoStudents = StudentTextFileRepo(appsettings.Data["student"])
repoDisciplines = DisciplineTextFileRepo(appsettings.Data["discipline"])
repoGrades = GradesTextFileRepo(appsettings.Data["grade"])
elif appsettings.Data["repository"] == "binaryfile":
repoStudents = BinaryFileRepo(appsettings.Data["student"])
repoDisciplines = BinaryFileRepo(appsettings.Data["discipline"])
repoGrades = BinaryFileRepo(appsettings.Data["grade"])
elif appsettings.Data["repository"] == "json":
repoStudents = JSONRepo(appsettings.Data["student"])
repoDisciplines = JSONRepo(appsettings.Data["discipline"])
repoGrades = JSONRepo(appsettings.Data["grade"])
serviceUndo = ServiceUndo()
serviceStudents = ServiceStudents(repoStudents, validatorStudent, serviceUndo)
serviceDisciplines = ServiceDisciplines(repoDisciplines, validatorDiscipline, serviceUndo)
serviceGrades = ServiceGrades(repoStudents, repoDisciplines, repoGrades, validatorGrade, serviceUndo)
ui = Console(serviceStudents, serviceDisciplines, serviceGrades, serviceUndo)
ui.run()