diff --git a/src/main/java/com/example/demo/controller/AdaptiveTrainingDefinitionsRestController.java b/src/main/java/com/example/demo/controller/AdaptiveTrainingDefinitionsRestController.java deleted file mode 100644 index 53eb83ee64a7ef00220d2a9b2ea3580ff46f6862..0000000000000000000000000000000000000000 --- a/src/main/java/com/example/demo/controller/AdaptiveTrainingDefinitionsRestController.java +++ /dev/null @@ -1,292 +0,0 @@ -package com.example.demo.controller; - -import com.example.demo.dto.BaseLevelDto; -import com.example.demo.dto.QuestionChoiceDto; -import com.example.demo.dto.QuestionChoiceUpdateDto; -import com.example.demo.dto.QuestionDto; -import com.example.demo.dto.QuestionUpdateDto; -import com.example.demo.dto.QuestionnaireUpdateDto; -import com.example.demo.enums.QuestionType; -import com.example.demo.service.LevelOperationsService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.CrossOrigin; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping(value = "/", produces = MediaType.APPLICATION_JSON_VALUE) -@CrossOrigin(origins = "*", allowCredentials = "true", allowedHeaders = "*", - methods = {RequestMethod.GET, RequestMethod.POST, RequestMethod.DELETE, RequestMethod.PUT}) -@Api(value = "/", - tags = "Adaptive training definitions", - consumes = MediaType.APPLICATION_JSON_VALUE, - authorizations = @Authorization(value = "bearerAuth")) -public class AdaptiveTrainingDefinitionsRestController { - - private final LevelOperationsService levelOperationsService; - - @Autowired - public AdaptiveTrainingDefinitionsRestController(LevelOperationsService levelOperationsService) { - this.levelOperationsService = levelOperationsService; - } - -// @ApiOperation(httpMethod = "PUT", -// value = "Move level to specified order", -// nickname = "moveLevelToSpecifiedOrder", -// produces = MediaType.APPLICATION_JSON_VALUE -// ) -// @ApiResponses(value = { -// @ApiResponse(code = 200, message = "Level moved to specified order"), -// @ApiResponse(code = 500, message = "Unexpected application error") -// }) -// @PutMapping(value = "/levels/{levelIdFrom}/move-to/{newPosition}", produces = MediaType.APPLICATION_JSON_VALUE) -// public void moveLevelToSpecifiedOrder( -// @ApiParam(value = "Level ID - from", required = true) @PathVariable(name = "levelIdFrom") Long levelIdFrom, -// @ApiParam(value = "Position (order) to which the level should be moved", required = true) @PathVariable(name = "newPosition") int newPosition) { -// -// levelOperationsService.moveLevelToSpecifiedOrder(levelIdFrom, newPosition); -// } - -// @ApiOperation(httpMethod = "DELETE", -// value = "Delete a specified level", -// nickname = "deleteLevel", -// produces = MediaType.APPLICATION_JSON_VALUE -// ) -// @ApiResponses(value = { -// @ApiResponse(code = 200, message = "Level deleted"), -// @ApiResponse(code = 500, message = "Unexpected application error") -// }) -// @DeleteMapping(value = "/levels/{levelId}", produces = MediaType.APPLICATION_JSON_VALUE) -// public void deleteLevel( -// @ApiParam(value = "Level ID", required = true) @PathVariable(name = "levelId") Long levelId) { -// levelOperationsService.deleteLevel(levelId); -// } - -// @ApiOperation(httpMethod = "POST", -// value = "Create a new level", -// notes = "Creates only default level with a specified type", -// response = BaseLevelDto.class, -// nickname = "createLevel", -// produces = MediaType.APPLICATION_JSON_VALUE -// ) -// @ApiResponses(value = { -// @ApiResponse(code = 200, message = "Level created"), -// @ApiResponse(code = 500, message = "Unexpected application error") -// }) -// @PostMapping(path = "/levels/{levelType}") -// public BaseLevelDto createLevel( -// @ApiParam(value = "Training definition ID", required = true) @RequestParam(name = "definitionId") Long definitionId, -// @ApiParam(value = "Level type", allowableValues = "questionnaire, assessment, info, phase", required = true) -// @PathVariable("levelType") LevelType levelType) { -// -// return levelOperationsService.createLevel(definitionId, levelType); -// } - -// @ApiOperation(httpMethod = "GET", -// value = "Get level by ID", -// response = BaseLevelDto.class, -// nickname = "getLevel", -// produces = MediaType.APPLICATION_JSON_VALUE -// ) -// @ApiResponses(value = { -// @ApiResponse(code = 200, message = "Level returned"), -// @ApiResponse(code = 500, message = "Unexpected application error") -// }) -// @GetMapping(path = "/levels/{levelId}") -// public BaseLevelDto getLevel( -// @ApiParam(value = "Level ID", required = true) @PathVariable("levelId") Long levelId) { -// -// return levelOperationsService.getLevel(levelId); -// } - -// @ApiOperation(httpMethod = "PUT", -// value = "Update info level", -// nickname = "updateInfoLevel", -// consumes = MediaType.APPLICATION_JSON_VALUE -// ) -// @ApiResponses(value = { -// @ApiResponse(code = 200, message = "Info level updated"), -// @ApiResponse(code = 500, message = "Unexpected application error") -// }) -// @PutMapping(path = "/info-levels") -// public void updateInfoLevel( -// @ApiParam(value = "Info level to be updated") @RequestBody InfoLevelUpdateDto infoLevelUpdateDto) { -// -// levelOperationsService.updateInfoLevel(infoLevelUpdateDto); -// } - -// @ApiOperation(httpMethod = "PUT", -// value = "Update phase", -// nickname = "updatePhaseLevel", -// consumes = MediaType.APPLICATION_JSON_VALUE -// ) -// @ApiResponses(value = { -// @ApiResponse(code = 200, message = "Phase level"), -// @ApiResponse(code = 500, message = "Unexpected application error") -// }) -// @PutMapping(path = "/phases") -// public void updatePhaseLevel( -// @ApiParam(value = "Info level to be updated") @RequestBody PhaseLevelUpdateDto phaseLevelUpdateDto) { -// -// levelOperationsService.updatePhaseLevel(phaseLevelUpdateDto); -// } - -// @ApiOperation(httpMethod = "PUT", -// value = "Update task", -// nickname = "updateTask", -// consumes = MediaType.APPLICATION_JSON_VALUE -// ) -// @ApiResponses(value = { -// @ApiResponse(code = 200, message = "Task updated"), -// @ApiResponse(code = 500, message = "Unexpected application error") -// }) -// @PutMapping(path = "/tasks") -// public void updateTask( -// @ApiParam(value = "Task to be updated") @RequestBody TaskUpdateDto taskUpdateDto) { -// -// levelOperationsService.updateTask(taskUpdateDto); -// } - -// @ApiOperation(httpMethod = "POST", -// value = "Create a new task", -// response = BaseLevelDto.class, -// nickname = "createTask", -// produces = MediaType.APPLICATION_JSON_VALUE -// ) -// @ApiResponses(value = { -// @ApiResponse(code = 200, message = "Task created"), -// @ApiResponse(code = 500, message = "Unexpected application error") -// }) -// @PostMapping(path = "/phases/{phaseId}") -// public BaseLevelDto createTask( -// @ApiParam(value = "Phase ID", required = true) @PathVariable(name = "phaseId") Long phaseId) { -// -// return levelOperationsService.createTask(phaseId); -// } - - @ApiOperation(httpMethod = "POST", - value = "Create a new question in questionnaire", - response = BaseLevelDto.class, - nickname = "createQuestion", - produces = MediaType.APPLICATION_JSON_VALUE - ) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Question created"), - @ApiResponse(code = 500, message = "Unexpected application error") - }) - @PostMapping(path = "/questionnaires/{questionnaireId}/{questionType}") - public QuestionDto createQuestion( - @ApiParam(value = "Questionnaire ID", required = true) @PathVariable(name = "questionnaireId") Long questionnaireId, - @ApiParam(value = "Questionnaire Type", allowableValues = "FFQ, MCQ, EMI", required = true) @PathVariable(name = "questionType") QuestionType questionType) { - - return levelOperationsService.createQuestion(questionnaireId, questionType); - } - - @ApiOperation(httpMethod = "POST", - value = "Create a new choice in question", - response = BaseLevelDto.class, - nickname = "createQuestionChoice", - produces = MediaType.APPLICATION_JSON_VALUE - ) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Question choice created"), - @ApiResponse(code = 500, message = "Unexpected application error") - }) - @PostMapping(path = "/questions/{questionId}") - public QuestionChoiceDto createQuestionChoice( - @ApiParam(value = "Question ID", required = true) @PathVariable(name = "questionId") Long questionId) { - - return levelOperationsService.createQuestionChoice(questionId); - } - - @ApiOperation(httpMethod = "PUT", - value = "Update questionnaire", - nickname = "updateQuestionnaire", - consumes = MediaType.APPLICATION_JSON_VALUE - ) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Questionnaire updated"), - @ApiResponse(code = 500, message = "Unexpected application error") - }) - @PutMapping(path = "/questionnaires") - public void updateQuestionnaire( - @ApiParam(value = "Question to be updated") @RequestBody QuestionnaireUpdateDto questionUpdateDto) { - - levelOperationsService.updateQuestionnaire(questionUpdateDto); - } - -// @ApiOperation(httpMethod = "PUT", -// value = "Update question", -// nickname = "updateQuestion", -// consumes = MediaType.APPLICATION_JSON_VALUE -// ) -// @ApiResponses(value = { -// @ApiResponse(code = 200, message = "Question updated"), -// @ApiResponse(code = 500, message = "Unexpected application error") -// }) -// @PutMapping(path = "/questions") -// public void updateQuestion( -// @ApiParam(value = "Question to be updated") @RequestBody QuestionUpdateDto questionUpdateDto) { -// -// levelOperationsService.updateQuestion(questionUpdateDto); -// } - - @ApiOperation(httpMethod = "DELETE", - value = "Delete a specified question", - nickname = "deleteQuestion", - produces = MediaType.APPLICATION_JSON_VALUE - ) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Question deleted"), - @ApiResponse(code = 500, message = "Unexpected application error") - }) - @DeleteMapping(value = "/questions/{questionId}", produces = MediaType.APPLICATION_JSON_VALUE) - public void deleteQuestion( - @ApiParam(value = "Question ID", required = true) @PathVariable(name = "questionId") Long questionId) { - levelOperationsService.deleteQuestion(questionId); - } - - @ApiOperation(httpMethod = "PUT", - value = "Update question choice", - nickname = "updateQuestionChoice", - consumes = MediaType.APPLICATION_JSON_VALUE - ) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Question choice updated"), - @ApiResponse(code = 500, message = "Unexpected application error") - }) - @PutMapping(path = "/question-choices") - public void updateQuestionChoice( - @ApiParam(value = "Question choice to be updated") @RequestBody QuestionChoiceUpdateDto questionChoiceUpdateDto) { - - levelOperationsService.updateQuestionChoice(questionChoiceUpdateDto); - } - - @ApiOperation(httpMethod = "DELETE", - value = "Delete a specified question choice", - nickname = "deleteQuestionChoice", - produces = MediaType.APPLICATION_JSON_VALUE - ) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Question choice deleted"), - @ApiResponse(code = 500, message = "Unexpected application error") - }) - @DeleteMapping(value = "/question-choices/{questionChoiceId}", produces = MediaType.APPLICATION_JSON_VALUE) - public void deleteQuestionChoice( - @ApiParam(value = "Question choice ID", required = true) @PathVariable(name = "questionChoiceId") Long questionChoiceId) { - levelOperationsService.deleteQuestionChoice(questionChoiceId); - } -} diff --git a/src/main/java/com/example/demo/controller/InfoLevelController.java b/src/main/java/com/example/demo/controller/InfoLevelController.java deleted file mode 100644 index b53a215e52b9bae1cfe2eeefdc0e7eb1103360e5..0000000000000000000000000000000000000000 --- a/src/main/java/com/example/demo/controller/InfoLevelController.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.example.demo.controller; - -import com.example.demo.dto.InfoLevelCreateDto; -import com.example.demo.dto.InfoLevelDto; -import com.example.demo.dto.InfoLevelUpdateDto; -import com.example.demo.service.InfoLevelService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.CrossOrigin; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -@RestController -@RequestMapping("/info-level") -@CrossOrigin(origins = "*", allowCredentials = "true", allowedHeaders = "*", - methods = {RequestMethod.GET, RequestMethod.POST, RequestMethod.DELETE, RequestMethod.PUT}) -@Api(value = "/info-level", tags = {"Info Level"}) -public class InfoLevelController { - - private final InfoLevelService infoLevelService; - - @Autowired - public InfoLevelController(InfoLevelService infoLevelService) { - this.infoLevelService = infoLevelService; - } - - @PostMapping(produces = MediaType.APPLICATION_JSON_VALUE) - @ApiOperation(value = "Create a new info level") - @ApiResponses(value = {@ApiResponse(code = 200, message = "New info level created"), - @ApiResponse(code = 500, message = "Unexpected application error")}) - public InfoLevelDto createInfoLevel(@ApiParam(value = "Info level", required = true) @RequestBody(required = true) - InfoLevelCreateDto infoLevelCreateDto) { - return infoLevelService.createInfoLevel(infoLevelCreateDto); - } - - @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) - @ApiOperation(value = "Return info levels") - @ApiResponses(value = {@ApiResponse(code = 200, message = "Return info levels"), - @ApiResponse(code = 500, message = "Unexpected application error")}) - public List<InfoLevelDto> findInfoLevels() { - return infoLevelService.findAllInfoLevels(); - } - - @GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE) - @ApiOperation(value = "Get info level detail") - @ApiResponses(value = {@ApiResponse(code = 200, message = "Game level detail"), - @ApiResponse(code = 500, message = "Unexpected application error")}) - public InfoLevelDto getInfoLevel( - @ApiParam(value = "Game Level ID", required = true) @PathVariable("id") final Long id) { - return infoLevelService.getInfoLevel(id); - } - - // TODO this will be probably removed. This operation is implemented in AdaptiveTrainingDefinitionsRestController -// @PutMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE) -// @ApiOperation(value = "Update info level") -// @ApiResponses(value = {@ApiResponse(code = 200, message = "Updated info level"), -// @ApiResponse(code = 500, message = "Unexpected application error")}) -// public InfoLevelDto updateInfoLevel( -// @ApiParam(value = "Game Level ID", required = true) @PathVariable("id") final Long id, -// @ApiParam(value = "Update data", required = true) @RequestBody(required = true) -// InfoLevelUpdateDto infoLevelUpdateDto) { -// return infoLevelService.updateInfoLevel(id, infoLevelUpdateDto); -// } - - @DeleteMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE) - @ApiOperation(value = "Remove info level") - @ApiResponses(value = {@ApiResponse(code = 200, message = "Game level removed"), - @ApiResponse(code = 500, message = "Unexpected application error")}) - public void removeInfoLevel(@ApiParam(value = "Game Level ID", required = true) @PathVariable("id") final Long id) { - infoLevelService.removeInfoLevel(id); - } -} diff --git a/src/main/java/com/example/demo/controller/TaskController.java b/src/main/java/com/example/demo/controller/TaskController.java deleted file mode 100644 index 40549debf5212fcf47021ebc3f9dc8708f1a447c..0000000000000000000000000000000000000000 --- a/src/main/java/com/example/demo/controller/TaskController.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.example.demo.controller; - -import com.example.demo.dto.TaskCreateDto; -import com.example.demo.dto.TaskDto; -import com.example.demo.service.TaskService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.CrossOrigin; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -@RestController -@RequestMapping("/task") -@CrossOrigin(origins = "*", allowCredentials = "true", allowedHeaders = "*", - methods = {RequestMethod.GET, RequestMethod.POST, RequestMethod.DELETE, RequestMethod.PUT}) -@Api(value = "/task", tags = {"Task"}) -public class TaskController { - - private static final Logger LOG = LoggerFactory.getLogger(TaskController.class); - - private final TaskService taskService; - - @Autowired - public TaskController(TaskService taskService) { - this.taskService = taskService; - } - -// @PostMapping(produces = MediaType.APPLICATION_JSON_VALUE) -// @ApiOperation(value = "Create a new task") -// @ApiResponses(value = {@ApiResponse(code = 200, message = "New game level created"), -// @ApiResponse(code = 500, message = "Unexpected application error")}) -// public TaskDto createGameLevel(@ApiParam(value = "Game level", required = true) @RequestBody(required = true) -// TaskCreateDto taskCreateDto) { -// return taskService.createTask(taskCreateDto); -// } -// -// @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) -// @ApiOperation(value = "Return game levels") -// @ApiResponses(value = {@ApiResponse(code = 200, message = "Return game levels"), -// @ApiResponse(code = 500, message = "Unexpected application error")}) -// public List<TaskDto> findGameLevels() { -// return taskService.findAllTasks(); -// } -// -// @GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE) -// @ApiOperation(value = "Get game level detail") -// @ApiResponses(value = {@ApiResponse(code = 200, message = "Game level detail"), -// @ApiResponse(code = 500, message = "Unexpected application error")}) -// public TaskDto getGameLevel( -// @ApiParam(value = "Game Level ID", required = true) @PathVariable("id") final Long id) { -// return taskService.getTask(id); -// } - - // TODO this will be probably removed. This operation is implemented in AdaptiveTrainingDefinitionsRestController -// @PutMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE) -// @ApiOperation(value = "Update game level") -// @ApiResponses(value = {@ApiResponse(code = 200, message = "Updated game level"), -// @ApiResponse(code = 500, message = "Unexpected application error")}) -// public GameLevelDto updateGameLevel( -// @ApiParam(value = "Game Level ID", required = true) @PathVariable("id") final Long id, -// @ApiParam(value = "Update data", required = true) @RequestBody(required = true) -// GameLevelUpdateDto gameLevelUpdateDto) { -// return gameLevelService.updateGameLevel(id, gameLevelUpdateDto); -// } - -// @DeleteMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE) -// @ApiOperation(value = "Remove game level") -// @ApiResponses(value = {@ApiResponse(code = 200, message = "Game level removed"), -// @ApiResponse(code = 500, message = "Unexpected application error")}) -// public void removeGameLevel(@ApiParam(value = "Game Level ID", required = true) @PathVariable("id") final Long id) { -// taskService.removeTaskLevel(id); -// } -} diff --git a/src/main/java/com/example/demo/domain/AssessmentLevel.java b/src/main/java/com/example/demo/domain/AssessmentLevel.java deleted file mode 100644 index a23406304403812b8de891285f2c5f83c9ec31cf..0000000000000000000000000000000000000000 --- a/src/main/java/com/example/demo/domain/AssessmentLevel.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.example.demo.domain; - - -import javax.persistence.Entity; - -@Entity -public class AssessmentLevel extends BaseLevel { - - private String assessmentType; - - public String getAssessmentType() { - return assessmentType; - } - - public void setAssessmentType(String assessmentType) { - this.assessmentType = assessmentType; - } - - @Override - public String toString() { - return "AssessmentLevel{" + ", assessmentType='" + assessmentType + '\'' + "} " + super.toString(); - } -} diff --git a/src/main/java/com/example/demo/dto/AssessmentLevelDto.java b/src/main/java/com/example/demo/dto/AssessmentLevelDto.java deleted file mode 100644 index e945e7ee104c362b3b0ca8959abe23584d386aa8..0000000000000000000000000000000000000000 --- a/src/main/java/com/example/demo/dto/AssessmentLevelDto.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.example.demo.dto; - -import java.io.Serializable; - -public class AssessmentLevelDto extends BaseLevelDto implements Serializable { - - private Long id; - - private String assessmentType; - - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getAssessmentType() { - return assessmentType; - } - - public void setAssessmentType(String assessmentType) { - this.assessmentType = assessmentType; - } - - @Override - public String toString() { - return "AssessmentLevelDto{" + - "id=" + id + - ", assessmentType='" + assessmentType + '\'' + - "} " + super.toString(); - } -} diff --git a/src/main/java/com/example/demo/dto/input/GameDefinitionCreateDto.java b/src/main/java/com/example/demo/dto/input/GameDefinitionCreateDto.java index 6242cc689fece0b71f5fa55847416a0bb0fa4e05..cee9b750fdb3115986df0854b5e0bdf75dbb0460 100644 --- a/src/main/java/com/example/demo/dto/input/GameDefinitionCreateDto.java +++ b/src/main/java/com/example/demo/dto/input/GameDefinitionCreateDto.java @@ -12,9 +12,6 @@ public class GameDefinitionCreateDto { private Integer order; private PhaseType type; - // assessment level fields - private String assessmentType; - // game level fields private String content; private String flag; @@ -61,14 +58,6 @@ public class GameDefinitionCreateDto { this.type = type; } - public String getAssessmentType() { - return assessmentType; - } - - public void setAssessmentType(String assessmentType) { - this.assessmentType = assessmentType; - } - public String getContent() { return content; } diff --git a/src/main/java/com/example/demo/mapper/BeanMapper.java b/src/main/java/com/example/demo/mapper/BeanMapper.java index 7fda2d039f9792c933d92d93541edb374f977f8d..0aa5e11d982f0cda4fd857b3540aff239931dc68 100644 --- a/src/main/java/com/example/demo/mapper/BeanMapper.java +++ b/src/main/java/com/example/demo/mapper/BeanMapper.java @@ -1,6 +1,5 @@ package com.example.demo.mapper; -import com.example.demo.domain.AssessmentLevel; import com.example.demo.domain.Attachment; import com.example.demo.domain.BaseLevel; import com.example.demo.domain.DecisionMatrixRow; @@ -10,7 +9,6 @@ import com.example.demo.domain.Question; import com.example.demo.domain.QuestionChoice; import com.example.demo.domain.QuestionnaireLevel; import com.example.demo.domain.Task; -import com.example.demo.dto.AssessmentLevelDto; import com.example.demo.dto.AttachmentDto; import com.example.demo.dto.BaseLevelDto; import com.example.demo.dto.DecisionMatrixRowDto; @@ -44,9 +42,7 @@ public interface BeanMapper { default BaseLevelDto toDto(BaseLevel baseLevel) { BaseLevelDto baseLevelDto; - if (baseLevel instanceof AssessmentLevel) { - baseLevelDto = toDto((AssessmentLevel) baseLevel); - } else if (baseLevel instanceof PhaseLevel) { + if (baseLevel instanceof PhaseLevel) { baseLevelDto = toDto((PhaseLevel) baseLevel); } else if (baseLevel instanceof InfoLevel) { baseLevelDto = toDto((InfoLevel) baseLevel); @@ -63,10 +59,6 @@ public interface BeanMapper { List<BaseLevelDto> toDtoList(List<BaseLevel> baseLevel); - AssessmentLevelDto toDto(AssessmentLevel assessmentLevel); - - AssessmentLevel toEntity(AssessmentLevelDto assessmentLevel); - @Mapping(target = "phaseType", constant = "task") TaskDto toDto(Task task); @@ -96,16 +88,12 @@ public interface BeanMapper { PhaseLevel toEntity(PhaseLevelUpdateDto phaseLevelUpdateDto); - AssessmentLevel toAssessmentLevel(GameDefinitionCreateDto gameDefinitionCreateDto); - InfoLevel toInfoLevel(GameDefinitionCreateDto gameDefinitionCreateDto); Task toGameLevel(GameDefinitionCreateDto gameDefinitionCreateDto); PhaseLevel toPhaseLevel(GameDefinitionCreateDto gameDefinitionCreateDto); - AssessmentLevel updateAssessmentLevel(@MappingTarget AssessmentLevel assessmentLevel, GameDefinitionCreateDto gameDefinitionCreateDto); - InfoLevel updateInfoLevel(@MappingTarget InfoLevel infoLevel, GameDefinitionCreateDto gameDefinitionCreateDto); @Mapping(target = "phaseLevel", ignore = true) @@ -116,9 +104,6 @@ public interface BeanMapper { @Mapping(target = "subLevels", ignore = true) PhaseLevel updatePhaseLevel(@MappingTarget PhaseLevel phaseLevel, GameDefinitionCreateDto gameDefinitionCreateDto); -// @Mapping(target = "type", constant = "assessment") - GameDefinitionCreateDto toLevelDefinitionDto(AssessmentLevel assessmentLevel); - // @Mapping(target = "type", constant = "task") GameDefinitionCreateDto toLevelDefinitionDto(Task task); diff --git a/src/main/java/com/example/demo/repository/AssessmentLevelRepository.java b/src/main/java/com/example/demo/repository/AssessmentLevelRepository.java deleted file mode 100644 index 03e454ec1440b7ce757be02e4b694e4a792d4dc2..0000000000000000000000000000000000000000 --- a/src/main/java/com/example/demo/repository/AssessmentLevelRepository.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.example.demo.repository; - -import com.example.demo.domain.AssessmentLevel; -import org.springframework.data.jpa.repository.JpaRepository; - -public interface AssessmentLevelRepository extends JpaRepository<AssessmentLevel, Long> { -} diff --git a/src/main/java/com/example/demo/service/AssessmentLevelService.java b/src/main/java/com/example/demo/service/AssessmentLevelService.java deleted file mode 100644 index 908934c6df3f58f5ebd6355966e7e96d1b36b4de..0000000000000000000000000000000000000000 --- a/src/main/java/com/example/demo/service/AssessmentLevelService.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.example.demo.service; - -import com.example.demo.domain.AssessmentLevel; -import com.example.demo.dto.AssessmentLevelDto; -import com.example.demo.mapper.BeanMapper; -import com.example.demo.repository.AssessmentLevelRepository; -import com.example.demo.repository.BaseLevelRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class AssessmentLevelService { - - @Autowired - private AssessmentLevelRepository assessmentLevelRepository; - - @Autowired - private BaseLevelRepository baseLevelRepository; - - public AssessmentLevelDto createDefaultAssessmentLevel(Long trainingDefinitionId) { - - AssessmentLevel assessmentLevel = new AssessmentLevel(); - assessmentLevel.setTitle("Title of assessment level"); - assessmentLevel.setTrainingDefinitionId(trainingDefinitionId); - assessmentLevel.setOrder(baseLevelRepository.getCurrentMaxOrder(trainingDefinitionId) + 1); - - AssessmentLevel persistedEntity = assessmentLevelRepository.save(assessmentLevel); - - return BeanMapper.INSTANCE.toDto(persistedEntity); - } -} diff --git a/src/main/java/com/example/demo/service/LevelOperationsService.java b/src/main/java/com/example/demo/service/LevelOperationsService.java index bba817c4be28896ff43a0666388c932f3022fb56..146fe087728a858dba1fb9466c6a7849ec9c9308 100644 --- a/src/main/java/com/example/demo/service/LevelOperationsService.java +++ b/src/main/java/com/example/demo/service/LevelOperationsService.java @@ -32,9 +32,6 @@ public class LevelOperationsService { @Autowired private InfoLevelService infoLevelService; - @Autowired - private AssessmentLevelService assessmentLevelService; - @Autowired private QuestionnaireLevelService questionnaireLevelService; diff --git a/src/main/java/com/example/demo/service/QuestionnaireLevelService.java b/src/main/java/com/example/demo/service/QuestionnaireLevelService.java index 0db72a0fbd96568b589637177f5b417ac43a42d7..de5c3a639b760dc5641cadd116325ca61e7ce7ce 100644 --- a/src/main/java/com/example/demo/service/QuestionnaireLevelService.java +++ b/src/main/java/com/example/demo/service/QuestionnaireLevelService.java @@ -1,12 +1,6 @@ package com.example.demo.service; -import com.example.demo.domain.AssessmentLevel; -import com.example.demo.domain.BaseLevel; -import com.example.demo.domain.PhaseLevel; -import com.example.demo.domain.Question; import com.example.demo.domain.QuestionnaireLevel; -import com.example.demo.dto.QuestionDto; -import com.example.demo.dto.QuestionUpdateDto; import com.example.demo.dto.QuestionnaireLevelDto; import com.example.demo.dto.QuestionnaireUpdateDto; import com.example.demo.mapper.BeanMapper; @@ -16,7 +10,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; import java.util.Optional;