diff --git a/src/main/java/cz/muni/ics/kypo/training/adaptive/controller/PhasesController.java b/src/main/java/cz/muni/ics/kypo/training/adaptive/controller/PhasesController.java index c97d53f03b8dc048cfc82c68abfcb1bdd5e22cb0..674aa63723ff3af2097b3abb29c465a42347385e 100644 --- a/src/main/java/cz/muni/ics/kypo/training/adaptive/controller/PhasesController.java +++ b/src/main/java/cz/muni/ics/kypo/training/adaptive/controller/PhasesController.java @@ -43,8 +43,12 @@ import java.util.List; authorizations = @Authorization(value = "bearerAuth")) public class PhasesController { + private final TrainingPhaseFacade trainingPhaseFacade; + @Autowired - private TrainingPhaseFacade trainingPhaseFacade; + public PhasesController(TrainingPhaseFacade trainingPhaseFacade) { + this.trainingPhaseFacade = trainingPhaseFacade; + } @ApiOperation(httpMethod = "POST", value = "Create a new phase", diff --git a/src/main/java/cz/muni/ics/kypo/training/adaptive/controller/TasksController.java b/src/main/java/cz/muni/ics/kypo/training/adaptive/controller/TasksController.java index 139f6c503d660a51b0df52d2f6eb1cbba1113c13..2f3a89270658263c2462870e0fe66fde01441ab9 100644 --- a/src/main/java/cz/muni/ics/kypo/training/adaptive/controller/TasksController.java +++ b/src/main/java/cz/muni/ics/kypo/training/adaptive/controller/TasksController.java @@ -36,8 +36,12 @@ import javax.validation.Valid; authorizations = @Authorization(value = "bearerAuth")) public class TasksController { + private final TaskService taskService; + @Autowired - private TaskService taskService; + public TasksController(TaskService taskService) { + this.taskService = taskService; + } @ApiOperation(httpMethod = "POST", value = "Create a new task in a phase", diff --git a/src/main/java/cz/muni/ics/kypo/training/adaptive/facade/TrainingPhaseFacade.java b/src/main/java/cz/muni/ics/kypo/training/adaptive/facade/TrainingPhaseFacade.java index 596f32efcaa54c3a490fc26ea55a1d6b91a9af1f..63fbb35ecb775916044fa59f5fdcc62f3941dc4b 100644 --- a/src/main/java/cz/muni/ics/kypo/training/adaptive/facade/TrainingPhaseFacade.java +++ b/src/main/java/cz/muni/ics/kypo/training/adaptive/facade/TrainingPhaseFacade.java @@ -22,17 +22,19 @@ import java.util.List; @Service public class TrainingPhaseFacade { - @Autowired - private PhaseService phaseService; - - @Autowired - private InfoPhaseService infoPhaseService; + private final PhaseService phaseService; + private final InfoPhaseService infoPhaseService; + private final QuestionnairePhaseService questionnairePhaseService; + private final TrainingPhaseService trainingPhaseService; @Autowired - private QuestionnairePhaseService questionnairePhaseService; - - @Autowired - private TrainingPhaseService trainingPhaseService; + public TrainingPhaseFacade(PhaseService phaseService, InfoPhaseService infoPhaseService, + QuestionnairePhaseService questionnairePhaseService, TrainingPhaseService trainingPhaseService) { + this.phaseService = phaseService; + this.infoPhaseService = infoPhaseService; + this.questionnairePhaseService = questionnairePhaseService; + this.trainingPhaseService = trainingPhaseService; + } public AbstractPhaseDTO createPhase(Long trainingDefinitionId, PhaseCreateDTO phaseCreateDTO) { AbstractPhaseDTO abstractPhaseDto; diff --git a/src/main/java/cz/muni/ics/kypo/training/adaptive/service/PhaseService.java b/src/main/java/cz/muni/ics/kypo/training/adaptive/service/PhaseService.java index 6632d4b10f9894a350324bd3e2c9a3f8a9dde4a8..f757d174183648a12a4fb473360f9b319006a5e3 100644 --- a/src/main/java/cz/muni/ics/kypo/training/adaptive/service/PhaseService.java +++ b/src/main/java/cz/muni/ics/kypo/training/adaptive/service/PhaseService.java @@ -13,11 +13,14 @@ import java.util.List; @Service public class PhaseService { - @Autowired - private AbstractPhaseRepository abstractPhaseRepository; + private final AbstractPhaseRepository abstractPhaseRepository; + private final TrainingPhaseService trainingPhaseService; @Autowired - private TrainingPhaseService trainingPhaseService; + public PhaseService(AbstractPhaseRepository abstractPhaseRepository, TrainingPhaseService trainingPhaseService) { + this.abstractPhaseRepository = abstractPhaseRepository; + this.trainingPhaseService = trainingPhaseService; + } @Transactional public void deletePhase(Long definitionId, Long phaseId) { diff --git a/src/main/java/cz/muni/ics/kypo/training/adaptive/service/QuestionnairePhaseService.java b/src/main/java/cz/muni/ics/kypo/training/adaptive/service/QuestionnairePhaseService.java index 0eb15741f07ee60bcf216b242471849aeb8764e3..bd93d710804c0500698a52a31deb46a535b2b77a 100644 --- a/src/main/java/cz/muni/ics/kypo/training/adaptive/service/QuestionnairePhaseService.java +++ b/src/main/java/cz/muni/ics/kypo/training/adaptive/service/QuestionnairePhaseService.java @@ -32,20 +32,22 @@ public class QuestionnairePhaseService { private static final Logger LOG = LoggerFactory.getLogger(QuestionnairePhaseService.class); - @Autowired - private QuestionnairePhaseRepository questionnairePhaseRepository; - - @Autowired - private AbstractPhaseRepository abstractPhaseRepository; - - @Autowired - private QuestionRepository questionRepository; - - @Autowired - private TrainingPhaseRepository trainingPhaseRepository; + private final QuestionnairePhaseRepository questionnairePhaseRepository; + private final AbstractPhaseRepository abstractPhaseRepository; + private final QuestionRepository questionRepository; + private final TrainingPhaseRepository trainingPhaseRepository; + private final QuestionPhaseRelationRepository questionPhaseRelationRepository; @Autowired - private QuestionPhaseRelationRepository questionPhaseRelationRepository; + public QuestionnairePhaseService(QuestionnairePhaseRepository questionnairePhaseRepository, AbstractPhaseRepository abstractPhaseRepository, + QuestionRepository questionRepository, TrainingPhaseRepository trainingPhaseRepository, + QuestionPhaseRelationRepository questionPhaseRelationRepository) { + this.questionnairePhaseRepository = questionnairePhaseRepository; + this.abstractPhaseRepository = abstractPhaseRepository; + this.questionRepository = questionRepository; + this.trainingPhaseRepository = trainingPhaseRepository; + this.questionPhaseRelationRepository = questionPhaseRelationRepository; + } public QuestionnairePhaseDTO createDefaultQuestionnairePhase(Long trainingDefinitionId, PhaseCreateDTO phaseCreateDTO) { diff --git a/src/main/java/cz/muni/ics/kypo/training/adaptive/service/TrainingPhaseService.java b/src/main/java/cz/muni/ics/kypo/training/adaptive/service/TrainingPhaseService.java index 9cceba82bbfaa931862e460c5642ea52952e5f68..7e0a807bde8128771a9e5842343259f1138bfef7 100644 --- a/src/main/java/cz/muni/ics/kypo/training/adaptive/service/TrainingPhaseService.java +++ b/src/main/java/cz/muni/ics/kypo/training/adaptive/service/TrainingPhaseService.java @@ -24,11 +24,14 @@ public class TrainingPhaseService { private static final Logger LOG = LoggerFactory.getLogger(TrainingPhaseService.class); - @Autowired - private TrainingPhaseRepository trainingPhaseRepository; + private final TrainingPhaseRepository trainingPhaseRepository; + private final AbstractPhaseRepository abstractPhaseRepository; @Autowired - private AbstractPhaseRepository abstractPhaseRepository; + public TrainingPhaseService(TrainingPhaseRepository trainingPhaseRepository, AbstractPhaseRepository abstractPhaseRepository) { + this.trainingPhaseRepository = trainingPhaseRepository; + this.abstractPhaseRepository = abstractPhaseRepository; + } public TrainingPhaseDTO createDefaultTrainingPhase(Long trainingDefinitionId) { @@ -121,7 +124,7 @@ public class TrainingPhaseService { trainingPhaseRepository.save(trainingPhase); } - private List<DecisionMatrixRow> getNewDecisionMatrixRows(int currentNumberOfNewRows, int expectedNumberOfRows, TrainingPhase trainingPhase) { + private List<DecisionMatrixRow> getNewDecisionMatrixRows(int currentNumberOfNewRows, int expectedNumberOfRows, TrainingPhase trainingPhase) { List<DecisionMatrixRow> result = new ArrayList<>(); for (int i = currentNumberOfNewRows; i < expectedNumberOfRows; i++) { DecisionMatrixRow decisionMatrixRow = new DecisionMatrixRow();