Skip to content

Commit

Permalink
Development: Use @OverRide annotation consistently (#8818)
Browse files Browse the repository at this point in the history
  • Loading branch information
Strohgelaender authored Jun 21, 2024
1 parent 62f8c9d commit 6fc9a05
Show file tree
Hide file tree
Showing 60 changed files with 96 additions and 28 deletions.
2 changes: 2 additions & 0 deletions src/main/java/de/tum/in/www1/artemis/domain/Exercise.java
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ public void setExerciseGroup(ExerciseGroup exerciseGroup) {
}

@JsonIgnore
@Override
public boolean isExamExercise() {
return this.exerciseGroup != null;
}
Expand Down Expand Up @@ -455,6 +456,7 @@ public void setPlagiarismDetectionConfig(PlagiarismDetectionConfig plagiarismDet

// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

@Override
public Set<Competency> getCompetencies() {
return competencies;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
public class FileUploadExercise extends Exercise {

// used to distinguish the type when used in collections (e.g. SearchResultPageDTO --> resultsOnPage)
@Override
public String getType() {
return "file-upload";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public class ProgrammingExercise extends Exercise {
// TODO: delete publish_build_plan_url from exercise using liquibase

// used to distinguish the type when used in collections (e.g. SearchResultPageDTO --> resultsOnPage)
@Override
public String getType() {
return "programming";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ public void setCoverageEntries(Set<TestwiseCoverageReportEntry> coverageEntries)
*
* @return a clone of the object.
*/
@Override
public ProgrammingExerciseTestCase clone() {
ProgrammingExerciseTestCase clone = new ProgrammingExerciseTestCase().testName(this.getTestName()).weight(this.getWeight()).active(this.isActive())
.bonusPoints(this.getBonusPoints()).bonusMultiplier(this.getBonusMultiplier()).visibility(visibility).exercise(this.exercise);
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/de/tum/in/www1/artemis/domain/Team.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public Team id(Long id) {
return this;
}

@Override
public String getName() {
return name;
}
Expand All @@ -106,6 +107,7 @@ public void setShortName(String shortName) {
this.shortName = shortName;
}

@Override
public String getParticipantIdentifier() {
return shortName;
}
Expand Down Expand Up @@ -176,24 +178,28 @@ public void setOwner(User owner) {

@JsonIgnore(false)
@JsonProperty
@Override
public String getCreatedBy() {
return super.getCreatedBy();
}

@JsonIgnore(false)
@JsonProperty
@Override
public Instant getCreatedDate() {
return super.getCreatedDate();
}

@JsonIgnore(false)
@JsonProperty
@Override
public String getLastModifiedBy() {
return super.getLastModifiedBy();
}

@JsonIgnore(false)
@JsonProperty
@Override
public Instant getLastModifiedDate() {
return super.getLastModifiedDate();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
public class TextExercise extends Exercise {

// used to distinguish the type when used in collections (e.g. SearchResultPageDTO --> resultsOnPage)
@Override
public String getType() {
return "text";
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/de/tum/in/www1/artemis/domain/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ public void setLogin(String login) {
this.login = StringUtils.lowerCase(login, Locale.ENGLISH);
}

@Override
public String getParticipantIdentifier() {
return login;
}
Expand Down Expand Up @@ -288,6 +289,7 @@ public void setLastName(String lastName) {
/**
* @return name as a concatenation of first name and last name
*/
@Override
public String getName() {
if (lastName != null && !lastName.isEmpty()) {
return firstName + " " + lastName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public void setReleaseDate(ZonedDateTime releaseDate) {
this.releaseDate = releaseDate;
}

@Override
public Set<Competency> getCompetencies() {
return competencies;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
public class ModelingExercise extends Exercise {

// used to distinguish the type when used in collections (e.g. SearchResultPageDTO --> resultsOnPage)
@Override
public String getType() {
return "modeling";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public String toString() {
*
* @return true if the submission is empty, false otherwise
*/
@Override
public boolean isEmpty() {
return isEmpty(new ObjectMapper());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public void setElementId(String elementId) {
this.elementId = elementId;
}

@Override
public String getElementId() {
return elementId;
}
Expand All @@ -20,6 +21,7 @@ public void setNumberOfOtherElements(Long numberOfOtherElements) {
this.numberOfOtherElements = numberOfOtherElements;
}

@Override
public Long getNumberOfOtherElements() {
return numberOfOtherElements;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,22 @@ public abstract class AbstractBaseProgrammingExerciseParticipation extends Parti
@JsonView(QuizView.Before.class)
private String buildPlanId;

@Override
public String getRepositoryUri() {
return repositoryUri;
}

@Override
public void setRepositoryUri(String repositoryUri) {
this.repositoryUri = repositoryUri;
}

@Override
public String getBuildPlanId() {
return buildPlanId;
}

@Override
public void setBuildPlanId(String buildPlanId) {
this.buildPlanId = buildPlanId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public void setSubmissionCount(Integer submissionCount) {
this.submissionCountTransient = submissionCount;
}

@Override
public InitializationState getInitializationState() {
return initializationState;
}
Expand All @@ -140,10 +141,12 @@ public Participation initializationState(InitializationState initializationState
return this;
}

@Override
public void setInitializationState(InitializationState initializationState) {
this.initializationState = initializationState;
}

@Override
public ZonedDateTime getInitializationDate() {
return initializationDate;
}
Expand All @@ -153,14 +156,17 @@ public Participation initializationDate(ZonedDateTime initializationDate) {
return this;
}

@Override
public void setInitializationDate(ZonedDateTime initializationDate) {
this.initializationDate = initializationDate;
}

@Override
public ZonedDateTime getIndividualDueDate() {
return individualDueDate;
}

@Override
public void setIndividualDueDate(ZonedDateTime individualDueDate) {
this.individualDueDate = individualDueDate;
}
Expand Down Expand Up @@ -201,6 +207,7 @@ public Participation results(Set<Result> results) {
return this;
}

@Override
public void addResult(Result result) {
this.results.add(result);
result.setParticipation(this);
Expand All @@ -215,6 +222,7 @@ public void setResults(Set<Result> results) {
this.results = results;
}

@Override
public Set<Submission> getSubmissions() {
return submissions;
}
Expand All @@ -224,6 +232,7 @@ public Participation submissions(Set<Submission> submissions) {
return this;
}

@Override
public void addSubmission(Submission submission) {
this.submissions.add(submission);
submission.setParticipation(this);
Expand Down Expand Up @@ -289,6 +298,7 @@ private Result findLatestResult(boolean filterIllegalResults) {
* @param <T> submission type
* @return the latest submission or null
*/
@Override
public <T extends Submission> Optional<T> findLatestSubmission() {
return findLatestSubmission(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,22 @@ public ProgrammingExerciseStudentParticipation(String branch) {
this.branch = branch;
}

@Override
public String getRepositoryUri() {
return repositoryUri;
}

@Override
public void setRepositoryUri(String repositoryUri) {
this.repositoryUri = repositoryUri;
}

@Override
public String getBuildPlanId() {
return buildPlanId;
}

@Override
public void setBuildPlanId(String buildPlanId) {
this.buildPlanId = buildPlanId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public String getParticipantName() {
return Optional.ofNullable(getParticipant()).map(Participant::getName).orElse(null);
}

@Override
public Exercise getExercise() {
return exercise;
}
Expand All @@ -106,6 +107,7 @@ public StudentParticipation exercise(Exercise exercise) {
return this;
}

@Override
public void setExercise(Exercise exercise) {
this.exercise = exercise;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public MultipleChoiceQuestion getQuestion() {
return question;
}

@Override
public void setQuestion(MultipleChoiceQuestion multipleChoiceQuestion) {
this.question = multipleChoiceQuestion;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public DragAndDropQuestion getQuestion() {
return question;
}

@Override
public void setQuestion(DragAndDropQuestion dragAndDropQuestion) {
this.question = dragAndDropQuestion;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ public DropLocation findDropLocationById(Long dropLocationId) {
*
* @param originalQuizQuestion the original QuizQuestion-object, which will be compared with this question
*/
@Override
public void undoUnallowedChanges(QuizQuestion originalQuizQuestion) {
if (originalQuizQuestion instanceof DragAndDropQuestion dndOriginalQuestion) {
backgroundFilePath = dndOriginalQuestion.getBackgroundFilePath();
Expand Down Expand Up @@ -335,6 +336,7 @@ private void undoUnallowedDropLocationChanges(DragAndDropQuestion originalQuesti
* @param originalQuizQuestion the original QuizQuestion-object, which will be compared with this question
* @return a boolean which is true if the dragItem and dropLocation-changes make an update necessary and false if not
*/
@Override
public boolean isUpdateOfResultsAndStatisticsNecessary(QuizQuestion originalQuizQuestion) {
if (originalQuizQuestion instanceof DragAndDropQuestion dndOriginalQuestion) {
return checkDragItemsIfRecalculationIsNecessary(dndOriginalQuestion) || checkDropLocationsIfRecalculationIsNecessary(dndOriginalQuestion)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ private void checkAndDeleteMappings(DragAndDropQuestion question) {
*
* @param quizExercise the changed quizExercise-object
*/
@Override
public void checkAndDeleteReferences(QuizExercise quizExercise) {

// Delete all references to question, dropLocations and dragItem if the question was deleted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public Boolean isInvalid() {
return invalid != null && invalid;
}

@Override
public void setQuestion(DragAndDropQuestion dragAndDropQuestion) {
this.question = dragAndDropQuestion;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public Boolean isInvalid() {
return invalid != null && invalid;
}

@Override
public void setQuestion(DragAndDropQuestion dragAndDropQuestion) {
this.question = dragAndDropQuestion;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public AnswerOption findAnswerOptionById(Long answerOptionId) {
*
* @param originalQuizQuestion the original QuizQuestion-object, which will be compared with this question
*/
@Override
public void undoUnallowedChanges(QuizQuestion originalQuizQuestion) {
if (originalQuizQuestion instanceof MultipleChoiceQuestion mcOriginalQuestion) {
undoUnallowedAnswerChanges(mcOriginalQuestion);
Expand Down Expand Up @@ -131,6 +132,7 @@ private void undoUnallowedAnswerChanges(MultipleChoiceQuestion originalQuestion)
* @param originalQuizQuestion the original QuizQuestion-object, which will be compared with this question
* @return a boolean which is true if the answer-changes make an update necessary and false if not
*/
@Override
public boolean isUpdateOfResultsAndStatisticsNecessary(QuizQuestion originalQuizQuestion) {
if (originalQuizQuestion instanceof MultipleChoiceQuestion mcOriginalQuestion) {
return checkAnswersIfRecalculationIsNecessary(mcOriginalQuestion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ private void checkAndDeleteSelectedOptions(MultipleChoiceQuestion question) {
*
* @param quizExercise the changed quizExercise-object
*/
@Override
public void checkAndDeleteReferences(QuizExercise quizExercise) {

if (!quizExercise.getQuizQuestions().contains(getQuizQuestion())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class QuizExercise extends Exercise implements QuizConfiguration {

// used to distinguish the type when used in collections (e.g. SearchResultPageDTO --> resultsOnPage)
@JsonView(QuizView.Before.class)
@Override
public String getType() {
return "quiz";
}
Expand Down Expand Up @@ -240,6 +241,7 @@ public boolean isValid() {
return true;
}

@Override
public List<QuizQuestion> getQuizQuestions() {
return quizQuestions;
}
Expand Down Expand Up @@ -621,6 +623,7 @@ public void setQuestionParent(QuizQuestion quizQuestion) {
/**
* Recreate missing pointers from children to parents that were removed by @JSONIgnore
*/
@Override
public void reconnectJSONIgnoreAttributes() {
QuizConfiguration.super.reconnectJSONIgnoreAttributes();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ public void removeOldResult(Double score, Boolean rated) {
* @param countChange the int-value, which will be added to the Counter and participants
*/
private void changeStatisticBasedOnResult(double score, Boolean rated, int countChange) {
/**
* {@link RoundingUtil#roundScoreSpecifiedByCourseSettings}
* is not applicable here, as we need to sort the points into existing integer buckets
/*
* RoundingUtil#roundScoreSpecifiedByCourseSettings is not applicable here,
* as we need to sort the points into existing integer buckets
*/
double points = Math.round(quiz.getOverallQuizPoints() * (score / 100));

Expand Down
Loading

0 comments on commit 6fc9a05

Please sign in to comment.