Skip to content
Snippets Groups Projects
Commit 0a7d79e9 authored by Jan Tymel's avatar Jan Tymel
Browse files

Add swagger doc to DTOs where it was missing, remove unused classes

parent a153c4a3
No related branches found
No related tags found
No related merge requests found
Showing
with 63 additions and 112 deletions
package cz.muni.ics.kypo.training.adaptive.dto; package cz.muni.ics.kypo.training.adaptive.dto;
import cz.muni.ics.kypo.training.adaptive.enums.PhaseType; import cz.muni.ics.kypo.training.adaptive.enums.PhaseType;
import io.swagger.annotations.ApiModelProperty;
public abstract class AbstractPhaseDTO { public abstract class AbstractPhaseDTO {
@ApiModelProperty(value = "ID of task", required = true, example = "1")
private Long id; private Long id;
@ApiModelProperty(value = "Short description of phase", required = true, example = "Training Phase 1")
private String title; private String title;
@ApiModelProperty(value = "Order of phase in a training definition", required = true, example = "1")
private Integer order; private Integer order;
@ApiModelProperty(value = "Type of phase", required = true, allowableValues = "QUESTIONNAIRE,INFO,TRAINING", example = "TRAINING")
private PhaseType phaseType; private PhaseType phaseType;
public Long getId() { public Long getId() {
......
package cz.muni.ics.kypo.training.adaptive.dto.info; package cz.muni.ics.kypo.training.adaptive.dto.info;
import cz.muni.ics.kypo.training.adaptive.dto.AbstractPhaseDTO; import cz.muni.ics.kypo.training.adaptive.dto.AbstractPhaseDTO;
import io.swagger.annotations.ApiModelProperty;
public class InfoPhaseDTO extends AbstractPhaseDTO { public class InfoPhaseDTO extends AbstractPhaseDTO {
@ApiModelProperty(value = "Short description of info phase", required = true, example = "Info phase title")
private String content; private String content;
public String getContent() { public String getContent() {
......
package cz.muni.ics.kypo.training.adaptive.dto.questionnaire;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
public class QuestionRequiredIdDTO extends AbstractQuestionDTO {
@ApiModelProperty(value = "Question ID. Leave blank if a new question is added", required = true, example = "1")
@NotNull(message = "Question ID must be specified")
private Long id;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
package cz.muni.ics.kypo.training.adaptive.dto.questionnaire;
import cz.muni.ics.kypo.training.adaptive.enums.QuestionType;
import java.util.List;
public class QuestionUpdateDTO {
private Long id;
private QuestionType questionType;
private String text;
private Integer points;
private Integer penalty;
private boolean required;
private List<Long> relatedPhasesId;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public QuestionType getQuestionType() {
return questionType;
}
public void setQuestionType(QuestionType questionType) {
this.questionType = questionType;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public Integer getPoints() {
return points;
}
public void setPoints(Integer points) {
this.points = points;
}
public Integer getPenalty() {
return penalty;
}
public void setPenalty(Integer penalty) {
this.penalty = penalty;
}
public boolean isRequired() {
return required;
}
public void setRequired(boolean required) {
this.required = required;
}
public List<Long> getRelatedPhasesId() {
return relatedPhasesId;
}
public void setRelatedPhasesId(List<Long> relatedPhasesId) {
this.relatedPhasesId = relatedPhasesId;
}
@Override
public String toString() {
return "QuestionUpdateDto{" +
"id=" + id +
", questionType=" + questionType +
", text='" + text + '\'' +
", points=" + points +
", penalty=" + penalty +
", required=" + required +
", relatedPhasesId=" + relatedPhasesId +
'}';
}
}
...@@ -2,13 +2,19 @@ package cz.muni.ics.kypo.training.adaptive.dto.questionnaire; ...@@ -2,13 +2,19 @@ package cz.muni.ics.kypo.training.adaptive.dto.questionnaire;
import cz.muni.ics.kypo.training.adaptive.dto.AbstractPhaseDTO; import cz.muni.ics.kypo.training.adaptive.dto.AbstractPhaseDTO;
import cz.muni.ics.kypo.training.adaptive.enums.QuestionnaireType; import cz.muni.ics.kypo.training.adaptive.enums.QuestionnaireType;
import io.swagger.annotations.ApiModelProperty;
import java.util.List; import java.util.List;
public class QuestionnairePhaseDTO extends AbstractPhaseDTO { public class QuestionnairePhaseDTO extends AbstractPhaseDTO {
@ApiModelProperty(value = "List of questions associated with the questionnaire phase")
private List<QuestionDTO> questions; private List<QuestionDTO> questions;
@ApiModelProperty(value = "Type of questionnaire phase", allowableValues = "ADAPTIVE,GENERAL", example = "ADAPTIVE")
private QuestionnaireType questionnaireType; private QuestionnaireType questionnaireType;
@ApiModelProperty(value = "List of relations between questions and a training phase")
private List<QuestionPhaseRelationDTO> phaseRelations; private List<QuestionPhaseRelationDTO> phaseRelations;
public List<QuestionDTO> getQuestions() { public List<QuestionDTO> getQuestions() {
......
package cz.muni.ics.kypo.training.adaptive.dto.training; package cz.muni.ics.kypo.training.adaptive.dto.training;
import io.swagger.annotations.ApiModelProperty;
public class DecisionMatrixRowDTO { public class DecisionMatrixRowDTO {
@ApiModelProperty(value = "ID of decision matrix row", required = true, example = "1")
private long id; private long id;
@ApiModelProperty(value = "Order of row in a decision matrix", required = true, example = "1")
private int order; private int order;
@ApiModelProperty(value = "It determines how important the answers of the questions in questionnaires are", required = true, example = "0.5")
private double assessmentAnswered; private double assessmentAnswered;
@ApiModelProperty(value = "It determines how important it is whether the player used the keyword", required = true, example = "0.5")
private double keywordUsed; private double keywordUsed;
@ApiModelProperty(value = "It determines how important it is whether the player completed the task in time", required = true, example = "0.5")
private double completedInTime; private double completedInTime;
@ApiModelProperty(value = "It determines how important it is whether the player displayed the solution of the task they were solving", required = true, example = "0.5")
private double solutionDisplayed; private double solutionDisplayed;
@ApiModelProperty(value = "It determines how important the number of wrong answers are", required = true, example = "0.5")
private double wrongAnswers; private double wrongAnswers;
public long getId() { public long getId() {
......
package cz.muni.ics.kypo.training.adaptive.dto.training; package cz.muni.ics.kypo.training.adaptive.dto.training;
import io.swagger.annotations.ApiModelProperty;
public class TaskDTO { public class TaskDTO {
@ApiModelProperty(value = "ID of task", required = true, example = "1")
private Long id; private Long id;
@ApiModelProperty(value = "Short description of task", required = true, example = "Task title")
private String title; private String title;
@ApiModelProperty(value = "Order of task in the training phase", required = true, example = "1")
private Integer order; private Integer order;
@ApiModelProperty(value = "The information that are displayed to a player", required = true, example = "Capture the flag")
private String content; private String content;
@ApiModelProperty(value = "Keyword that must be found in the task. Necessary in order to get to the next phase", required = true, example = "secretFlag")
private String answer; private String answer;
@ApiModelProperty(value = "Description how to get the answer", required = true, example = "Open secret.txt")
private String solution; private String solution;
@ApiModelProperty(value = "It defines the allowed number of incorrect answers submitted by the player", required = true, example = "5")
private int incorrectAnswerLimit; private int incorrectAnswerLimit;
@ApiModelProperty(value = "It defines whether the sandbox can be modified", example = "true")
private boolean modifySandbox; private boolean modifySandbox;
@ApiModelProperty(value = "It defines the expected duration of sandbox change defined in seconds", example = "15")
private int sandboxChangeExpectedDuration; private int sandboxChangeExpectedDuration;
public Long getId() { public Long getId() {
......
package cz.muni.ics.kypo.training.adaptive.dto.training; package cz.muni.ics.kypo.training.adaptive.dto.training;
import cz.muni.ics.kypo.training.adaptive.dto.AbstractPhaseDTO; import cz.muni.ics.kypo.training.adaptive.dto.AbstractPhaseDTO;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class TrainingPhaseDTO extends AbstractPhaseDTO { public class TrainingPhaseDTO extends AbstractPhaseDTO {
@ApiModelProperty(value = "Estimated time (minutes) taken by the player to solve the training phase", example = "20")
private int estimatedDuration; private int estimatedDuration;
@ApiModelProperty(value = "Maximal number of allowed commands provided by played", required = true, example = "10")
private int allowedCommands; private int allowedCommands;
@ApiModelProperty(value = "Maximal number of allowed wrong answers provided by played", required = true, example = "10")
private int allowedWrongAnswers; private int allowedWrongAnswers;
@ApiModelProperty(value = "Tasks associated with the training phase", required = true)
private List<TaskDTO> tasks = new ArrayList<>(); private List<TaskDTO> tasks = new ArrayList<>();
@ApiModelProperty(value = "Decision matrix associated with the training phase", required = true)
private List<DecisionMatrixRowDTO> decisionMatrix; private List<DecisionMatrixRowDTO> decisionMatrix;
public int getEstimatedDuration() { public int getEstimatedDuration() {
......
...@@ -21,9 +21,11 @@ public class TrainingPhaseUpdateDTO { ...@@ -21,9 +21,11 @@ public class TrainingPhaseUpdateDTO {
private Integer allowedCommands; private Integer allowedCommands;
@ApiModelProperty(value = "Estimated time (minutes) taken by the player to solve the training phase", example = "20") @ApiModelProperty(value = "Estimated time (minutes) taken by the player to solve the training phase", example = "20")
@NotNull(message = "Estimated duration of phase task must be set") @NotNull(message = "Estimated duration of training phase must be set")
private Integer estimatedDuration; private Integer estimatedDuration;
@ApiModelProperty(value = "Decision matrix associated with the training phase", required = true)
@NotNull(message = "Decision matrix of training phase must be set")
private List<DecisionMatrixRowDTO> decisionMatrix; private List<DecisionMatrixRowDTO> decisionMatrix;
public String getTitle() { public String getTitle() {
......
...@@ -15,8 +15,6 @@ import cz.muni.ics.kypo.training.adaptive.dto.info.InfoPhaseUpdateDTO; ...@@ -15,8 +15,6 @@ import cz.muni.ics.kypo.training.adaptive.dto.info.InfoPhaseUpdateDTO;
import cz.muni.ics.kypo.training.adaptive.dto.questionnaire.QuestionChoiceDTO; import cz.muni.ics.kypo.training.adaptive.dto.questionnaire.QuestionChoiceDTO;
import cz.muni.ics.kypo.training.adaptive.dto.questionnaire.QuestionDTO; import cz.muni.ics.kypo.training.adaptive.dto.questionnaire.QuestionDTO;
import cz.muni.ics.kypo.training.adaptive.dto.questionnaire.QuestionPhaseRelationDTO; import cz.muni.ics.kypo.training.adaptive.dto.questionnaire.QuestionPhaseRelationDTO;
import cz.muni.ics.kypo.training.adaptive.dto.questionnaire.QuestionRequiredIdDTO;
import cz.muni.ics.kypo.training.adaptive.dto.questionnaire.QuestionUpdateDTO;
import cz.muni.ics.kypo.training.adaptive.dto.questionnaire.QuestionnairePhaseDTO; import cz.muni.ics.kypo.training.adaptive.dto.questionnaire.QuestionnairePhaseDTO;
import cz.muni.ics.kypo.training.adaptive.dto.questionnaire.QuestionnaireUpdateDTO; import cz.muni.ics.kypo.training.adaptive.dto.questionnaire.QuestionnaireUpdateDTO;
import cz.muni.ics.kypo.training.adaptive.dto.training.DecisionMatrixRowDTO; import cz.muni.ics.kypo.training.adaptive.dto.training.DecisionMatrixRowDTO;
...@@ -84,10 +82,6 @@ public interface BeanMapper { ...@@ -84,10 +82,6 @@ public interface BeanMapper {
Question toEntity(QuestionDTO questionDto); Question toEntity(QuestionDTO questionDto);
Question toEntity(QuestionRequiredIdDTO questionDto);
Question toEntity(QuestionUpdateDTO questionUpdateDto);
QuestionDTO toDto(Question question); QuestionDTO toDto(Question question);
@Mapping(target = "questionPhaseRelations", source = "phaseRelations") @Mapping(target = "questionPhaseRelations", source = "phaseRelations")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment