diff --git a/src/main/java/edu/kit/kastel/sdq/artemis4j/client/FeedbackDTO.java b/src/main/java/edu/kit/kastel/sdq/artemis4j/client/FeedbackDTO.java index 5f82539..775ef22 100644 --- a/src/main/java/edu/kit/kastel/sdq/artemis4j/client/FeedbackDTO.java +++ b/src/main/java/edu/kit/kastel/sdq/artemis4j/client/FeedbackDTO.java @@ -14,10 +14,10 @@ * @param credits credits given to the student, may be negative * @param positive null for manual feedback * @param visibility null for manual feedback - * @param text null for unreferenced manual & automatic feedback, + * @param text null for unreferenced manual & automatic feedback, * of form "File * src/edu/kit/informatik/BubbleSort.java at line 13" - * @param reference null for unreferenced manual & automatic feedback, + * @param reference null for unreferenced manual & automatic feedback, * of form * "file:src/edu/kit/informatik/BubbleSort.java_line:12" * @param detailText null for automatic feedback diff --git a/src/main/java/edu/kit/kastel/sdq/artemis4j/grading/Annotation.java b/src/main/java/edu/kit/kastel/sdq/artemis4j/grading/Annotation.java index 0e9bba3..fd42099 100644 --- a/src/main/java/edu/kit/kastel/sdq/artemis4j/grading/Annotation.java +++ b/src/main/java/edu/kit/kastel/sdq/artemis4j/grading/Annotation.java @@ -12,7 +12,7 @@ /** * A single annotation as part of an assessment. Annotations may be manually * created, or generated by tools. Annotations may not be created for tests that - * are executed by Artemis. + * are executed by Artemis. Annotations must always be created via an active assessment's methods. */ public final class Annotation { private final String uuid; @@ -24,6 +24,12 @@ public final class Annotation { private final Double customScore; private final AnnotationSource source; + /** + * Deserializes an annotation from its metajson format + * + * @param dto + * @param mistakeType + */ public Annotation(AnnotationDTO dto, MistakeType mistakeType) { this.uuid = dto.uuid(); this.type = mistakeType; @@ -58,6 +64,11 @@ public Annotation(AnnotationDTO dto, MistakeType mistakeType) { this.source = source; } + /** + * Uniquely identifies this annotation + * + * @return + */ public String getUUID() { return uuid; } @@ -66,30 +77,66 @@ public MistakeType getMistakeType() { return type; } + /** + * The path of the file this annotation is associated with, including its file ending + * + * @return + */ public String getFilePath() { return filePath; } + /** + * The path of the file this annotation is associated with, excluding its file ending + * + * @return + */ public String getFilePathWithoutType() { return this.filePath.replace(".java", ""); } + /** + * The line in the file where this annotation starts (0-based) + * + * @return + */ public int getStartLine() { return startLine; } + /** + * The line in the file where this annotation starts (1-based, for display to the user e.g. in Artemis) + * + * @return + */ public int getDisplayLine() { return startLine + 1; } + /** + * The line in the file where this annotation ends (0-based) + * + * @return + */ public int getEndLine() { return endLine; } + /** + * The custom message associated with this message, if any. Is never empty for custom annotations. + * + * @return + */ public Optional getCustomMessage() { return Optional.ofNullable(customMessage); } + /** + * The custom score associated with this message, if any. Is always empty for predefined annotations, + * and never empty for custom annotations. + * + * @return + */ public Optional getCustomScore() { return Optional.ofNullable(customScore); } @@ -98,6 +145,11 @@ public AnnotationSource getSource() { return source; } + /** + * Serializes this annotation to its metajson format + * + * @return + */ public AnnotationDTO toDTO() { return new AnnotationDTO(uuid, type.getId(), startLine, endLine, filePath, customMessage, customScore, source); } diff --git a/src/main/java/edu/kit/kastel/sdq/artemis4j/grading/Assessment.java b/src/main/java/edu/kit/kastel/sdq/artemis4j/grading/Assessment.java index 5555b88..836b138 100644 --- a/src/main/java/edu/kit/kastel/sdq/artemis4j/grading/Assessment.java +++ b/src/main/java/edu/kit/kastel/sdq/artemis4j/grading/Assessment.java @@ -28,7 +28,7 @@ /** * An active assessment of a submission for which we hold a lock. This class - * stores annotations, calculates points, and parses & serializes feedbacks for + * stores annotations, calculates points, and parses & serializes feedbacks for * Artemis. */ public class Assessment extends ArtemisConnectionHolder { diff --git a/src/main/java/edu/kit/kastel/sdq/artemis4j/grading/metajson/AnnotationMappingException.java b/src/main/java/edu/kit/kastel/sdq/artemis4j/grading/metajson/AnnotationMappingException.java index 22102ec..860c0f5 100644 --- a/src/main/java/edu/kit/kastel/sdq/artemis4j/grading/metajson/AnnotationMappingException.java +++ b/src/main/java/edu/kit/kastel/sdq/artemis4j/grading/metajson/AnnotationMappingException.java @@ -3,6 +3,9 @@ import edu.kit.kastel.sdq.artemis4j.ArtemisClientException; +/** + * Exception thrown when an error occurs during the mapping of annotations to meta feedback and vice versa. + */ public class AnnotationMappingException extends ArtemisClientException { public AnnotationMappingException(String message) { super(message);