From 611e77de9c5b0b78e7bb3b9acd18689e2ca5c964 Mon Sep 17 00:00:00 2001 From: Lucas Welscher Date: Tue, 13 Feb 2024 13:45:17 +0100 Subject: [PATCH] don't use boxed types --- .../ProgrammingExerciseRepository.java | 62 +++++++++---------- ...xerciseStudentParticipationRepository.java | 42 ++++++------- ...ProgrammingExerciseTestCaseRepository.java | 16 ++--- .../ProgrammingSubmissionRepository.java | 22 +++---- ...ammingExerciseParticipationRepository.java | 12 ++-- .../StaticCodeAnalysisCategoryRepository.java | 4 +- ...ammingExerciseParticipationRepository.java | 12 ++-- 7 files changed, 85 insertions(+), 85 deletions(-) diff --git a/src/main/java/de/tum/in/www1/artemis/repository/ProgrammingExerciseRepository.java b/src/main/java/de/tum/in/www1/artemis/repository/ProgrammingExerciseRepository.java index 4a836cbbf32a..ded41eeb0b3e 100644 --- a/src/main/java/de/tum/in/www1/artemis/repository/ProgrammingExerciseRepository.java +++ b/src/main/java/de/tum/in/www1/artemis/repository/ProgrammingExerciseRepository.java @@ -53,42 +53,42 @@ public interface ProgrammingExerciseRepository extends JpaRepository findByCourseIdWithLatestResultForTemplateSolutionParticipations(@Param("courseId") Long courseId); + List findByCourseIdWithLatestResultForTemplateSolutionParticipations(@Param("courseId") long courseId); @EntityGraph(type = LOAD, attributePaths = { "templateParticipation", "solutionParticipation", "teamAssignmentConfig", "categories", "auxiliaryRepositories", "submissionPolicy" }) - Optional findWithTemplateAndSolutionParticipationTeamAssignmentConfigCategoriesById(Long exerciseId); + Optional findWithTemplateAndSolutionParticipationTeamAssignmentConfigCategoriesById(long exerciseId); @EntityGraph(type = LOAD, attributePaths = { "templateParticipation", "solutionParticipation", "teamAssignmentConfig", "categories", "competencies", "auxiliaryRepositories", "submissionPolicy" }) - Optional findWithTemplateAndSolutionParticipationTeamAssignmentConfigCategoriesAndCompetenciesById(Long exerciseId); + Optional findWithTemplateAndSolutionParticipationTeamAssignmentConfigCategoriesAndCompetenciesById(long exerciseId); @EntityGraph(type = LOAD, attributePaths = { "templateParticipation", "solutionParticipation", "teamAssignmentConfig", "categories", "competencies", "auxiliaryRepositories", "submissionPolicy", "plagiarismDetectionConfig" }) - Optional findWithTemplateAndSolutionParticipationTeamAssignmentConfigCategoriesAndCompetenciesAndPlagiarismDetectionConfigById(Long exerciseId); + Optional findWithTemplateAndSolutionParticipationTeamAssignmentConfigCategoriesAndCompetenciesAndPlagiarismDetectionConfigById(long exerciseId); @EntityGraph(type = LOAD, attributePaths = { "templateParticipation", "solutionParticipation", "auxiliaryRepositories" }) - Optional findWithTemplateAndSolutionParticipationAndAuxiliaryRepositoriesById(Long exerciseId); + Optional findWithTemplateAndSolutionParticipationAndAuxiliaryRepositoriesById(long exerciseId); @EntityGraph(type = LOAD, attributePaths = { "templateParticipation", "solutionParticipation" }) - Optional findWithTemplateAndSolutionParticipationById(Long exerciseId); + Optional findWithTemplateAndSolutionParticipationById(long exerciseId); @EntityGraph(type = LOAD, attributePaths = { "categories", "teamAssignmentConfig", "templateParticipation.submissions.results", "solutionParticipation.submissions.results", "auxiliaryRepositories" }) - Optional findWithTemplateAndSolutionParticipationSubmissionsAndResultsAndAuxiliaryRepositoriesById(Long exerciseId); + Optional findWithTemplateAndSolutionParticipationSubmissionsAndResultsAndAuxiliaryRepositoriesById(long exerciseId); @EntityGraph(type = LOAD, attributePaths = { "categories", "teamAssignmentConfig", "templateParticipation.submissions.results", "solutionParticipation.submissions.results", "auxiliaryRepositories", "plagiarismDetectionConfig", "buildPlanConfiguration", "buildScript", "templateParticipation", "solutionParticipation" }) - Optional findForCreationById(Long exerciseId); + Optional findForCreationById(long exerciseId); @EntityGraph(type = LOAD, attributePaths = "testCases") - Optional findWithTestCasesById(Long exerciseId); + Optional findWithTestCasesById(long exerciseId); @EntityGraph(type = LOAD, attributePaths = "auxiliaryRepositories") - Optional findWithAuxiliaryRepositoriesById(Long exerciseId); + Optional findWithAuxiliaryRepositoriesById(long exerciseId); @EntityGraph(type = LOAD, attributePaths = "submissionPolicy") - Optional findWithSubmissionPolicyById(Long exerciseId); + Optional findWithSubmissionPolicyById(long exerciseId); List findAllByProjectKey(String projectKey); @@ -142,7 +142,7 @@ default ProgrammingExercise findOneByProjectKeyOrThrow(String projectKey, boolea AND (tpr.id = (SELECT MAX(re1.id) FROM tp.results re1) OR tpr.id IS NULL) AND (spr.id = (SELECT MAX(re2.id) FROM sp.results re2) OR spr.id IS NULL) """) - Optional findWithTemplateAndSolutionParticipationLatestResultFeedbackTestCasesById(@Param("exerciseId") Long exerciseId); + Optional findWithTemplateAndSolutionParticipationLatestResultFeedbackTestCasesById(@Param("exerciseId") long exerciseId); /** * Get all programming exercises that need to be scheduled: Those must satisfy one of the following requirements: @@ -224,10 +224,10 @@ default ProgrammingExercise findOneByProjectKeyOrThrow(String projectKey, boolea LEFT JOIN FETCH pe.solutionParticipation WHERE pe.id = :exerciseId """) - Optional findWithEagerTemplateAndSolutionParticipationsById(@Param("exerciseId") Long exerciseId); + Optional findWithEagerTemplateAndSolutionParticipationsById(@Param("exerciseId") long exerciseId); @EntityGraph(type = LOAD, attributePaths = { "studentParticipations", "studentParticipations.team", "studentParticipations.team.students" }) - Optional findWithEagerStudentParticipationsById(Long exerciseId); + Optional findWithEagerStudentParticipationsById(long exerciseId); @Query(""" SELECT pe @@ -240,10 +240,10 @@ default ProgrammingExercise findOneByProjectKeyOrThrow(String projectKey, boolea WHERE pe.id = :exerciseId AND (s.type <> de.tum.in.www1.artemis.domain.enumeration.SubmissionType.ILLEGAL OR s.type IS NULL) """) - Optional findWithEagerStudentParticipationsStudentAndLegalSubmissionsById(@Param("exerciseId") Long exerciseId); + Optional findWithEagerStudentParticipationsStudentAndLegalSubmissionsById(@Param("exerciseId") long exerciseId); @EntityGraph(type = LOAD, attributePaths = { "templateParticipation", "solutionParticipation", "studentParticipations.team.students" }) - Optional findWithAllParticipationsById(Long exerciseId); + Optional findWithAllParticipationsById(long exerciseId); @Query(""" SELECT pe @@ -253,7 +253,7 @@ default ProgrammingExercise findOneByProjectKeyOrThrow(String projectKey, boolea OR pe.templateParticipation.id = :participationId OR pe.solutionParticipation.id = :participationId """) - Optional findByParticipationId(@Param("participationId") Long participationId); + Optional findByParticipationId(@Param("participationId") long participationId); default ProgrammingExercise findByParticipationIdOrElseThrow(long participationId) throws EntityNotFoundException { return findByParticipationId(participationId) @@ -267,7 +267,7 @@ default ProgrammingExercise findByParticipationIdOrElseThrow(long participationI LEFT JOIN FETCH pe.templateParticipation tp WHERE pep.id = :participationId """) - Optional findByStudentParticipationIdWithTemplateParticipation(@Param("participationId") Long participationId); + Optional findByStudentParticipationIdWithTemplateParticipation(@Param("participationId") long participationId); @Query(""" SELECT p @@ -281,7 +281,7 @@ default ProgrammingExercise findByParticipationIdOrElseThrow(long participationI LEFT JOIN FETCH tc.solutionEntries WHERE p.id = :exerciseId """) - Optional findByIdWithEagerTestCasesStaticCodeAnalysisCategoriesHintsAndTemplateAndSolutionParticipationsAndAuxRepos(@Param("exerciseId") Long exerciseId); + Optional findByIdWithEagerTestCasesStaticCodeAnalysisCategoriesHintsAndTemplateAndSolutionParticipationsAndAuxRepos(@Param("exerciseId") long exerciseId); /** * Returns all programming exercises that have a due date after {@code now} and have tests marked with @@ -333,7 +333,7 @@ SELECT COUNT (DISTINCT p) AND s.submitted = TRUE AND (s.type <> de.tum.in.www1.artemis.domain.enumeration.SubmissionType.ILLEGAL OR s.type IS NULL) """) - long countLegalSubmissionsByExerciseIdSubmittedIgnoreTestRunSubmissions(@Param("exerciseId") Long exerciseId); + long countLegalSubmissionsByExerciseIdSubmittedIgnoreTestRunSubmissions(@Param("exerciseId") long exerciseId); /** * In distinction to other exercise types, students can have multiple submissions in a programming exercise. @@ -377,7 +377,7 @@ SELECT COUNT (DISTINCT p) AND r.assessor IS NOT NULL AND r.completionDate IS NOT NULL """) - long countAssessmentsByExerciseIdSubmittedIgnoreTestRunSubmissions(@Param("exerciseId") Long exerciseId); + long countAssessmentsByExerciseIdSubmittedIgnoreTestRunSubmissions(@Param("exerciseId") long exerciseId); /** * In distinction to other exercise types, students can have multiple submissions in a programming exercise. @@ -396,7 +396,7 @@ SELECT COUNT (DISTINCT p) AND s IS NOT EMPTY AND (s.type <> de.tum.in.www1.artemis.domain.enumeration.SubmissionType.ILLEGAL OR s.type IS NULL) """) - long countLegalSubmissionsByExamIdSubmitted(@Param("examId") Long examId); + long countLegalSubmissionsByExamIdSubmitted(@Param("examId") long examId); /** * In distinction to other exercise types, students can have multiple submissions in a programming exercise. @@ -453,7 +453,7 @@ SELECT COUNT (DISTINCT p) List findAllProgrammingExercisesInCourseOrInExamsOfCourse(@Param("course") Course course); @EntityGraph(type = LOAD, attributePaths = { "plagiarismDetectionConfig" }) - Optional findWithPlagiarismDetectionConfigById(Long exerciseId); + Optional findWithPlagiarismDetectionConfigById(long exerciseId); long countByShortNameAndCourse(String shortName, Course course); @@ -470,7 +470,7 @@ SELECT COUNT (DISTINCT p) * @return The programming exercise related to the given id */ @NotNull - default ProgrammingExercise findByIdElseThrow(Long programmingExerciseId) throws EntityNotFoundException { + default ProgrammingExercise findByIdElseThrow(long programmingExerciseId) throws EntityNotFoundException { return findById(programmingExerciseId).orElseThrow(() -> new EntityNotFoundException("Programming Exercise", programmingExerciseId)); } @@ -514,7 +514,7 @@ default ProgrammingExercise findByIdWithGradingCriteriaElseThrow(long exerciseId * @return The programming exercise related to the given id */ @NotNull - default ProgrammingExercise findByIdWithPlagiarismDetectionConfigElseThrow(Long programmingExerciseId) throws EntityNotFoundException { + default ProgrammingExercise findByIdWithPlagiarismDetectionConfigElseThrow(long programmingExerciseId) throws EntityNotFoundException { return findWithPlagiarismDetectionConfigById(programmingExerciseId).orElseThrow(() -> new EntityNotFoundException("Programming Exercise", programmingExerciseId)); } @@ -525,7 +525,7 @@ default ProgrammingExercise findByIdWithPlagiarismDetectionConfigElseThrow(Long * @return The programming exercise related to the given id */ @NotNull - default ProgrammingExercise findByIdWithAuxiliaryRepositoriesElseThrow(Long programmingExerciseId) throws EntityNotFoundException { + default ProgrammingExercise findByIdWithAuxiliaryRepositoriesElseThrow(long programmingExerciseId) throws EntityNotFoundException { return findWithAuxiliaryRepositoriesById(programmingExerciseId).orElseThrow(() -> new EntityNotFoundException("Programming Exercise", programmingExerciseId)); } @@ -536,7 +536,7 @@ default ProgrammingExercise findByIdWithAuxiliaryRepositoriesElseThrow(Long prog * @return The programming exercise related to the given id */ @NotNull - default ProgrammingExercise findByIdWithSubmissionPolicyElseThrow(Long programmingExerciseId) throws EntityNotFoundException { + default ProgrammingExercise findByIdWithSubmissionPolicyElseThrow(long programmingExerciseId) throws EntityNotFoundException { return findWithSubmissionPolicyById(programmingExerciseId).orElseThrow(() -> new EntityNotFoundException("Programming Exercise", programmingExerciseId)); } @@ -550,7 +550,7 @@ default ProgrammingExercise findByIdWithSubmissionPolicyElseThrow(Long programmi * @throws EntityNotFoundException the programming exercise could not be found. */ @NotNull - default ProgrammingExercise findByIdWithTemplateAndSolutionParticipationElseThrow(Long programmingExerciseId) throws EntityNotFoundException { + default ProgrammingExercise findByIdWithTemplateAndSolutionParticipationElseThrow(long programmingExerciseId) throws EntityNotFoundException { Optional programmingExercise = findWithTemplateAndSolutionParticipationTeamAssignmentConfigCategoriesById(programmingExerciseId); return programmingExercise.orElseThrow(() -> new EntityNotFoundException("Programming Exercise", programmingExerciseId)); } @@ -564,7 +564,7 @@ default ProgrammingExercise findByIdWithTemplateAndSolutionParticipationElseThro * @throws EntityNotFoundException the programming exercise could not be found. */ @NotNull - default ProgrammingExercise findByIdWithTemplateAndSolutionParticipationAndAuxiliaryRepositoriesElseThrow(Long programmingExerciseId) throws EntityNotFoundException { + default ProgrammingExercise findByIdWithTemplateAndSolutionParticipationAndAuxiliaryRepositoriesElseThrow(long programmingExerciseId) throws EntityNotFoundException { Optional programmingExercise = findWithTemplateAndSolutionParticipationAndAuxiliaryRepositoriesById(programmingExerciseId); return programmingExercise.orElseThrow(() -> new EntityNotFoundException("Programming Exercise", programmingExerciseId)); } @@ -587,7 +587,7 @@ default ProgrammingExercise findByIdWithStudentParticipationsAndLegalSubmissions * @return the number of programming submissions which should be assessed * We don't need to check for the submission date, because students cannot participate in programming exercises with manual assessment after their due date */ - default long countLegalSubmissionsByExerciseIdSubmitted(Long exerciseId) { + default long countLegalSubmissionsByExerciseIdSubmitted(long exerciseId) { return countLegalSubmissionsByExerciseIdSubmittedIgnoreTestRunSubmissions(exerciseId); } @@ -596,7 +596,7 @@ default long countLegalSubmissionsByExerciseIdSubmitted(Long exerciseId) { * @return the number of assessed programming submissions * We don't need to check for the submission date, because students cannot participate in programming exercises with manual assessment after their due date */ - default long countAssessmentsByExerciseIdSubmitted(Long exerciseId) { + default long countAssessmentsByExerciseIdSubmitted(long exerciseId) { return countAssessmentsByExerciseIdSubmittedIgnoreTestRunSubmissions(exerciseId); } diff --git a/src/main/java/de/tum/in/www1/artemis/repository/ProgrammingExerciseStudentParticipationRepository.java b/src/main/java/de/tum/in/www1/artemis/repository/ProgrammingExerciseStudentParticipationRepository.java index 8e1a430005e8..68f0c9486fd7 100644 --- a/src/main/java/de/tum/in/www1/artemis/repository/ProgrammingExerciseStudentParticipationRepository.java +++ b/src/main/java/de/tum/in/www1/artemis/repository/ProgrammingExerciseStudentParticipationRepository.java @@ -46,7 +46,7 @@ SELECT MAX(prr.id) ) ) OR pr.id IS NULL) """) - Optional findByIdWithLatestResultAndFeedbacksAndRelatedSubmissions(@Param("participationId") Long participationId, + Optional findByIdWithLatestResultAndFeedbacksAndRelatedSubmissions(@Param("participationId") long participationId, @Param("dateTime") ZonedDateTime dateTime); @EntityGraph(type = LOAD, attributePaths = { "results", "exercise", "team.students" }) @@ -61,24 +61,24 @@ Optional findByIdWithLatestResultAndFee """) List findAllWithBuildPlanIdWithResults(); - Optional findByExerciseIdAndStudentLogin(Long exerciseId, String username); + Optional findByExerciseIdAndStudentLogin(long exerciseId, String username); - default ProgrammingExerciseStudentParticipation findByExerciseIdAndStudentLoginOrThrow(Long exerciseId, String username) { + default ProgrammingExerciseStudentParticipation findByExerciseIdAndStudentLoginOrThrow(long exerciseId, String username) { return findByExerciseIdAndStudentLogin(exerciseId, username).orElseThrow(() -> new EntityNotFoundException("Programming Exercise Student Participation", exerciseId)); } @EntityGraph(type = LOAD, attributePaths = { "submissions" }) - Optional findWithSubmissionsByExerciseIdAndStudentLogin(Long exerciseId, String username); + Optional findWithSubmissionsByExerciseIdAndStudentLogin(long exerciseId, String username); - default ProgrammingExerciseStudentParticipation findWithSubmissionsByExerciseIdAndStudentLoginOrThrow(Long exerciseId, String username) { + default ProgrammingExerciseStudentParticipation findWithSubmissionsByExerciseIdAndStudentLoginOrThrow(long exerciseId, String username) { return findWithSubmissionsByExerciseIdAndStudentLogin(exerciseId, username) .orElseThrow(() -> new EntityNotFoundException("Programming Exercise Student Participation", exerciseId)); } - Optional findByExerciseIdAndStudentLoginAndTestRun(Long exerciseId, String username, boolean testRun); + Optional findByExerciseIdAndStudentLoginAndTestRun(long exerciseId, String username, boolean testRun); @EntityGraph(type = LOAD, attributePaths = { "team" }) - Optional findByExerciseIdAndTeamId(Long exerciseId, Long teamId); + Optional findByExerciseIdAndTeamId(long exerciseId, long teamId); @Query(""" SELECT DISTINCT participation @@ -88,7 +88,7 @@ default ProgrammingExerciseStudentParticipation findWithSubmissionsByExerciseIdA WHERE participation.exercise.id = :exerciseId AND participation.team.shortName = :teamShortName """) - Optional findWithEagerStudentsByExerciseIdAndTeamShortName(@Param("exerciseId") Long exerciseId, + Optional findWithEagerStudentsByExerciseIdAndTeamShortName(@Param("exerciseId") long exerciseId, @Param("teamShortName") String teamShortName); @Query(""" @@ -100,19 +100,19 @@ Optional findWithEagerStudentsByExercis WHERE participation.exercise.id = :exerciseId AND participation.team.shortName = :teamShortName """) - Optional findWithSubmissionsAndEagerStudentsByExerciseIdAndTeamShortName(@Param("exerciseId") Long exerciseId, + Optional findWithSubmissionsAndEagerStudentsByExerciseIdAndTeamShortName(@Param("exerciseId") long exerciseId, @Param("teamShortName") String teamShortName); - List findByExerciseId(Long exerciseId); + List findByExerciseId(long exerciseId); @EntityGraph(type = LOAD, attributePaths = { "submissions" }) List findWithSubmissionsById(long participationId); @EntityGraph(type = LOAD, attributePaths = { "submissions" }) - List findWithSubmissionsByExerciseId(Long exerciseId); + List findWithSubmissionsByExerciseId(long exerciseId); @EntityGraph(type = LOAD, attributePaths = { "submissions", "team.students" }) - List findWithSubmissionsAndTeamStudentsByExerciseId(Long exerciseId); + List findWithSubmissionsAndTeamStudentsByExerciseId(long exerciseId); /** * Will return the participations matching the provided participation ids, but only if they belong to the given exercise. @@ -128,7 +128,7 @@ Optional findWithSubmissionsAndEagerStu WHERE participation.exercise.id = :exerciseId AND participation.id IN :participationIds """) - List findWithSubmissionsByExerciseIdAndParticipationIds(@Param("exerciseId") Long exerciseId, + List findWithSubmissionsByExerciseIdAndParticipationIds(@Param("exerciseId") long exerciseId, @Param("participationIds") Collection participationIds); @Query(""" @@ -139,7 +139,7 @@ List findWithSubmissionsByExerciseIdAnd AND participation.student.login = :username AND participation.testRun = :testRun """) - Optional findWithSubmissionsByExerciseIdAndStudentLoginAndTestRun(@Param("exerciseId") Long exerciseId, + Optional findWithSubmissionsByExerciseIdAndStudentLoginAndTestRun(@Param("exerciseId") long exerciseId, @Param("username") String username, @Param("testRun") boolean testRun); @Query(""" @@ -150,24 +150,24 @@ Optional findWithSubmissionsByExerciseI AND participation.student.login = :username ORDER BY participation.testRun ASC """) - List findAllWithSubmissionsByExerciseIdAndStudentLogin(@Param("exerciseId") Long exerciseId, @Param("username") String username); + List findAllWithSubmissionsByExerciseIdAndStudentLogin(@Param("exerciseId") long exerciseId, @Param("username") String username); @EntityGraph(type = LOAD, attributePaths = "student") - Optional findWithStudentById(Long participationId); + Optional findWithStudentById(long participationId); @EntityGraph(type = LOAD, attributePaths = "team.students") - Optional findWithTeamStudentsById(Long participationId); + Optional findWithTeamStudentsById(long participationId); @NotNull - default ProgrammingExerciseStudentParticipation findByIdElseThrow(Long participationId) { + default ProgrammingExerciseStudentParticipation findByIdElseThrow(long participationId) { return findById(participationId).orElseThrow(() -> new EntityNotFoundException("Programming Exercise Student Participation", participationId)); } - default Optional findStudentParticipationWithLatestResultAndFeedbacksAndRelatedSubmissions(Long participationId) { + default Optional findStudentParticipationWithLatestResultAndFeedbacksAndRelatedSubmissions(long participationId) { return findByIdWithLatestResultAndFeedbacksAndRelatedSubmissions(participationId, ZonedDateTime.now()); } - default ProgrammingExerciseStudentParticipation findWithTeamStudentsByIdElseThrow(Long participationId) { + default ProgrammingExerciseStudentParticipation findWithTeamStudentsByIdElseThrow(long participationId) { return findWithTeamStudentsById(participationId).orElseThrow(() -> new EntityNotFoundException("Programming Exercise Student Participation", participationId)); } @@ -178,7 +178,7 @@ default ProgrammingExerciseStudentParticipation findWithTeamStudentsByIdElseThro SET p.locked = :locked WHERE p.id = :participationId """) - void updateLockedById(@Param("participationId") Long participationId, @Param("locked") boolean locked); + void updateLockedById(@Param("participationId") long participationId, @Param("locked") boolean locked); @Query(""" SELECT DISTINCT p diff --git a/src/main/java/de/tum/in/www1/artemis/repository/ProgrammingExerciseTestCaseRepository.java b/src/main/java/de/tum/in/www1/artemis/repository/ProgrammingExerciseTestCaseRepository.java index 1cce4c79a847..248fa49e9b80 100644 --- a/src/main/java/de/tum/in/www1/artemis/repository/ProgrammingExerciseTestCaseRepository.java +++ b/src/main/java/de/tum/in/www1/artemis/repository/ProgrammingExerciseTestCaseRepository.java @@ -17,11 +17,11 @@ @Repository public interface ProgrammingExerciseTestCaseRepository extends JpaRepository { - Set findByExerciseId(Long exerciseId); + Set findByExerciseId(long exerciseId); - Optional findByExerciseIdAndTestName(Long exerciseId, String testName); + Optional findByExerciseIdAndTestName(long exerciseId, String testName); - default ProgrammingExerciseTestCase findByIdWithExerciseElseThrow(Long testCaseId) { + default ProgrammingExerciseTestCase findByIdWithExerciseElseThrow(long testCaseId) { return findByIdWithExercise(testCaseId).orElseThrow(() -> new EntityNotFoundException("Programming Exercise Test Case", testCaseId)); } @@ -37,7 +37,7 @@ default ProgrammingExerciseTestCase findByIdWithExerciseElseThrow(Long testCaseI LEFT JOIN FETCH tc.exercise ex WHERE tc.id = :testCaseId """) - Optional findByIdWithExercise(@Param("testCaseId") Long testCaseId); + Optional findByIdWithExercise(@Param("testCaseId") long testCaseId); /** * Returns all test cases with the associated solution entries for a programming exercise @@ -51,7 +51,7 @@ default ProgrammingExerciseTestCase findByIdWithExerciseElseThrow(Long testCaseI LEFT JOIN FETCH tc.solutionEntries se WHERE tc.exercise.id = :exerciseId """) - Set findByExerciseIdWithSolutionEntries(@Param("exerciseId") Long exerciseId); + Set findByExerciseIdWithSolutionEntries(@Param("exerciseId") long exerciseId); /** * Returns all test cases with the associated solution entries for a programming exercise @@ -67,9 +67,9 @@ default ProgrammingExerciseTestCase findByIdWithExerciseElseThrow(Long testCaseI WHERE tc.exercise.id = :exerciseId AND tc.active = :active """) - Set findByExerciseIdWithSolutionEntriesAndActive(@Param("exerciseId") Long exerciseId, @Param("active") Boolean active); + Set findByExerciseIdWithSolutionEntriesAndActive(@Param("exerciseId") long exerciseId, @Param("active") Boolean active); - Set findByExerciseIdAndActive(Long exerciseId, Boolean active); + Set findByExerciseIdAndActive(long exerciseId, Boolean active); /** * Returns the number of test cases marked as {@link de.tum.in.www1.artemis.domain.enumeration.Visibility#AFTER_DUE_DATE} for the given exercise. @@ -83,5 +83,5 @@ SELECT COUNT(DISTINCT testCase) WHERE testCase.exercise.id = :exerciseId AND testCase.visibility = de.tum.in.www1.artemis.domain.enumeration.Visibility.AFTER_DUE_DATE """) - long countAfterDueDateByExerciseId(@Param("exerciseId") Long exerciseId); + long countAfterDueDateByExerciseId(@Param("exerciseId") long exerciseId); } diff --git a/src/main/java/de/tum/in/www1/artemis/repository/ProgrammingSubmissionRepository.java b/src/main/java/de/tum/in/www1/artemis/repository/ProgrammingSubmissionRepository.java index c813c3435579..03788c57af44 100644 --- a/src/main/java/de/tum/in/www1/artemis/repository/ProgrammingSubmissionRepository.java +++ b/src/main/java/de/tum/in/www1/artemis/repository/ProgrammingSubmissionRepository.java @@ -46,10 +46,10 @@ default ProgrammingSubmission findByIdElseThrow(long submissionId) { AND s.commitHash = :commitHash ORDER BY s.id DESC """) - List findByParticipationIdAndCommitHashOrderByIdDescWithFeedbacksAndTeamStudents(@Param("participationId") Long participationId, + List findByParticipationIdAndCommitHashOrderByIdDescWithFeedbacksAndTeamStudents(@Param("participationId") long participationId, @Param("commitHash") String commitHash); - default ProgrammingSubmission findFirstByParticipationIdAndCommitHashOrderByIdDescWithFeedbacksAndTeamStudents(Long participationId, String commitHash) { + default ProgrammingSubmission findFirstByParticipationIdAndCommitHashOrderByIdDescWithFeedbacksAndTeamStudents(long participationId, String commitHash) { return findByParticipationIdAndCommitHashOrderByIdDescWithFeedbacksAndTeamStudents(participationId, commitHash).stream().findFirst().orElse(null); } @@ -66,10 +66,10 @@ SELECT MAX(s2.id) AND (s2.type <> de.tum.in.www1.artemis.domain.enumeration.SubmissionType.ILLEGAL OR s2.type IS NULL) ) """) - Optional findFirstByParticipationIdOrderByLegalSubmissionDateDesc(@Param("participationId") Long participationId); + Optional findFirstByParticipationIdOrderByLegalSubmissionDateDesc(@Param("participationId") long participationId); @EntityGraph(type = LOAD, attributePaths = "results") - Optional findFirstByParticipationIdOrderBySubmissionDateDesc(Long participationId); + Optional findFirstByParticipationIdOrderBySubmissionDateDesc(long participationId); /** * Provide a list of graded submissions. To be graded a submission must: @@ -96,19 +96,19 @@ SELECT MAX(s2.id) ) ORDER BY s.submissionDate DESC """) - List findGradedByParticipationIdOrderBySubmissionDateDesc(@Param("participationId") Long participationId, Pageable pageable); + List findGradedByParticipationIdOrderBySubmissionDateDesc(@Param("participationId") long participationId, Pageable pageable); @EntityGraph(type = LOAD, attributePaths = "results") - Optional findWithEagerResultsById(Long submissionId); + Optional findWithEagerResultsById(long submissionId); @EntityGraph(type = LOAD, attributePaths = "results.feedbacks") - Optional findWithEagerResultsAndFeedbacksById(Long submissionId); + Optional findWithEagerResultsAndFeedbacksById(long submissionId); @EntityGraph(type = LOAD, attributePaths = { "results", "results.feedbacks", "results.feedbacks.testCase", "results.assessor" }) Optional findWithEagerResultsFeedbacksTestCasesAssessorById(long submissionId); @EntityGraph(type = LOAD, attributePaths = { "buildLogEntries" }) - Optional findWithEagerBuildLogEntriesById(Long submissionId); + Optional findWithEagerBuildLogEntriesById(long submissionId); @Query(""" SELECT s @@ -116,7 +116,7 @@ SELECT MAX(s2.id) LEFT JOIN FETCH s.results r WHERE r.id = :resultId """) - Optional findByResultId(@Param("resultId") Long resultId); + Optional findByResultId(@Param("resultId") long resultId); @Query(""" SELECT DISTINCT s @@ -124,7 +124,7 @@ SELECT MAX(s2.id) LEFT JOIN FETCH s.results r WHERE s.participation.id = :participationId """) - List findAllByParticipationIdWithResults(@Param("participationId") Long participationId); + List findAllByParticipationIdWithResults(@Param("participationId") long participationId); /** * Get the programming submission with the given id from the database. The submission is loaded together with exercise it belongs to, its result, the feedback of the result and @@ -139,7 +139,7 @@ default ProgrammingSubmission findByIdWithResultsFeedbacksAssessorTestCases(long } @NotNull - default ProgrammingSubmission findByResultIdElseThrow(Long resultId) { + default ProgrammingSubmission findByResultIdElseThrow(long resultId) { return findByResultId(resultId).orElseThrow(() -> new EntityNotFoundException("Programming Submission for Result", resultId)); } } diff --git a/src/main/java/de/tum/in/www1/artemis/repository/SolutionProgrammingExerciseParticipationRepository.java b/src/main/java/de/tum/in/www1/artemis/repository/SolutionProgrammingExerciseParticipationRepository.java index d2ab19975afc..b133705f79a7 100644 --- a/src/main/java/de/tum/in/www1/artemis/repository/SolutionProgrammingExerciseParticipationRepository.java +++ b/src/main/java/de/tum/in/www1/artemis/repository/SolutionProgrammingExerciseParticipationRepository.java @@ -30,21 +30,21 @@ public interface SolutionProgrammingExerciseParticipationRepository extends JpaR Optional findByBuildPlanIdWithResults(@Param("buildPlanId") String buildPlanId); @EntityGraph(type = LOAD, attributePaths = { "results", "submissions", "submissions.results" }) - Optional findWithEagerResultsAndSubmissionsByProgrammingExerciseId(Long exerciseId); + Optional findWithEagerResultsAndSubmissionsByProgrammingExerciseId(long exerciseId); - default SolutionProgrammingExerciseParticipation findWithEagerResultsAndSubmissionsByProgrammingExerciseIdElseThrow(Long exerciseId) { + default SolutionProgrammingExerciseParticipation findWithEagerResultsAndSubmissionsByProgrammingExerciseIdElseThrow(long exerciseId) { return findWithEagerResultsAndSubmissionsByProgrammingExerciseId(exerciseId).orElseThrow(() -> new EntityNotFoundException("ProgrammingExerciseParticipation", exerciseId)); } @EntityGraph(type = LOAD, attributePaths = { "results", "results.feedbacks", "results.feedbacks.testCase", "submissions" }) - Optional findWithEagerResultsAndFeedbacksAndTestCasesAndSubmissionsByProgrammingExerciseId(Long exerciseId); + Optional findWithEagerResultsAndFeedbacksAndTestCasesAndSubmissionsByProgrammingExerciseId(long exerciseId); @EntityGraph(type = LOAD, attributePaths = { "submissions" }) - Optional findWithEagerSubmissionsByProgrammingExerciseId(Long exerciseId); + Optional findWithEagerSubmissionsByProgrammingExerciseId(long exerciseId); - Optional findByProgrammingExerciseId(Long programmingExerciseId); + Optional findByProgrammingExerciseId(long programmingExerciseId); - default SolutionProgrammingExerciseParticipation findByProgrammingExerciseIdElseThrow(Long programmingExerciseId) { + default SolutionProgrammingExerciseParticipation findByProgrammingExerciseIdElseThrow(long programmingExerciseId) { var optional = findByProgrammingExerciseId(programmingExerciseId); return optional.orElseThrow(() -> new EntityNotFoundException("Solution Programming Exercise Participation", programmingExerciseId)); } diff --git a/src/main/java/de/tum/in/www1/artemis/repository/StaticCodeAnalysisCategoryRepository.java b/src/main/java/de/tum/in/www1/artemis/repository/StaticCodeAnalysisCategoryRepository.java index b475e330cb02..5851a8a5ad96 100644 --- a/src/main/java/de/tum/in/www1/artemis/repository/StaticCodeAnalysisCategoryRepository.java +++ b/src/main/java/de/tum/in/www1/artemis/repository/StaticCodeAnalysisCategoryRepository.java @@ -30,7 +30,7 @@ public interface StaticCodeAnalysisCategoryRepository extends JpaRepository findByExerciseId(Long exerciseId); + Set findByExerciseId(long exerciseId); @Query(""" SELECT s @@ -38,7 +38,7 @@ public interface StaticCodeAnalysisCategoryRepository extends JpaRepository findWithExerciseByExerciseId(@Param("exerciseId") Long exerciseId); + Set findWithExerciseByExerciseId(@Param("exerciseId") long exerciseId); /** * Links the categories of an exercise with the default category mappings. diff --git a/src/main/java/de/tum/in/www1/artemis/repository/TemplateProgrammingExerciseParticipationRepository.java b/src/main/java/de/tum/in/www1/artemis/repository/TemplateProgrammingExerciseParticipationRepository.java index e4a111d7ed19..15c1476f33f3 100644 --- a/src/main/java/de/tum/in/www1/artemis/repository/TemplateProgrammingExerciseParticipationRepository.java +++ b/src/main/java/de/tum/in/www1/artemis/repository/TemplateProgrammingExerciseParticipationRepository.java @@ -30,21 +30,21 @@ public interface TemplateProgrammingExerciseParticipationRepository extends JpaR Optional findByBuildPlanIdWithResults(@Param("buildPlanId") String buildPlanId); @EntityGraph(type = LOAD, attributePaths = { "results", "submissions" }) - Optional findWithEagerResultsAndSubmissionsByProgrammingExerciseId(Long exerciseId); + Optional findWithEagerResultsAndSubmissionsByProgrammingExerciseId(long exerciseId); - default TemplateProgrammingExerciseParticipation findWithEagerResultsAndSubmissionsByProgrammingExerciseIdElseThrow(Long exerciseId) { + default TemplateProgrammingExerciseParticipation findWithEagerResultsAndSubmissionsByProgrammingExerciseIdElseThrow(long exerciseId) { return findWithEagerResultsAndSubmissionsByProgrammingExerciseId(exerciseId).orElseThrow(() -> new EntityNotFoundException("ProgrammingExerciseParticipation", exerciseId)); } @EntityGraph(type = LOAD, attributePaths = { "results", "results.feedbacks", "results.feedbacks.testCase", "submissions" }) - Optional findWithEagerResultsAndFeedbacksAndTestCasesAndSubmissionsByProgrammingExerciseId(Long exerciseId); + Optional findWithEagerResultsAndFeedbacksAndTestCasesAndSubmissionsByProgrammingExerciseId(long exerciseId); @EntityGraph(type = LOAD, attributePaths = { "submissions" }) - Optional findWithEagerSubmissionsByProgrammingExerciseId(Long exerciseId); + Optional findWithEagerSubmissionsByProgrammingExerciseId(long exerciseId); - Optional findByProgrammingExerciseId(Long programmingExerciseId); + Optional findByProgrammingExerciseId(long programmingExerciseId); - default TemplateProgrammingExerciseParticipation findByProgrammingExerciseIdElseThrow(Long programmingExerciseId) { + default TemplateProgrammingExerciseParticipation findByProgrammingExerciseIdElseThrow(long programmingExerciseId) { var optional = findByProgrammingExerciseId(programmingExerciseId); return optional.orElseThrow(() -> new EntityNotFoundException("Template Programming Exercise Participation", programmingExerciseId)); }