├── src ├── main │ ├── resources │ │ ├── config │ │ │ └── liquibase │ │ │ │ ├── fake-data │ │ │ │ ├── course.csv │ │ │ │ ├── exam.csv │ │ │ │ ├── course_group.csv │ │ │ │ ├── final_result.csv │ │ │ │ ├── student_response.csv │ │ │ │ ├── exam_sheet.csv │ │ │ │ ├── answer_2_hybrid_graded_comment.csv │ │ │ │ ├── comments.csv │ │ │ │ ├── student.csv │ │ │ │ ├── question.csv │ │ │ │ ├── scan.csv │ │ │ │ ├── text_comment.csv │ │ │ │ ├── zone.csv │ │ │ │ ├── graded_comment.csv │ │ │ │ ├── hybrid_graded_comment.csv │ │ │ │ ├── template.csv │ │ │ │ ├── question_type.csv │ │ │ │ └── blob │ │ │ │ │ ├── example.pdf │ │ │ │ │ └── hipster.png │ │ │ │ ├── data │ │ │ │ ├── authority.csv │ │ │ │ ├── question_type.csv │ │ │ │ ├── user_authority.csv │ │ │ │ ├── user_authoritytest.csv │ │ │ │ ├── user.csv │ │ │ │ └── usertest.csv │ │ │ │ ├── master.xml │ │ │ │ └── mastertest.xml │ │ ├── META-INF │ │ │ ├── resources │ │ │ │ └── publicKey.pem │ │ │ └── web.xml │ │ ├── resources-config.json │ │ ├── default_banner.txt │ │ ├── reflection-config.json │ │ ├── templates │ │ │ └── mail │ │ │ │ ├── creationEmail.html │ │ │ │ ├── activationEmail.html │ │ │ │ └── passwordResetEmail.html │ │ ├── i18n │ │ │ ├── messages_en.properties │ │ │ └── messages_fr.properties │ │ ├── db │ │ │ └── migration │ │ │ │ └── V1__Initial_versionjusdata.sql │ │ └── jwt │ │ │ └── privateKey.pem │ ├── docker │ │ ├── sonar.yml │ │ ├── grafana │ │ │ └── provisioning │ │ │ │ ├── dashboards │ │ │ │ └── dashboard.yml │ │ │ │ └── datasources │ │ │ │ └── datasource.yml │ │ ├── k8s │ │ │ ├── namespace.yaml │ │ │ ├── front-service.yaml │ │ │ ├── back-service.yaml │ │ │ ├── myadmin-service.yaml │ │ │ ├── correctexam-mysql-service.yaml │ │ │ ├── maildev-service.yaml │ │ │ ├── front-deployment.yaml │ │ │ ├── myadmin-deployment.yaml │ │ │ ├── maildev-deployment.yaml │ │ │ ├── correctexam-mysql-deployment.yaml │ │ │ └── minio-dev.yaml │ │ ├── mysql.yml │ │ ├── Dockerfile.build.aarch64 │ │ ├── Dockerfile.arm64 │ │ ├── Dockerfile.front │ │ ├── exampleconf │ │ │ ├── nginx.conf │ │ │ └── myadmin.conf │ │ ├── es.yml │ │ ├── Dockerfile.native │ │ ├── monitoring.yml │ │ ├── Dockerfile.build.amd64 │ │ └── prometheus │ │ │ └── prometheus.yml │ └── java │ │ └── fr │ │ └── istic │ │ ├── domain │ │ ├── enumeration │ │ │ └── GradeType.java │ │ └── Authority.java │ │ ├── service │ │ ├── EmailAlreadyUsedException.java │ │ ├── UsernameAlreadyUsedException.java │ │ ├── InvalidPasswordException.java │ │ ├── customdto │ │ │ ├── EntityId.java │ │ │ ├── ListEmailProf.java │ │ │ ├── StudentResponseNote.java │ │ │ ├── ClusterDTO.java │ │ │ ├── exportpdf │ │ │ │ ├── Textcommentspdf.java │ │ │ │ ├── Gradedcommentspdf.java │ │ │ │ ├── Studentpdf.java │ │ │ │ ├── Zonepdf.java │ │ │ │ ├── Questionspdf.java │ │ │ │ ├── Sheetspdf.java │ │ │ │ ├── ExportPDFDto.java │ │ │ │ └── Hybridcommentspdf.java │ │ │ ├── StudentMassDTO.java │ │ │ ├── exportcomments │ │ │ │ ├── Prediction.java │ │ │ │ ├── Comment.java │ │ │ │ ├── AnswersWithPredictionDto.java │ │ │ │ └── Answer.java │ │ │ ├── answernotebooks │ │ │ │ ├── QuestionNoteBook.java │ │ │ │ └── AnswersNoteBook.java │ │ │ ├── ListUserModelShare.java │ │ │ ├── PredictionsIdsDto.java │ │ │ ├── ResizeZoneDTO.java │ │ │ ├── correctexamstate │ │ │ │ ├── SheetStateDTO.java │ │ │ │ └── MarkingExamStateDTO.java │ │ │ ├── StudentDTO.java │ │ │ ├── UserModelShare.java │ │ │ ├── TemplateCaseDTO.java │ │ │ └── WorstAndBestSolution.java │ │ ├── dto │ │ │ ├── ManagementInfoDTO.java │ │ │ ├── PasswordChangeDTO.java │ │ │ ├── ScanDTO.java │ │ │ ├── CommentsDTO.java │ │ │ ├── ScanDTOContent.java │ │ │ ├── ZoneDTO.java │ │ │ ├── QuestionTypeDTO.java │ │ │ ├── CourseDTO.java │ │ │ ├── FinalResultDTO.java │ │ │ ├── TextCommentDTO.java │ │ │ ├── ExamSheetDTO.java │ │ │ ├── CourseGroupDTO.java │ │ │ ├── GradedCommentDTO.java │ │ │ ├── TemplateDTO.java │ │ │ ├── StudentDTO.java │ │ │ ├── Answer2HybridGradedCommentDTO.java │ │ │ ├── PredictionDTO.java │ │ │ ├── TemplateDTOContent.java │ │ │ └── HybridGradedCommentDTO.java │ │ ├── mapper │ │ │ ├── ZoneMapper.java │ │ │ ├── QuestionTypeMapper.java │ │ │ ├── ScanContentMapper.java │ │ │ ├── ScanMapper.java │ │ │ ├── StudentMapper.java │ │ │ ├── EntityMapper.java │ │ │ ├── TemplateContentMapper.java │ │ │ ├── TemplateMapper.java │ │ │ ├── CommentsMapper.java │ │ │ ├── ExamSheetMapper.java │ │ │ ├── CourseMapper.java │ │ │ ├── TextCommentMapper.java │ │ │ ├── CourseGroupMapper.java │ │ │ ├── FinalResultMapper.java │ │ │ ├── PredictionMapper.java │ │ │ ├── Answer2HybridGradedCommentMapper.java │ │ │ ├── GradedCommentMapper.java │ │ │ └── HybridGradedCommentMapper.java │ │ ├── ManagementInfoService.java │ │ └── Paged.java │ │ ├── web │ │ ├── rest │ │ │ ├── errors │ │ │ │ ├── AccountResourceException.java │ │ │ │ ├── EmailAlreadyUsedException.java │ │ │ │ ├── LoginAlreadyUsedException.java │ │ │ │ ├── EmailNotFoundException.java │ │ │ │ ├── BadRequestAlertException.java │ │ │ │ └── UserNotAuthenticatedException.java │ │ │ ├── vm │ │ │ │ ├── KeyAndPasswordVM.java │ │ │ │ ├── ConfigPropsVM.java │ │ │ │ ├── LoginVM.java │ │ │ │ ├── PageRequestVM.java │ │ │ │ ├── ManagedUserVM.java │ │ │ │ ├── LoggerVM.java │ │ │ │ └── SortRequestVM.java │ │ │ ├── ManagementInfoResource.java │ │ │ ├── AuthorityResource.java │ │ │ └── JHipsterConfigurationEndpoint.java │ │ └── util │ │ │ └── ResponseUtil.java │ │ ├── security │ │ ├── UserNotActivatedException.java │ │ ├── UsernameNotFoundException.java │ │ ├── AuthoritiesConstants.java │ │ └── RandomUtil.java │ │ └── config │ │ ├── JHipsterInfo.java │ │ ├── FooSerializer.java │ │ ├── Constants.java │ │ ├── FooDeserializer.java │ │ ├── hibernate │ │ └── JHipsterCompatibleImplicitNamingStrategy.java │ │ ├── JsonbConfiguration.java │ │ ├── JHipsterProperties.java │ │ ├── SPARouting.java │ │ └── LocalDateProvider.java └── test │ ├── resources │ └── i18n │ │ ├── messages_fr.properties │ │ └── messages_en.properties │ └── java │ └── fr │ └── istic │ ├── TestResources.java │ ├── config │ ├── mock │ │ └── JHipsterInfoMock.java │ └── LocalDateProviderTest.java │ ├── domain │ ├── UserTest.java │ ├── ExamTest.java │ ├── ScanTest.java │ ├── ZoneTest.java │ ├── CourseTest.java │ ├── StudentTest.java │ ├── CommentsTest.java │ ├── QuestionTest.java │ ├── TemplateTest.java │ ├── ExamSheetTest.java │ ├── CourseGroupTest.java │ ├── FinalResultTest.java │ ├── TextCommentTest.java │ ├── QuestionTypeTest.java │ ├── GradedCommentTest.java │ ├── StudentResponseTest.java │ └── AuthorityTest.java │ ├── service │ └── dto │ │ ├── ExamDTOTest.java │ │ ├── ScanDTOTest.java │ │ ├── ZoneDTOTest.java │ │ ├── CourseDTOTest.java │ │ ├── StudentDTOTest.java │ │ ├── CommentsDTOTest.java │ │ ├── QuestionDTOTest.java │ │ ├── TemplateDTOTest.java │ │ ├── ExamSheetDTOTest.java │ │ ├── CourseGroupDTOTest.java │ │ ├── FinalResultDTOTest.java │ │ ├── TextCommentDTOTest.java │ │ ├── QuestionTypeDTOTest.java │ │ ├── GradedCommentDTOTest.java │ │ └── StudentResponseDTOTest.java │ └── ArchTest.java ├── .huskyrc ├── model.png ├── distwindows ├── mydb.mv.db └── mydb.trace.db ├── .lintstagedrc.js ├── .prettierignore ├── .prettierrc ├── .editorconfig ├── checkstyle.xml ├── web.xml.dev ├── .jhipster ├── QuestionType.json ├── Zone.json ├── Scan.json ├── Comments.json ├── FinalResult.json ├── TextComment.json ├── CourseGroup.json ├── GradedComment.json ├── Template.json ├── ExamSheet.json ├── Course.json └── Student.json ├── web.xml.prod ├── standalone.md ├── .mvn └── wrapper │ └── maven-wrapper.properties ├── LICENSE.md ├── .github └── workflows │ ├── develop.yml │ └── maven.yml ├── .yo-rc.json └── sonar-project.properties /src/main/resources/config/liquibase/fake-data/course.csv: -------------------------------------------------------------------------------- 1 | id;name 2 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/fake-data/exam.csv: -------------------------------------------------------------------------------- 1 | id;name 2 | -------------------------------------------------------------------------------- /.huskyrc: -------------------------------------------------------------------------------- 1 | { 2 | "hooks": { 3 | "pre-commit": "lint-staged" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/correctexam/corrigeExamBack/HEAD/model.png -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/fake-data/course_group.csv: -------------------------------------------------------------------------------- 1 | id;group_name 2 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/fake-data/final_result.csv: -------------------------------------------------------------------------------- 1 | id;note 2 | 3 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/fake-data/student_response.csv: -------------------------------------------------------------------------------- 1 | id;note 2 | 3 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/fake-data/exam_sheet.csv: -------------------------------------------------------------------------------- 1 | id;name;pagemin;pagemax 2 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/data/authority.csv: -------------------------------------------------------------------------------- 1 | name 2 | ROLE_ADMIN 3 | ROLE_USER 4 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/fake-data/answer_2_hybrid_graded_comment.csv: -------------------------------------------------------------------------------- 1 | id;step_value 2 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/fake-data/comments.csv: -------------------------------------------------------------------------------- 1 | id;zonegeneratedid;json_data 2 | 3 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/fake-data/student.csv: -------------------------------------------------------------------------------- 1 | id;name;firstname;ine;caslogin;mail 2 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/fake-data/question.csv: -------------------------------------------------------------------------------- 1 | id;numero;point;step;grade_type 2 | 3 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/fake-data/scan.csv: -------------------------------------------------------------------------------- 1 | id;name;content;content_content_type 2 | 3 | -------------------------------------------------------------------------------- /distwindows/mydb.mv.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/correctexam/corrigeExamBack/HEAD/distwindows/mydb.mv.db -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/data/question_type.csv: -------------------------------------------------------------------------------- 1 | algo_name 2 | manual 3 | QCM 4 | manuscrit 5 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/fake-data/text_comment.csv: -------------------------------------------------------------------------------- 1 | id;text;description;zonegeneratedid 2 | 3 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/fake-data/zone.csv: -------------------------------------------------------------------------------- 1 | id;page_number;x_init;y_init;width;height 2 | 3 | -------------------------------------------------------------------------------- /src/test/resources/i18n/messages_fr.properties: -------------------------------------------------------------------------------- 1 | email.test.title=Activation de votre compte correctExam 2 | -------------------------------------------------------------------------------- /.lintstagedrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | '{,src/**/}*.{json,md,yml}': ['prettier --write', 'git add'] 3 | }; 4 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | target 3 | build 4 | package-lock.json 5 | .git 6 | .mvn 7 | gradle 8 | .gradle 9 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/fake-data/graded_comment.csv: -------------------------------------------------------------------------------- 1 | id;zonegeneratedid;text;description;grade 2 | 3 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/fake-data/hybrid_graded_comment.csv: -------------------------------------------------------------------------------- 1 | id;text;description;grade;relative;step 2 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/fake-data/template.csv: -------------------------------------------------------------------------------- 1 | id;name;content;content_content_type;mark;auto_map_student_copy_to_list 2 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/fake-data/question_type.csv: -------------------------------------------------------------------------------- 1 | id;algo_name;endpoint;js_function 2 | 2;manual;; 3 | 3;QCM;; 4 | 4;manuscrit;; 5 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/data/user_authority.csv: -------------------------------------------------------------------------------- 1 | user_id;authority_name 2 | 1;ROLE_ADMIN 3 | 1;ROLE_USER 4 | 3;ROLE_ADMIN 5 | 3;ROLE_USER 6 | 4;ROLE_USER 7 | -------------------------------------------------------------------------------- /src/main/docker/sonar.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | correctExam-sonar: 4 | image: sonarqube:8.3.1-community 5 | ports: 6 | - 9001:9000 7 | - 9092:9092 8 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/data/user_authoritytest.csv: -------------------------------------------------------------------------------- 1 | user_id;authority_name 2 | 101;ROLE_ADMIN 3 | 101;ROLE_USER 4 | 103;ROLE_ADMIN 5 | 103;ROLE_USER 6 | 104;ROLE_USER 7 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/fake-data/blob/example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/correctexam/corrigeExamBack/HEAD/src/main/resources/config/liquibase/fake-data/blob/example.pdf -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/fake-data/blob/hipster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/correctexam/corrigeExamBack/HEAD/src/main/resources/config/liquibase/fake-data/blob/hipster.png -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | # Prettier configuration 2 | 3 | printWidth: 140 4 | singleQuote: true 5 | tabWidth: 2 6 | useTabs: false 7 | 8 | # js and ts rules: 9 | arrowParens: avoid 10 | 11 | # jsx and tsx rules: 12 | jsxBracketSameLine: false 13 | -------------------------------------------------------------------------------- /src/test/resources/i18n/messages_en.properties: -------------------------------------------------------------------------------- 1 | email.test.title=test title 2 | # Value used for English locale unit test in MailServiceIT 3 | # as this file is loaded instead of real file 4 | email.activation.title=correctExam account activation 5 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/domain/enumeration/GradeType.java: -------------------------------------------------------------------------------- 1 | package fr.istic.domain.enumeration; 2 | 3 | /** 4 | * The GradeType enumeration. 5 | */ 6 | public enum GradeType { 7 | DIRECT, 8 | POSITIVE, 9 | NEGATIVE, 10 | HYBRID, 11 | } 12 | -------------------------------------------------------------------------------- /distwindows/mydb.trace.db: -------------------------------------------------------------------------------- 1 | 2025-03-11 11:05:50.724828+01:00 jdbc[3]: exception 2 | org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "DATABASECHANGELOGLOCK" not found (this database is empty); SQL statement: 3 | SELECT COUNT(*) FROM PUBLIC.DATABASECHANGELOGLOCK [42104-224] 4 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/TestResources.java: -------------------------------------------------------------------------------- 1 | package fr.istic; 2 | 3 | import io.quarkus.test.common.QuarkusTestResource; 4 | import io.quarkus.test.h2.H2DatabaseTestResource; 5 | 6 | @QuarkusTestResource(H2DatabaseTestResource.class) 7 | public class TestResources {} 8 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/EmailAlreadyUsedException.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service; 2 | 3 | public class EmailAlreadyUsedException extends RuntimeException { 4 | 5 | public EmailAlreadyUsedException() { 6 | super("Email is already in use!"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/UsernameAlreadyUsedException.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service; 2 | 3 | public class UsernameAlreadyUsedException extends RuntimeException { 4 | 5 | public UsernameAlreadyUsedException() { 6 | super("Login name already used!"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/main/docker/grafana/provisioning/dashboards/dashboard.yml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | providers: 4 | - name: 'Prometheus' 5 | orgId: 1 6 | folder: '' 7 | type: file 8 | disableDeletion: false 9 | editable: true 10 | options: 11 | path: /etc/grafana/provisioning/dashboards 12 | -------------------------------------------------------------------------------- /src/main/docker/k8s/namespace.yaml: -------------------------------------------------------------------------------- 1 | # Deploys a new Namespace for the correctexam Pods 2 | apiVersion: v1 3 | kind: Namespace 4 | metadata: 5 | name: correctexam # Change this value if you want a different namespace name 6 | labels: 7 | name: correctexam # Change this value to match metadata.name 8 | --- 9 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/web/rest/errors/AccountResourceException.java: -------------------------------------------------------------------------------- 1 | package fr.istic.web.rest.errors; 2 | 3 | public class AccountResourceException 4 | extends RuntimeException { 5 | 6 | public AccountResourceException(String message) { 7 | super(message); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/web/rest/errors/EmailAlreadyUsedException.java: -------------------------------------------------------------------------------- 1 | package fr.istic.web.rest.errors; 2 | 3 | public class EmailAlreadyUsedException extends BadRequestAlertException { 4 | 5 | public EmailAlreadyUsedException() { 6 | super("Email is already in use!", "userManagement", "emailexists"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/web/rest/errors/LoginAlreadyUsedException.java: -------------------------------------------------------------------------------- 1 | package fr.istic.web.rest.errors; 2 | 3 | public class LoginAlreadyUsedException extends BadRequestAlertException { 4 | 5 | public LoginAlreadyUsedException() { 6 | super("Login name already used!", "userManagement", "userexists"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/security/UserNotActivatedException.java: -------------------------------------------------------------------------------- 1 | package fr.istic.security; 2 | 3 | import jakarta.ws.rs.NotAuthorizedException; 4 | 5 | public class UserNotActivatedException extends NotAuthorizedException { 6 | 7 | public UserNotActivatedException(String message) { 8 | super(message); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/security/UsernameNotFoundException.java: -------------------------------------------------------------------------------- 1 | package fr.istic.security; 2 | 3 | import jakarta.ws.rs.NotAuthorizedException; 4 | 5 | public class UsernameNotFoundException extends NotAuthorizedException { 6 | 7 | public UsernameNotFoundException(String message) { 8 | super(message); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/docker/k8s/front-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | fr.correctexam.service: front 6 | name: front 7 | namespace: correctexam 8 | spec: 9 | ports: 10 | - name: "80" 11 | port: 80 12 | targetPort: 80 13 | selector: 14 | fr.correctexam.service: front 15 | status: 16 | loadBalancer: {} 17 | -------------------------------------------------------------------------------- /src/main/docker/k8s/back-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | fr.correctexam.service: back 6 | name: back 7 | namespace: correctexam 8 | spec: 9 | ports: 10 | - name: "8080" 11 | port: 8080 12 | targetPort: 8080 13 | selector: 14 | fr.correctexam.service: back 15 | status: 16 | loadBalancer: {} 17 | -------------------------------------------------------------------------------- /src/main/docker/k8s/myadmin-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | fr.correctexam.service: myadmin 6 | name: myadmin 7 | namespace: correctexam 8 | spec: 9 | ports: 10 | - name: "80" 11 | port: 80 12 | targetPort: 80 13 | selector: 14 | fr.correctexam.service: myadmin 15 | status: 16 | loadBalancer: {} 17 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/config/JHipsterInfo.java: -------------------------------------------------------------------------------- 1 | package fr.istic.config; 2 | 3 | import io.smallrye.config.ConfigMapping; 4 | import io.smallrye.config.WithDefault; 5 | import io.smallrye.config.WithName; 6 | 7 | 8 | 9 | @ConfigMapping(prefix = "jhipster.info") 10 | public interface JHipsterInfo { 11 | 12 | @WithName("swagger.enable") 13 | @WithDefault("true") 14 | Boolean isEnable(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/docker/k8s/correctexam-mysql-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | fr.correctexam.service: correctexam-mysql 6 | name: correctexam-mysql 7 | namespace: correctexam 8 | spec: 9 | ports: 10 | - name: "3306" 11 | port: 3306 12 | targetPort: 3306 13 | selector: 14 | fr.correctexam.service: correctexam-mysql 15 | status: 16 | loadBalancer: {} 17 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/security/AuthoritiesConstants.java: -------------------------------------------------------------------------------- 1 | package fr.istic.security; 2 | 3 | /** 4 | * Constants JHipster authorities. 5 | */ 6 | public final class AuthoritiesConstants { 7 | public static final String ADMIN = "ROLE_ADMIN"; 8 | 9 | public static final String USER = "ROLE_USER"; 10 | 11 | public static final String ANONYMOUS = "ROLE_ANONYMOUS"; 12 | 13 | private AuthoritiesConstants() {} 14 | } 15 | -------------------------------------------------------------------------------- /src/main/docker/k8s/maildev-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | fr.correctexam.service: maildev 6 | name: maildev 7 | namespace: correctexam 8 | spec: 9 | ports: 10 | - name: "1080" 11 | port: 1080 12 | targetPort: 1080 13 | - name: "25" 14 | port: 25 15 | targetPort: 25 16 | selector: 17 | fr.correctexam.service: maildev 18 | status: 19 | loadBalancer: {} 20 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/config/mock/JHipsterInfoMock.java: -------------------------------------------------------------------------------- 1 | package fr.istic.config.mock; 2 | 3 | import fr.istic.config.JHipsterInfo; 4 | import io.quarkus.test.Mock; 5 | 6 | import jakarta.enterprise.context.ApplicationScoped; 7 | 8 | @Mock 9 | @ApplicationScoped 10 | public class JHipsterInfoMock implements JHipsterInfo { 11 | 12 | public static Boolean enable; 13 | 14 | @Override 15 | public Boolean isEnable() { 16 | return enable; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/docker/mysql.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | correctexam-mysql: 4 | image: mysql:8.0.20 5 | volumes: 6 | - ./../resources/db/migration/:/docker-entrypoint-initdb.d 7 | environment: 8 | - MYSQL_USER=root 9 | - MYSQL_ALLOW_EMPTY_PASSWORD=yes 10 | - MYSQL_DATABASE=correctexam 11 | command: mysqld --lower_case_table_names=1 --skip-ssl --character_set_server=utf8mb4 --explicit_defaults_for_timestamp 12 | ports: 13 | - 3306 14 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/InvalidPasswordException.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service; 2 | 3 | import static jakarta.ws.rs.core.Response.Status.BAD_REQUEST; 4 | 5 | import jakarta.ws.rs.WebApplicationException; 6 | import jakarta.ws.rs.core.Response; 7 | 8 | public class InvalidPasswordException extends WebApplicationException { 9 | 10 | public InvalidPasswordException() { 11 | super(Response.status(BAD_REQUEST).entity("Incorrect Password").build()); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/web/rest/errors/EmailNotFoundException.java: -------------------------------------------------------------------------------- 1 | package fr.istic.web.rest.errors; 2 | 3 | import static jakarta.ws.rs.core.Response.Status.BAD_REQUEST; 4 | 5 | import jakarta.ws.rs.WebApplicationException; 6 | import jakarta.ws.rs.core.Response; 7 | 8 | public class EmailNotFoundException extends WebApplicationException { 9 | 10 | public EmailNotFoundException() { 11 | super(Response.status(BAD_REQUEST).entity("Email address not registered").build()); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/EntityId.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto; 2 | 3 | import java.util.List; 4 | 5 | import io.quarkus.runtime.annotations.RegisterForReflection; 6 | 7 | @RegisterForReflection 8 | public class EntityId { 9 | 10 | public EntityId(Long id){ 11 | this.id = id; 12 | } 13 | 14 | Long id; 15 | 16 | public Long getId() { 17 | return this.id; 18 | } 19 | 20 | public void setIds(Long id) { 21 | this.id = id; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/resources/publicKey.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlivFI8qB4D0y2jy0CfEq 3 | Fyy46R0o7S8TKpsx5xbHKoU1VWg6QkQm+ntyIv1p4kE1sPEQO73+HY8+Bzs75XwR 4 | TYL1BmR1w8J5hmjVWjc6R2BTBGAYRPFRhor3kpM6ni2SPmNNhurEAHw7TaqszP5e 5 | UF/F9+KEBWkwVta+PZ37bwqSE4sCb1soZFrVz/UT/LF4tYpuVYt3YbqToZ3pZOZ9 6 | AX2o1GCG3xwOjkc4x0W7ezbQZdC9iftPxVHR8irOijJRRjcPDtA6vPKpzLl6CyYn 7 | sIYPd99ltwxTHjr3npfv/3Lw50bAkbT4HeLFxTx4flEoZLKO/g0bAoV2uqBhkA9x 8 | nQIDAQAB 9 | -----END PUBLIC KEY----- 10 | -------------------------------------------------------------------------------- /src/main/docker/Dockerfile.build.aarch64: -------------------------------------------------------------------------------- 1 | #FROM ghcr.io/graalvm/graalvm-ce:ol8-java17@sha256:25a7e2308e3425e59886fb6b7e1371389447773e2a0e82aa9e623cc9caf05321 AS build 2 | FROM ghcr.io/graalvm/graalvm-ce:ol8-java11@sha256:dc9effae9a92d50e0a173f1cb8113409a4b6d7fb0c44fcf2195f0e03d6161bc5 AS build 3 | #FROM docker pull ghcr.io/graalvm/graalvm-ce:ol7-java11@sha256:7f65440e5040251cf6c594dfb61b4b560709ad56e6612fb9b3ec515e9ce8318c as build 4 | RUN gu install native-image 5 | WORKDIR /project 6 | VOLUME ["/project"] 7 | ENTRYPOINT ["native-image"] 8 | 9 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/ListEmailProf.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import io.quarkus.runtime.annotations.RegisterForReflection; 7 | 8 | @RegisterForReflection 9 | public class ListEmailProf { 10 | private List emails = new ArrayList<>(); 11 | 12 | public List getEmails() { 13 | return emails; 14 | } 15 | public void setEmails(List emails) { 16 | this.emails = emails; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/resources/resources-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "resources": [ 3 | { 4 | "pattern": "jwt/privateKey.pem" 5 | }, 6 | { 7 | "pattern": "org/apache/pdfbox/resources/afm/*" 8 | }, 9 | { 10 | "pattern": "org/apache/pdfbox/resources/glyphlist/*" 11 | }, 12 | { 13 | "pattern": "org/apache/pdfbox/resources/icc/*" 14 | }, 15 | { 16 | "pattern": "org/apache/pdfbox/resources/text/*" 17 | }, 18 | { 19 | "pattern": "org/apache/pdfbox/resources/ttf/*" 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/web/rest/vm/KeyAndPasswordVM.java: -------------------------------------------------------------------------------- 1 | package fr.istic.web.rest.vm; 2 | 3 | import io.quarkus.runtime.annotations.RegisterForReflection; 4 | 5 | /** 6 | * View Model object for storing the user's key and password. 7 | */ 8 | @RegisterForReflection 9 | public class KeyAndPasswordVM { 10 | public String key; 11 | 12 | public String newPassword; 13 | 14 | @Override 15 | public String toString() { 16 | return "KeyAndPasswordVM{" + "key='" + key + '\'' + ", newPassword='" + newPassword + '\'' + '}'; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/docker/Dockerfile.arm64: -------------------------------------------------------------------------------- 1 | FROM registry.access.redhat.com/ubi8/ubi-minimal@sha256:c6592eb9cdd7ea7fa43beddf507ca2a8c2127f13ef66d49baea2fd28e37f62ba 2 | WORKDIR /work/ 3 | RUN chown 1001 /work \ 4 | && chmod "g+rwX" /work \ 5 | && chown 1001:root /work 6 | #COPY --chown=1001:root target/*-runner /work/application 7 | # COPY --chown=1001:root ./src/main/resources/db/migration/ /work/migration 8 | COPY target/*-runner /work/application 9 | RUN chmod 775 /work 10 | EXPOSE 8080 11 | USER 1001 12 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 13 | 14 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | 9 | # We recommend you to keep these unchanged 10 | end_of_line = lf 11 | charset = utf-8 12 | trim_trailing_whitespace = true 13 | insert_final_newline = true 14 | 15 | # Change these settings to your own preference 16 | indent_style = space 17 | indent_size = 4 18 | 19 | [*.{ts,tsx,js,jsx,json,css,scss,yml}] 20 | indent_size = 2 21 | 22 | [*.md] 23 | trim_trailing_whitespace = false 24 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/StudentResponseNote.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto; 2 | 3 | import io.quarkus.runtime.annotations.RegisterForReflection; 4 | 5 | @RegisterForReflection 6 | public class StudentResponseNote { 7 | private Double currentNote; 8 | 9 | public Double getCurrentNote() { return currentNote; } 10 | public void setCurrentNote(Double value) { this.currentNote = value; } 11 | @Override 12 | public String toString() { 13 | return "StudentResponseNote [currentNote=" + currentNote + "]"; 14 | } 15 | 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/web/rest/vm/ConfigPropsVM.java: -------------------------------------------------------------------------------- 1 | package fr.istic.web.rest.vm; 2 | 3 | import io.quarkus.runtime.annotations.RegisterForReflection; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | 7 | @RegisterForReflection 8 | public class ConfigPropsVM { 9 | public final Map contexts = new HashMap<>(); 10 | 11 | public ConfigPropsVM() { 12 | this.contexts.put("JHipster", new Context()); 13 | } 14 | 15 | @RegisterForReflection 16 | public class Context { 17 | public final Map beans = new HashMap<>(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/ClusterDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto; 2 | 3 | import java.util.List; 4 | import io.quarkus.runtime.annotations.RegisterForReflection; 5 | 6 | @RegisterForReflection 7 | public class ClusterDTO { 8 | private int templat; 9 | private List copies; 10 | 11 | public int getTemplat() { return templat; } 12 | public void setTemplat(int value) { this.templat = value; } 13 | 14 | public List getCopies() { return copies; } 15 | public void setCopies(List value) { this.copies = value; } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/exportpdf/Textcommentspdf.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto.exportpdf; 2 | 3 | import io.quarkus.runtime.annotations.RegisterForReflection; 4 | 5 | @RegisterForReflection 6 | public class Textcommentspdf { 7 | private String description; 8 | private String text; 9 | 10 | public String getDescription() { return description; } 11 | public void setDescription(String value) { this.description = value; } 12 | 13 | public String getText() { return text; } 14 | public void setText(String value) { this.text = value; } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/dto/ManagementInfoDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | import io.quarkus.runtime.annotations.RegisterForReflection; 4 | 5 | import jakarta.json.bind.annotation.JsonbProperty; 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | /** 10 | * DTO to emulate /management/info response 11 | */ 12 | @RegisterForReflection 13 | public class ManagementInfoDTO { 14 | 15 | public List activeProfiles = new ArrayList<>(); 16 | 17 | @JsonbProperty("display-ribbon-on-profiles") 18 | public String displayRibbonOnProfiles; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/resources/default_banner.txt: -------------------------------------------------------------------------------- 1 | 2 | ██╗ ██╗ ██╗ ████████╗ ███████╗ ██████╗ ████████╗ ████████╗ ███████╗ 3 | ██║ ██║ ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗ 4 | ██║ ████████║ ██║ ███████╔╝ ╚█████╗ ██║ ██████╗ ███████╔╝ 5 | ██╗ ██║ ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║ 6 | ╚██████╔╝ ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗ 7 | ╚═════╝ ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝ 8 | 9 | :: JHipster 🤓 :: https://www.jhipster.tech :: 10 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/StudentMassDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto; 2 | 3 | import java.util.List; 4 | 5 | import io.quarkus.runtime.annotations.RegisterForReflection; 6 | 7 | @RegisterForReflection 8 | public class StudentMassDTO { 9 | private long course; 10 | private List students; 11 | 12 | public long getCourse() { return course; } 13 | public void setCourse(long value) { this.course = value; } 14 | 15 | public List getStudents() { return students; } 16 | public void setStudents(List value) { this.students = value; } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/exportcomments/Prediction.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto.exportcomments; 2 | 3 | import io.quarkus.runtime.annotations.RegisterForReflection; 4 | 5 | @RegisterForReflection 6 | public class Prediction { 7 | private String text; 8 | private Double predictionconfidence; 9 | 10 | public String getText() { return text; } 11 | public void setText(String value) { this.text = value; } 12 | 13 | public Double getPredictionconfidence() { return predictionconfidence; } 14 | public void setPredictionconfidence(Double value) { this.predictionconfidence = value; } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/config/FooSerializer.java: -------------------------------------------------------------------------------- 1 | package fr.istic.config; 2 | 3 | import java.util.Base64; 4 | 5 | import jakarta.json.bind.serializer.JsonbSerializer; 6 | import jakarta.json.bind.serializer.SerializationContext; 7 | 8 | 9 | public class FooSerializer implements JsonbSerializer { 10 | 11 | @Override 12 | public void serialize(byte[] obj, jakarta.json.stream.JsonGenerator generator, SerializationContext ctx) { 13 | Base64.Encoder encoder = Base64.getEncoder(); 14 | byte[] encodedContent = encoder.encode(obj); 15 | generator.write( new String(encodedContent)); 16 | 17 | } 18 | 19 | 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/web/rest/errors/BadRequestAlertException.java: -------------------------------------------------------------------------------- 1 | package fr.istic.web.rest.errors; 2 | 3 | import static jakarta.ws.rs.core.Response.Status.BAD_REQUEST; 4 | 5 | import jakarta.ws.rs.WebApplicationException; 6 | import jakarta.ws.rs.core.Response; 7 | 8 | public class BadRequestAlertException extends WebApplicationException { 9 | private static final long serialVersionUID = 1L; 10 | 11 | public BadRequestAlertException(String message, String entityName, String errorKey) { 12 | super(Response.status(BAD_REQUEST).entity(message).header("message", "error." + errorKey).header("params", entityName).build()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /checkstyle.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/data/user.csv: -------------------------------------------------------------------------------- 1 | id;login;password_hash;first_name;last_name;email;image_url;activated;lang_key;created_by;last_modified_by 2 | 1;system;$2a$10$mE.qmcV0mFU5NcKh73TZx.z4ueI/.bDWbj0T1BYyqP481kGGarKLG;System;System;system@localhost;;true;fr;system;system 3 | 2;anonymoususer;$2a$10$j8S5d7Sr7.8VTOYNviDPOeWX8KcYILUVJBsYV83Y5NtECayypx9lO;Anonymous;User;anonymous@localhost;;true;fr;system;system 4 | 3;admin;$2a$10$gSAhZrxMllrbgj/kkK9UceBPpChGWJA7SYIb1Mqo.n5aNLq1/oRrC;Administrator;Administrator;admin@localhost;;true;fr;system;system 5 | 4;user;$2a$10$VEjxo0jq2YG9Rbk2HmX9S.k1uZBGYUHdUcid3g/vfiEl7lwWgOH/K;User;User;user@localhost;;true;fr;system;system 6 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/config/Constants.java: -------------------------------------------------------------------------------- 1 | package fr.istic.config; 2 | 3 | /** 4 | * Application constants. 5 | */ 6 | public final class Constants { 7 | // Regex for acceptable logins 8 | public static final String LOGIN_REGEX = "^[_.@A-Za-z0-9-]*$"; 9 | 10 | public static final String SYSTEM_ACCOUNT = "system"; 11 | public static final String ANONYMOUS_USER = "anonymoususer"; 12 | 13 | public static final String DEFAULT_LANGUAGE = "en"; 14 | 15 | public static final String DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; 16 | 17 | public static final String LOCAL_DATE_FORMAT = "yyyy-MM-dd"; 18 | private Constants() {} 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/data/usertest.csv: -------------------------------------------------------------------------------- 1 | id;login;password_hash;first_name;last_name;email;image_url;activated;lang_key;created_by;last_modified_by 2 | 101;system;$2a$10$mE.qmcV0mFU5NcKh73TZx.z4ueI/.bDWbj0T1BYyqP481kGGarKLG;System;System;system@localhost;;true;fr;system;system 3 | 102;anonymoususer;$2a$10$j8S5d7Sr7.8VTOYNviDPOeWX8KcYILUVJBsYV83Y5NtECayypx9lO;Anonymous;User;anonymous@localhost;;true;fr;system;system 4 | 103;admin;$2a$10$gSAhZrxMllrbgj/kkK9UceBPpChGWJA7SYIb1Mqo.n5aNLq1/oRrC;Administrator;Administrator;admin@localhost;;true;fr;system;system 5 | 104;user;$2a$10$VEjxo0jq2YG9Rbk2HmX9S.k1uZBGYUHdUcid3g/vfiEl7lwWgOH/K;User;User;user@localhost;;true;fr;system;system 6 | -------------------------------------------------------------------------------- /src/main/resources/reflection-config.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name" : "org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler", 4 | "allDeclaredConstructors" : true, 5 | "allPublicConstructors" : true, 6 | "allDeclaredMethods" : true, 7 | "allPublicMethods" : true, 8 | "allDeclaredFields" : true, 9 | "allPublicFields" : true 10 | }, 11 | { 12 | "name" : "liquibase.command.core.StartH2CommandStep", 13 | "allDeclaredConstructors" : true, 14 | "allPublicConstructors" : true, 15 | "allDeclaredMethods" : true, 16 | "allPublicMethods" : true, 17 | "allDeclaredFields" : true, 18 | "allPublicFields" : true 19 | } 20 | 21 | ] 22 | -------------------------------------------------------------------------------- /src/main/docker/Dockerfile.front: -------------------------------------------------------------------------------- 1 | FROM node:18-alpine as build-step 2 | WORKDIR /app 3 | ENV NG_CLI_ANALYTICS=ci 4 | RUN apk update && apk upgrade && \ 5 | apk add --no-cache bash git cairo pango jpeg giflib python3 pkgconfig build-base g++ cairo-dev jpeg-dev pango-dev giflib-dev 6 | RUN git clone https://github.com/correctexam/corrigeExamFront 7 | WORKDIR /app/corrigeExamFront 8 | RUN npm install --force 9 | RUN npm run webapp:build:prod 10 | # change the npm run targer depending of the config 11 | 12 | 13 | #FROM bunkerity/bunkerized-nginx as prod 14 | FROM nginx as prod 15 | COPY --from=build-step /app/corrigeExamFront/target/classes/static /usr/share/nginx/html 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/main/docker/k8s/front-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | labels: 5 | fr.correctexam.service: front 6 | name: front 7 | namespace: correctexam 8 | spec: 9 | replicas: 1 10 | selector: 11 | matchLabels: 12 | fr.correctexam.service: front 13 | strategy: 14 | type: Recreate 15 | template: 16 | metadata: 17 | labels: 18 | fr.correctexam.service: front 19 | spec: 20 | containers: 21 | - image: localhost:32000/barais/correctexam-front 22 | name: front 23 | ports: 24 | - containerPort: 80 25 | resources: {} 26 | restartPolicy: Always 27 | status: {} 28 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/config/FooDeserializer.java: -------------------------------------------------------------------------------- 1 | package fr.istic.config; 2 | 3 | import java.lang.reflect.Type; 4 | import java.util.Base64; 5 | 6 | import jakarta.json.bind.serializer.DeserializationContext; 7 | import jakarta.json.bind.serializer.JsonbDeserializer; 8 | import jakarta.json.stream.JsonParser; 9 | 10 | public class FooDeserializer implements JsonbDeserializer { 11 | 12 | @Override 13 | public byte[] deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) { 14 | Base64.Decoder decoder = Base64.getDecoder(); 15 | byte[] decodedContent = decoder.decode(parser.getString()); 16 | return decodedContent; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/mapper/ZoneMapper.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.mapper; 2 | 3 | 4 | import fr.istic.domain.*; 5 | import fr.istic.service.dto.ZoneDTO; 6 | 7 | import org.mapstruct.*; 8 | 9 | /** 10 | * Mapper for the entity {@link Zone} and its DTO {@link ZoneDTO}. 11 | */ 12 | @Mapper(componentModel = "jakarta", uses = {}, injectionStrategy = InjectionStrategy.CONSTRUCTOR) 13 | public interface ZoneMapper extends EntityMapper { 14 | 15 | 16 | 17 | default Zone fromId(Long id) { 18 | if (id == null) { 19 | return null; 20 | } 21 | Zone zone = new Zone(); 22 | zone.id = id; 23 | return zone; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/web/rest/errors/UserNotAuthenticatedException.java: -------------------------------------------------------------------------------- 1 | package fr.istic.web.rest.errors; 2 | 3 | import static jakarta.ws.rs.core.Response.Status.UNAUTHORIZED; 4 | 5 | import jakarta.ws.rs.WebApplicationException; 6 | import jakarta.ws.rs.core.Response; 7 | 8 | public class UserNotAuthenticatedException extends WebApplicationException { 9 | private static final long serialVersionUID = 1L; 10 | 11 | public UserNotAuthenticatedException() { 12 | this("Authentication is required"); 13 | } 14 | 15 | public UserNotAuthenticatedException(String message) { 16 | super(Response.status(UNAUTHORIZED).entity(message).entity(message).build()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/dto/PasswordChangeDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | import io.quarkus.runtime.annotations.RegisterForReflection; 4 | 5 | /** 6 | * A DTO representing a password change required data - current and new password. 7 | */ 8 | @RegisterForReflection 9 | public class PasswordChangeDTO { 10 | public String currentPassword; 11 | public String newPassword; 12 | 13 | public PasswordChangeDTO() { 14 | // Empty constructor needed for Jackson. 15 | } 16 | 17 | public PasswordChangeDTO(String currentPassword, String newPassword) { 18 | this.currentPassword = currentPassword; 19 | this.newPassword = newPassword; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/resources/templates/mail/creationEmail.html: -------------------------------------------------------------------------------- 1 | {@fr.istic.domain.User user} 2 | 3 | 4 | 5 | CorrectExam creation 6 | 7 | 8 | 9 | 10 |

11 | Dear {user.login} 12 |

13 |

14 | Your CorrectExam account has been created, please click on the URL below to access it: 15 |

16 |

17 | Login Link 18 |

19 |

20 | Regards, 21 |
22 | CorrectExam. 23 |

24 | 25 | 26 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/domain/UserTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.domain; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import fr.istic.TestUtil; 6 | import org.junit.jupiter.api.Test; 7 | 8 | public class UserTest { 9 | 10 | @Test 11 | public void testUserEquals() throws Exception { 12 | TestUtil.equalsVerifier(User.class); 13 | var user1 = new User(); 14 | user1.id = 1l; 15 | var user2 = new User(); 16 | user2.id = user1.id; 17 | assertThat(user1).isEqualTo(user2); 18 | user2.id = 2l; 19 | assertThat(user1).isNotEqualTo(user2); 20 | user1.id = null; 21 | assertThat(user1).isNotEqualTo(user2); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/resources/templates/mail/activationEmail.html: -------------------------------------------------------------------------------- 1 | {@fr.istic.domain.User user} 2 | 3 | 4 | 5 | CorrectExam activation 6 | 7 | 8 | 9 | 10 |

11 | Dear {user.login} 12 |

13 |

14 | Your CorrectExam account has been created, please click on the URL below to activate it: 15 |

16 |

17 | Login Link 18 |

19 |

20 | Regards, 21 |
22 | CorrectExam team. 23 |

24 | 25 | 26 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/domain/ExamTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.domain; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import fr.istic.TestUtil; 6 | import org.junit.jupiter.api.Test; 7 | 8 | 9 | public class ExamTest { 10 | 11 | @Test 12 | public void equalsVerifier() throws Exception { 13 | TestUtil.equalsVerifier(Exam.class); 14 | Exam exam1 = new Exam(); 15 | exam1.id = 1L; 16 | Exam exam2 = new Exam(); 17 | exam2.id = exam1.id; 18 | assertThat(exam1).isEqualTo(exam2); 19 | exam2.id = 2L; 20 | assertThat(exam1).isNotEqualTo(exam2); 21 | exam1.id = null; 22 | assertThat(exam1).isNotEqualTo(exam2); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/domain/ScanTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.domain; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import fr.istic.TestUtil; 6 | import org.junit.jupiter.api.Test; 7 | 8 | 9 | public class ScanTest { 10 | 11 | @Test 12 | public void equalsVerifier() throws Exception { 13 | TestUtil.equalsVerifier(Scan.class); 14 | Scan scan1 = new Scan(); 15 | scan1.id = 1L; 16 | Scan scan2 = new Scan(); 17 | scan2.id = scan1.id; 18 | assertThat(scan1).isEqualTo(scan2); 19 | scan2.id = 2L; 20 | assertThat(scan1).isNotEqualTo(scan2); 21 | scan1.id = null; 22 | assertThat(scan1).isNotEqualTo(scan2); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/domain/ZoneTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.domain; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import fr.istic.TestUtil; 6 | import org.junit.jupiter.api.Test; 7 | 8 | 9 | public class ZoneTest { 10 | 11 | @Test 12 | public void equalsVerifier() throws Exception { 13 | TestUtil.equalsVerifier(Zone.class); 14 | Zone zone1 = new Zone(); 15 | zone1.id = 1L; 16 | Zone zone2 = new Zone(); 17 | zone2.id = zone1.id; 18 | assertThat(zone1).isEqualTo(zone2); 19 | zone2.id = 2L; 20 | assertThat(zone1).isNotEqualTo(zone2); 21 | zone1.id = null; 22 | assertThat(zone1).isNotEqualTo(zone2); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/answernotebooks/QuestionNoteBook.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto.answernotebooks; 2 | 3 | import io.quarkus.runtime.annotations.RegisterForReflection; 4 | 5 | @RegisterForReflection 6 | public class QuestionNoteBook { 7 | private Integer numero; 8 | private Double note; 9 | private Double notemax; 10 | 11 | public Integer getNumero() { return numero; } 12 | public void setNumero(Integer value) { this.numero = value; } 13 | 14 | public Double getNote() { return note; } 15 | public void setNote(Double value) { this.note = value; } 16 | 17 | public Double getNotemax() { return notemax; } 18 | public void setNotemax(Double value) { this.notemax = value; } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/templates/mail/passwordResetEmail.html: -------------------------------------------------------------------------------- 1 | {@fr.istic.domain.User user} 2 | 3 | 4 | 5 | CorrectExam password reset 6 | 7 | 8 | 9 | 10 |

11 | Dear {user.login} 12 |

13 |

14 | For your CorrectExam account a password reset was requested, please click on the URL below to reset it: 15 |

16 |

17 | Login Link 18 |

19 |

20 | Regards, 21 |
22 | CorrectExam. 23 |

24 | 25 | 26 | -------------------------------------------------------------------------------- /src/main/docker/k8s/myadmin-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | labels: 5 | fr.correctexam.service: myadmin 6 | name: myadmin 7 | namespace: correctexam 8 | spec: 9 | replicas: 1 10 | selector: 11 | matchLabels: 12 | fr.correctexam.service: myadmin 13 | strategy: {} 14 | template: 15 | metadata: 16 | labels: 17 | fr.correctexam.service: myadmin 18 | spec: 19 | containers: 20 | - env: 21 | - name: PMA_HOST 22 | value: correctexam-mysql 23 | image: phpmyadmin 24 | name: myadmin 25 | ports: 26 | - containerPort: 80 27 | resources: {} 28 | restartPolicy: Always 29 | status: {} 30 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/domain/CourseTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.domain; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import fr.istic.TestUtil; 6 | import org.junit.jupiter.api.Test; 7 | 8 | 9 | public class CourseTest { 10 | 11 | @Test 12 | public void equalsVerifier() throws Exception { 13 | TestUtil.equalsVerifier(Course.class); 14 | Course course1 = new Course(); 15 | course1.id = 1L; 16 | Course course2 = new Course(); 17 | course2.id = course1.id; 18 | assertThat(course1).isEqualTo(course2); 19 | course2.id = 2L; 20 | assertThat(course1).isNotEqualTo(course2); 21 | course1.id = null; 22 | assertThat(course1).isNotEqualTo(course2); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/exportcomments/Comment.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto.exportcomments; 2 | 3 | import io.quarkus.runtime.annotations.RegisterForReflection; 4 | 5 | @RegisterForReflection 6 | 7 | public class Comment { 8 | private String text; 9 | private String description; 10 | private Double noteComments; 11 | 12 | public String getText() { return text; } 13 | public void setText(String value) { this.text = value; } 14 | 15 | public String getDescription() { return description; } 16 | public void setDescription(String value) { this.description = value; } 17 | 18 | public Double getNoteComments() { return noteComments; } 19 | public void setNoteComments(Double value) { this.noteComments = value; } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/web/rest/vm/LoginVM.java: -------------------------------------------------------------------------------- 1 | package fr.istic.web.rest.vm; 2 | 3 | import io.quarkus.runtime.annotations.RegisterForReflection; 4 | 5 | import jakarta.validation.constraints.NotNull; 6 | import jakarta.validation.constraints.Size; 7 | 8 | /** 9 | * View Model object for storing a user's credentials. 10 | */ 11 | @RegisterForReflection 12 | public class LoginVM { 13 | @NotNull 14 | @Size(min = 1, max = 50) 15 | public String username; 16 | 17 | @NotNull 18 | @Size(min = 4, max = 100) 19 | public String password; 20 | 21 | public Boolean rememberMe; 22 | 23 | @Override 24 | public String toString() { 25 | return "LoginVM{" + "username='" + username + '\'' + ", rememberMe=" + rememberMe + '}'; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /web.xml.dev: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | My Web Application 8 | 9 | 10 | h2-console 11 | org.h2.server.web.WebServlet 12 | 13 | webAllowOthers 14 | true 15 | 16 | 17 | 18 | 19 | h2-console 20 | /h2-console/* 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /.jhipster/QuestionType.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "QuestionType", 3 | "fields": [ 4 | { 5 | "fieldName": "algoName", 6 | "fieldType": "String", 7 | "fieldValidateRules": ["required"] 8 | }, 9 | { 10 | "fieldName": "endpoint", 11 | "fieldType": "String" 12 | }, 13 | { 14 | "fieldName": "jsFunction", 15 | "fieldType": "String" 16 | } 17 | ], 18 | "relationships": [], 19 | "changelogDate": "20220311140708", 20 | "entityTableName": "question_type", 21 | "dto": "mapstruct", 22 | "pagination": "pagination", 23 | "service": "serviceClass", 24 | "jpaMetamodelFiltering": false, 25 | "fluentMethods": true, 26 | "readOnly": false, 27 | "embedded": false, 28 | "clientRootFolder": "", 29 | "applications": "*" 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/domain/StudentTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.domain; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import fr.istic.TestUtil; 6 | import org.junit.jupiter.api.Test; 7 | 8 | 9 | public class StudentTest { 10 | 11 | @Test 12 | public void equalsVerifier() throws Exception { 13 | TestUtil.equalsVerifier(Student.class); 14 | Student student1 = new Student(); 15 | student1.id = 1L; 16 | Student student2 = new Student(); 17 | student2.id = student1.id; 18 | assertThat(student1).isEqualTo(student2); 19 | student2.id = 2L; 20 | assertThat(student1).isNotEqualTo(student2); 21 | student1.id = null; 22 | assertThat(student1).isNotEqualTo(student2); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/config/hibernate/JHipsterCompatibleImplicitNamingStrategy.java: -------------------------------------------------------------------------------- 1 | package fr.istic.config.hibernate; 2 | 3 | import org.hibernate.boot.model.naming.Identifier; 4 | import org.hibernate.boot.model.naming.ImplicitJoinTableNameSource; 5 | import org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl; 6 | 7 | public class JHipsterCompatibleImplicitNamingStrategy extends ImplicitNamingStrategyJpaCompliantImpl { 8 | 9 | @Override 10 | public Identifier determineJoinTableName(ImplicitJoinTableNameSource source) { 11 | String joinedName = String.join("_", source.getOwningPhysicalTableName(), source.getAssociationOwningAttributePath().getProperty()); 12 | return toIdentifier(joinedName, source.getBuildingContext()); 13 | } 14 | 15 | } 16 | 17 | -------------------------------------------------------------------------------- /web.xml.prod: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | My Web Application 8 | 9 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/mapper/QuestionTypeMapper.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.mapper; 2 | 3 | 4 | import fr.istic.domain.*; 5 | import fr.istic.service.dto.QuestionTypeDTO; 6 | 7 | import org.mapstruct.*; 8 | 9 | /** 10 | * Mapper for the entity {@link QuestionType} and its DTO {@link QuestionTypeDTO}. 11 | */ 12 | @Mapper(componentModel = "jakarta", uses = {}, injectionStrategy = InjectionStrategy.CONSTRUCTOR) 13 | public interface QuestionTypeMapper extends EntityMapper { 14 | 15 | 16 | 17 | default QuestionType fromId(Long id) { 18 | if (id == null) { 19 | return null; 20 | } 21 | QuestionType questionType = new QuestionType(); 22 | questionType.id = id; 23 | return questionType; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/web/util/ResponseUtil.java: -------------------------------------------------------------------------------- 1 | package fr.istic.web.util; 2 | 3 | import java.util.Collections; 4 | import java.util.Map; 5 | import java.util.Optional; 6 | import jakarta.ws.rs.core.Response; 7 | 8 | public interface ResponseUtil { 9 | static Response wrapOrNotFound(Optional maybeResponse) { 10 | return wrapOrNotFound(maybeResponse, Collections.emptyMap()); 11 | } 12 | 13 | static Response wrapOrNotFound(Optional maybeResponse, Map header) { 14 | Response.ResponseBuilder response = (Response.ResponseBuilder) maybeResponse 15 | .map(value -> Response.ok(value)) 16 | .orElse(Response.status(Response.Status.NOT_FOUND)); 17 | header.forEach(response::header); 18 | return response.build(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/web/rest/vm/PageRequestVM.java: -------------------------------------------------------------------------------- 1 | package fr.istic.web.rest.vm; 2 | 3 | import io.quarkus.panache.common.Page; 4 | 5 | import jakarta.validation.constraints.Positive; 6 | import jakarta.ws.rs.DefaultValue; 7 | import jakarta.ws.rs.QueryParam; 8 | 9 | public class PageRequestVM { 10 | 11 | @QueryParam("page") 12 | @DefaultValue("0") 13 | @Positive 14 | public int index; 15 | 16 | @QueryParam("size") 17 | @DefaultValue("500") 18 | @Positive 19 | public int size; 20 | 21 | public Page toPage() { 22 | return Page.of(index, size); 23 | } 24 | 25 | @Override 26 | public String toString() { 27 | return "PageRequestVM{" + 28 | "page=" + index + 29 | ", size=" + size + 30 | '}'; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/domain/CommentsTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.domain; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import fr.istic.TestUtil; 6 | import org.junit.jupiter.api.Test; 7 | 8 | 9 | public class CommentsTest { 10 | 11 | @Test 12 | public void equalsVerifier() throws Exception { 13 | TestUtil.equalsVerifier(Comments.class); 14 | Comments comments1 = new Comments(); 15 | comments1.id = 1L; 16 | Comments comments2 = new Comments(); 17 | comments2.id = comments1.id; 18 | assertThat(comments1).isEqualTo(comments2); 19 | comments2.id = 2L; 20 | assertThat(comments1).isNotEqualTo(comments2); 21 | comments1.id = null; 22 | assertThat(comments1).isNotEqualTo(comments2); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/domain/QuestionTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.domain; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import fr.istic.TestUtil; 6 | import org.junit.jupiter.api.Test; 7 | 8 | 9 | public class QuestionTest { 10 | 11 | @Test 12 | public void equalsVerifier() throws Exception { 13 | TestUtil.equalsVerifier(Question.class); 14 | Question question1 = new Question(); 15 | question1.id = 1L; 16 | Question question2 = new Question(); 17 | question2.id = question1.id; 18 | assertThat(question1).isEqualTo(question2); 19 | question2.id = 2L; 20 | assertThat(question1).isNotEqualTo(question2); 21 | question1.id = null; 22 | assertThat(question1).isNotEqualTo(question2); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/domain/TemplateTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.domain; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import fr.istic.TestUtil; 6 | import org.junit.jupiter.api.Test; 7 | 8 | 9 | public class TemplateTest { 10 | 11 | @Test 12 | public void equalsVerifier() throws Exception { 13 | TestUtil.equalsVerifier(Template.class); 14 | Template template1 = new Template(); 15 | template1.id = 1L; 16 | Template template2 = new Template(); 17 | template2.id = template1.id; 18 | assertThat(template1).isEqualTo(template2); 19 | template2.id = 2L; 20 | assertThat(template1).isNotEqualTo(template2); 21 | template1.id = null; 22 | assertThat(template1).isNotEqualTo(template2); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /standalone.md: -------------------------------------------------------------------------------- 1 | # Standalone version 2 | 3 | This documentation could be used to build and deploy a local version of CorrectExam. It could be used to correct exam offline and export the results, import them to correctexam.github.io to share results to students. 4 | 5 | ## build 6 | 7 | ```bash 8 | git clone https://github.com/correctexam/corrigeExamFront 9 | cd corrigeExamFront 10 | npm i 11 | npm run webapp:build:prodlocal 12 | cd .. 13 | git clone https://github.com/correctexam/corrigeExamBack 14 | cd corrigeExamBack 15 | cp -r ../corrigeExamFront/target/classes/static/* src/main/resources/META-INF/resources/ 16 | ./mvnw package -Pnative,alone -DskipTests 17 | ``` 18 | 19 | in target you get a self content binary *correctexam-1.0.0-SNAPSHOT-runner* that could be used in any laptop to test correctexam offlile. 20 | 21 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/domain/ExamSheetTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.domain; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import fr.istic.TestUtil; 6 | import org.junit.jupiter.api.Test; 7 | 8 | 9 | public class ExamSheetTest { 10 | 11 | @Test 12 | public void equalsVerifier() throws Exception { 13 | TestUtil.equalsVerifier(ExamSheet.class); 14 | ExamSheet examSheet1 = new ExamSheet(); 15 | examSheet1.id = 1L; 16 | ExamSheet examSheet2 = new ExamSheet(); 17 | examSheet2.id = examSheet1.id; 18 | assertThat(examSheet1).isEqualTo(examSheet2); 19 | examSheet2.id = 2L; 20 | assertThat(examSheet1).isNotEqualTo(examSheet2); 21 | examSheet1.id = null; 22 | assertThat(examSheet1).isNotEqualTo(examSheet2); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/mapper/ScanContentMapper.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.mapper; 2 | 3 | 4 | import fr.istic.domain.*; 5 | import fr.istic.service.dto.ScanDTOContent; 6 | 7 | import org.mapstruct.*; 8 | 9 | /** 10 | * Mapper for the entity {@link Scan} and its DTO {@link ScanDTOContent}. 11 | */ 12 | @Mapper(componentModel = "jakarta", uses = {}, injectionStrategy = InjectionStrategy.CONSTRUCTOR) 13 | public interface ScanContentMapper extends EntityMapper { 14 | 15 | 16 | @Mapping(target = "sheets", ignore = true) 17 | Scan toEntity(ScanDTOContent scanDTO); 18 | 19 | default Scan fromId(Long id) { 20 | if (id == null) { 21 | return null; 22 | } 23 | Scan scan = new Scan(); 24 | scan.id = id; 25 | return scan; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/answernotebooks/AnswersNoteBook.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto.answernotebooks; 2 | 3 | import java.util.List; 4 | import io.quarkus.runtime.annotations.RegisterForReflection; 5 | @RegisterForReflection 6 | public class AnswersNoteBook { 7 | private Long examId; 8 | private String sheetName; 9 | private List questions; 10 | 11 | public Long getExamId() { return examId; } 12 | public void setExamId(Long value) { this.examId = value; } 13 | 14 | public String getSheetName() { return sheetName; } 15 | public void setSheetName(String value) { this.sheetName = value; } 16 | 17 | public List getQuestions() { return questions; } 18 | public void setQuestions(List value) { this.questions = value; } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/config/JsonbConfiguration.java: -------------------------------------------------------------------------------- 1 | package fr.istic.config; 2 | 3 | import io.quarkus.jsonb.JsonbConfigCustomizer; 4 | 5 | import jakarta.inject.Singleton; 6 | import jakarta.json.bind.JsonbConfig; 7 | import java.util.Locale; 8 | 9 | /** 10 | * Jsonb Configuration 11 | * Further details https://quarkus.io/guides/rest-json#configuring-json-support 12 | */ 13 | @Singleton 14 | public class JsonbConfiguration implements JsonbConfigCustomizer { 15 | 16 | @Override 17 | public void customize(JsonbConfig config) { 18 | config 19 | .withDateFormat(Constants.DATE_TIME_FORMAT, Locale.getDefault()); 20 | config.withSerializers(new FooSerializer()); 21 | config.withDeserializers(new FooDeserializer()); 22 | 23 | //config.withSerializers(new FooSerializer()); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/mapper/ScanMapper.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.mapper; 2 | 3 | 4 | import fr.istic.domain.*; 5 | import fr.istic.service.dto.ScanDTO; 6 | 7 | import org.mapstruct.*; 8 | 9 | /** 10 | * Mapper for the entity {@link Scan} and its DTO {@link ScanDTO}. 11 | */ 12 | @Mapper(componentModel = "jakarta", uses = {}, injectionStrategy = InjectionStrategy.CONSTRUCTOR) 13 | public interface ScanMapper extends EntityMapper { 14 | 15 | 16 | @Mapping(target = "sheets", ignore = true) 17 | @Mapping(target = "content", ignore = true) 18 | Scan toEntity(ScanDTO scanDTO); 19 | 20 | default Scan fromId(Long id) { 21 | if (id == null) { 22 | return null; 23 | } 24 | Scan scan = new Scan(); 25 | scan.id = id; 26 | return scan; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/service/dto/ExamDTOTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import static org.assertj.core.api.Assertions.assertThat; 5 | import fr.istic.TestUtil; 6 | 7 | public class ExamDTOTest { 8 | 9 | @Test 10 | public void dtoEqualsVerifier() throws Exception { 11 | TestUtil.equalsVerifier(ExamDTO.class); 12 | ExamDTO examDTO1 = new ExamDTO(); 13 | examDTO1.id = 1L; 14 | ExamDTO examDTO2 = new ExamDTO(); 15 | assertThat(examDTO1).isNotEqualTo(examDTO2); 16 | examDTO2.id = examDTO1.id; 17 | assertThat(examDTO1).isEqualTo(examDTO2); 18 | examDTO2.id = 2L; 19 | assertThat(examDTO1).isNotEqualTo(examDTO2); 20 | examDTO1.id = null; 21 | assertThat(examDTO1).isNotEqualTo(examDTO2); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/service/dto/ScanDTOTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import static org.assertj.core.api.Assertions.assertThat; 5 | import fr.istic.TestUtil; 6 | 7 | public class ScanDTOTest { 8 | 9 | @Test 10 | public void dtoEqualsVerifier() throws Exception { 11 | TestUtil.equalsVerifier(ScanDTO.class); 12 | ScanDTO scanDTO1 = new ScanDTO(); 13 | scanDTO1.id = 1L; 14 | ScanDTO scanDTO2 = new ScanDTO(); 15 | assertThat(scanDTO1).isNotEqualTo(scanDTO2); 16 | scanDTO2.id = scanDTO1.id; 17 | assertThat(scanDTO1).isEqualTo(scanDTO2); 18 | scanDTO2.id = 2L; 19 | assertThat(scanDTO1).isNotEqualTo(scanDTO2); 20 | scanDTO1.id = null; 21 | assertThat(scanDTO1).isNotEqualTo(scanDTO2); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/service/dto/ZoneDTOTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import static org.assertj.core.api.Assertions.assertThat; 5 | import fr.istic.TestUtil; 6 | 7 | public class ZoneDTOTest { 8 | 9 | @Test 10 | public void dtoEqualsVerifier() throws Exception { 11 | TestUtil.equalsVerifier(ZoneDTO.class); 12 | ZoneDTO zoneDTO1 = new ZoneDTO(); 13 | zoneDTO1.id = 1L; 14 | ZoneDTO zoneDTO2 = new ZoneDTO(); 15 | assertThat(zoneDTO1).isNotEqualTo(zoneDTO2); 16 | zoneDTO2.id = zoneDTO1.id; 17 | assertThat(zoneDTO1).isEqualTo(zoneDTO2); 18 | zoneDTO2.id = 2L; 19 | assertThat(zoneDTO1).isNotEqualTo(zoneDTO2); 20 | zoneDTO1.id = null; 21 | assertThat(zoneDTO1).isNotEqualTo(zoneDTO2); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/exportcomments/AnswersWithPredictionDto.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto.exportcomments; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import io.quarkus.runtime.annotations.RegisterForReflection; 7 | 8 | @RegisterForReflection 9 | 10 | public class AnswersWithPredictionDto { 11 | private Double maxgrade; 12 | private Long qid; 13 | private List answer = new ArrayList<>(); 14 | 15 | public Double getMaxgrade() { return maxgrade; } 16 | public void setMaxgrade(Double value) { this.maxgrade = value; } 17 | 18 | public Long getQid() { return qid; } 19 | public void setQid(Long value) { this.qid = value; } 20 | 21 | public List getAnswer() { return answer; } 22 | public void setAnswer(List value) { this.answer = value; } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/mapper/StudentMapper.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.mapper; 2 | 3 | 4 | import fr.istic.domain.*; 5 | import fr.istic.service.dto.StudentDTO; 6 | 7 | import org.mapstruct.*; 8 | 9 | /** 10 | * Mapper for the entity {@link Student} and its DTO {@link StudentDTO}. 11 | */ 12 | @Mapper(componentModel = "jakarta", uses = {ExamSheetMapper.class}, injectionStrategy = InjectionStrategy.CONSTRUCTOR) 13 | public interface StudentMapper extends EntityMapper { 14 | 15 | 16 | @Mapping(target = "groups", ignore = true) 17 | Student toEntity(StudentDTO studentDTO); 18 | 19 | default Student fromId(Long id) { 20 | if (id == null) { 21 | return null; 22 | } 23 | Student student = new Student(); 24 | student.id = id; 25 | return student; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/ListUserModelShare.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import io.quarkus.runtime.annotations.RegisterForReflection; 7 | 8 | @RegisterForReflection 9 | public class ListUserModelShare { 10 | private List shared = new ArrayList<>(); 11 | private List availables= new ArrayList<>();; 12 | 13 | public List getShared() { 14 | return shared; 15 | } 16 | public void setShared(List shared) { 17 | this.shared = shared; 18 | } 19 | public List getAvailables() { 20 | return availables; 21 | } 22 | public void setAvailables(List availables) { 23 | this.availables = availables; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/domain/CourseGroupTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.domain; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import fr.istic.TestUtil; 6 | import org.junit.jupiter.api.Test; 7 | 8 | 9 | public class CourseGroupTest { 10 | 11 | @Test 12 | public void equalsVerifier() throws Exception { 13 | TestUtil.equalsVerifier(CourseGroup.class); 14 | CourseGroup courseGroup1 = new CourseGroup(); 15 | courseGroup1.id = 1L; 16 | CourseGroup courseGroup2 = new CourseGroup(); 17 | courseGroup2.id = courseGroup1.id; 18 | assertThat(courseGroup1).isEqualTo(courseGroup2); 19 | courseGroup2.id = 2L; 20 | assertThat(courseGroup1).isNotEqualTo(courseGroup2); 21 | courseGroup1.id = null; 22 | assertThat(courseGroup1).isNotEqualTo(courseGroup2); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/domain/FinalResultTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.domain; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import fr.istic.TestUtil; 6 | import org.junit.jupiter.api.Test; 7 | 8 | 9 | public class FinalResultTest { 10 | 11 | @Test 12 | public void equalsVerifier() throws Exception { 13 | TestUtil.equalsVerifier(FinalResult.class); 14 | FinalResult finalResult1 = new FinalResult(); 15 | finalResult1.id = 1L; 16 | FinalResult finalResult2 = new FinalResult(); 17 | finalResult2.id = finalResult1.id; 18 | assertThat(finalResult1).isEqualTo(finalResult2); 19 | finalResult2.id = 2L; 20 | assertThat(finalResult1).isNotEqualTo(finalResult2); 21 | finalResult1.id = null; 22 | assertThat(finalResult1).isNotEqualTo(finalResult2); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/domain/TextCommentTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.domain; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import fr.istic.TestUtil; 6 | import org.junit.jupiter.api.Test; 7 | 8 | 9 | public class TextCommentTest { 10 | 11 | @Test 12 | public void equalsVerifier() throws Exception { 13 | TestUtil.equalsVerifier(TextComment.class); 14 | TextComment textComment1 = new TextComment(); 15 | textComment1.id = 1L; 16 | TextComment textComment2 = new TextComment(); 17 | textComment2.id = textComment1.id; 18 | assertThat(textComment1).isEqualTo(textComment2); 19 | textComment2.id = 2L; 20 | assertThat(textComment1).isNotEqualTo(textComment2); 21 | textComment1.id = null; 22 | assertThat(textComment1).isNotEqualTo(textComment2); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/mapper/EntityMapper.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.mapper; 2 | 3 | import java.util.List; 4 | 5 | import org.mapstruct.BeanMapping; 6 | import org.mapstruct.MappingTarget; 7 | import org.mapstruct.Named; 8 | import org.mapstruct.NullValuePropertyMappingStrategy; 9 | 10 | /** 11 | * Contract for a generic dto to entity mapper. 12 | * 13 | * @param - DTO type parameter. 14 | * @param - Entity type parameter. 15 | */ 16 | 17 | public interface EntityMapper { 18 | 19 | E toEntity(D dto); 20 | 21 | D toDto(E entity); 22 | 23 | List toEntity(List dtoList); 24 | 25 | List toDto(List entityList); 26 | 27 | @Named("partialUpdate") 28 | @BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE) 29 | void partialUpdate(@MappingTarget E entity, D dto); 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/PredictionsIdsDto.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto; 2 | import java.util.List; 3 | 4 | import io.quarkus.runtime.annotations.RegisterForReflection; 5 | @RegisterForReflection 6 | public class PredictionsIdsDto { 7 | private List predictionsids; 8 | private long examId; 9 | private int numero; 10 | 11 | public long getExamId() { 12 | return this.examId; 13 | } 14 | 15 | public void setExamId(long examId) { 16 | this.examId = examId; 17 | } 18 | 19 | public int getNumero() { 20 | return this.numero; 21 | } 22 | 23 | public void setNumero(int numero) { 24 | this.numero = numero; 25 | } 26 | 27 | public List getPredictionsids() { return predictionsids; } 28 | public void setPredictionsids(List value) { this.predictionsids = value; } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/domain/QuestionTypeTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.domain; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import fr.istic.TestUtil; 6 | import org.junit.jupiter.api.Test; 7 | 8 | 9 | public class QuestionTypeTest { 10 | 11 | @Test 12 | public void equalsVerifier() throws Exception { 13 | TestUtil.equalsVerifier(QuestionType.class); 14 | QuestionType questionType1 = new QuestionType(); 15 | questionType1.id = 1L; 16 | QuestionType questionType2 = new QuestionType(); 17 | questionType2.id = questionType1.id; 18 | assertThat(questionType1).isEqualTo(questionType2); 19 | questionType2.id = 2L; 20 | assertThat(questionType1).isNotEqualTo(questionType2); 21 | questionType1.id = null; 22 | assertThat(questionType1).isNotEqualTo(questionType2); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /.jhipster/Zone.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Zone", 3 | "fields": [ 4 | { 5 | "fieldName": "pageNumber", 6 | "fieldType": "Integer" 7 | }, 8 | { 9 | "fieldName": "xInit", 10 | "fieldType": "Integer" 11 | }, 12 | { 13 | "fieldName": "yInit", 14 | "fieldType": "Integer" 15 | }, 16 | { 17 | "fieldName": "width", 18 | "fieldType": "Integer" 19 | }, 20 | { 21 | "fieldName": "height", 22 | "fieldType": "Integer" 23 | } 24 | ], 25 | "relationships": [], 26 | "changelogDate": "20220309165735", 27 | "entityTableName": "zone", 28 | "dto": "mapstruct", 29 | "pagination": "pagination", 30 | "service": "serviceClass", 31 | "jpaMetamodelFiltering": false, 32 | "fluentMethods": true, 33 | "readOnly": false, 34 | "embedded": false, 35 | "clientRootFolder": "", 36 | "applications": "*" 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/mapper/TemplateContentMapper.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.mapper; 2 | 3 | 4 | import fr.istic.domain.*; 5 | import fr.istic.service.dto.TemplateDTOContent; 6 | 7 | import org.mapstruct.*; 8 | 9 | /** 10 | * Mapper for the entity {@link Template} and its DTO {@link TemplateDTOContent}. 11 | */ 12 | @Mapper(componentModel = "jakarta", uses = {}, injectionStrategy = InjectionStrategy.CONSTRUCTOR) 13 | public interface TemplateContentMapper extends EntityMapper { 14 | 15 | 16 | @Mapping(target = "exam", ignore = true) 17 | Template toEntity(TemplateDTOContent templateDTO); 18 | 19 | default Template fromId(Long id) { 20 | if (id == null) { 21 | return null; 22 | } 23 | Template template = new Template(); 24 | template.id = id; 25 | return template; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/service/dto/CourseDTOTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import static org.assertj.core.api.Assertions.assertThat; 5 | import fr.istic.TestUtil; 6 | 7 | public class CourseDTOTest { 8 | 9 | @Test 10 | public void dtoEqualsVerifier() throws Exception { 11 | TestUtil.equalsVerifier(CourseDTO.class); 12 | CourseDTO courseDTO1 = new CourseDTO(); 13 | courseDTO1.id = 1L; 14 | CourseDTO courseDTO2 = new CourseDTO(); 15 | assertThat(courseDTO1).isNotEqualTo(courseDTO2); 16 | courseDTO2.id = courseDTO1.id; 17 | assertThat(courseDTO1).isEqualTo(courseDTO2); 18 | courseDTO2.id = 2L; 19 | assertThat(courseDTO1).isNotEqualTo(courseDTO2); 20 | courseDTO1.id = null; 21 | assertThat(courseDTO1).isNotEqualTo(courseDTO2); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/mapper/TemplateMapper.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.mapper; 2 | 3 | 4 | import fr.istic.domain.*; 5 | import fr.istic.service.dto.TemplateDTO; 6 | 7 | import org.mapstruct.*; 8 | 9 | /** 10 | * Mapper for the entity {@link Template} and its DTO {@link TemplateDTO}. 11 | */ 12 | @Mapper(componentModel = "jakarta", uses = {}, injectionStrategy = InjectionStrategy.CONSTRUCTOR) 13 | public interface TemplateMapper extends EntityMapper { 14 | 15 | 16 | @Mapping(target = "exam", ignore = true) 17 | @Mapping(target = "content", ignore = true) 18 | Template toEntity(TemplateDTO templateDTO); 19 | 20 | default Template fromId(Long id) { 21 | if (id == null) { 22 | return null; 23 | } 24 | Template template = new Template(); 25 | template.id = id; 26 | return template; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/docker/k8s/maildev-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | labels: 5 | fr.correctexam.service: maildev 6 | name: maildev 7 | namespace: correctexam 8 | spec: 9 | replicas: 1 10 | selector: 11 | matchLabels: 12 | fr.correctexam.service: maildev 13 | strategy: {} 14 | template: 15 | metadata: 16 | labels: 17 | fr.correctexam.service: maildev 18 | spec: 19 | containers: 20 | - args: 21 | - bin/maildev 22 | - --base-pathname 23 | - /maildev 24 | - -w 25 | - "1080" 26 | - -s 27 | - "1025" 28 | image: maildev/maildev 29 | name: maildev 30 | ports: 31 | - containerPort: 1080 32 | - containerPort: 25 33 | resources: {} 34 | restartPolicy: Always 35 | status: {} 36 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/web/rest/vm/ManagedUserVM.java: -------------------------------------------------------------------------------- 1 | package fr.istic.web.rest.vm; 2 | 3 | import io.quarkus.runtime.annotations.RegisterForReflection; 4 | 5 | import fr.istic.service.dto.UserDTO; 6 | import jakarta.validation.constraints.Size; 7 | 8 | /** 9 | * View Model extending the UserDTO, which is meant to be used in the user management UI. 10 | */ 11 | @RegisterForReflection 12 | public class ManagedUserVM extends UserDTO { 13 | public static final int PASSWORD_MIN_LENGTH = 4; 14 | 15 | public static final int PASSWORD_MAX_LENGTH = 100; 16 | 17 | public ManagedUserVM() { 18 | // Empty constructor needed for Jackson. 19 | } 20 | 21 | @Size(min = PASSWORD_MIN_LENGTH, max = PASSWORD_MAX_LENGTH) 22 | public String password; 23 | 24 | @Override 25 | public String toString() { 26 | return "ManagedUserVM{" + super.toString() + "} "; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/domain/GradedCommentTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.domain; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import fr.istic.TestUtil; 6 | import org.junit.jupiter.api.Test; 7 | 8 | 9 | public class GradedCommentTest { 10 | 11 | @Test 12 | public void equalsVerifier() throws Exception { 13 | TestUtil.equalsVerifier(GradedComment.class); 14 | GradedComment gradedComment1 = new GradedComment(); 15 | gradedComment1.id = 1L; 16 | GradedComment gradedComment2 = new GradedComment(); 17 | gradedComment2.id = gradedComment1.id; 18 | assertThat(gradedComment1).isEqualTo(gradedComment2); 19 | gradedComment2.id = 2L; 20 | assertThat(gradedComment1).isNotEqualTo(gradedComment2); 21 | gradedComment1.id = null; 22 | assertThat(gradedComment1).isNotEqualTo(gradedComment2); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /.jhipster/Scan.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Scan", 3 | "fields": [ 4 | { 5 | "fieldName": "name", 6 | "fieldType": "String", 7 | "fieldValidateRules": ["required"] 8 | }, 9 | { 10 | "fieldName": "content", 11 | "fieldType": "byte[]", 12 | "fieldTypeBlobContent": "any" 13 | } 14 | ], 15 | "relationships": [ 16 | { 17 | "relationshipType": "one-to-many", 18 | "otherEntityName": "examSheet", 19 | "otherEntityRelationshipName": "scan", 20 | "relationshipName": "sheets" 21 | } 22 | ], 23 | "changelogDate": "20220309165335", 24 | "entityTableName": "scan", 25 | "dto": "mapstruct", 26 | "pagination": "pagination", 27 | "service": "serviceClass", 28 | "jpaMetamodelFiltering": false, 29 | "fluentMethods": true, 30 | "readOnly": false, 31 | "embedded": false, 32 | "clientRootFolder": "", 33 | "applications": "*" 34 | } 35 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/service/dto/StudentDTOTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import static org.assertj.core.api.Assertions.assertThat; 5 | import fr.istic.TestUtil; 6 | 7 | public class StudentDTOTest { 8 | 9 | @Test 10 | public void dtoEqualsVerifier() throws Exception { 11 | TestUtil.equalsVerifier(StudentDTO.class); 12 | StudentDTO studentDTO1 = new StudentDTO(); 13 | studentDTO1.id = 1L; 14 | StudentDTO studentDTO2 = new StudentDTO(); 15 | assertThat(studentDTO1).isNotEqualTo(studentDTO2); 16 | studentDTO2.id = studentDTO1.id; 17 | assertThat(studentDTO1).isEqualTo(studentDTO2); 18 | studentDTO2.id = 2L; 19 | assertThat(studentDTO1).isNotEqualTo(studentDTO2); 20 | studentDTO1.id = null; 21 | assertThat(studentDTO1).isNotEqualTo(studentDTO2); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/resources/i18n/messages_en.properties: -------------------------------------------------------------------------------- 1 | # Error page 2 | error.title=Your request cannot be processed 3 | error.subtitle=Sorry, an error has occurred. 4 | error.status=Status: 5 | error.message=Message: 6 | 7 | # Activation email 8 | email.activation.title=correctExam account activation 9 | email.activation.greeting=Dear {0} 10 | email.activation.text1=Your correctExam account has been created, please click on the URL below to activate it: 11 | email.activation.text2=Regards, 12 | email.signature=correctExam Team. 13 | 14 | # Creation email 15 | email.creation.text1=Your correctExam account has been created, please click on the URL below to access it: 16 | 17 | # Reset email 18 | email.reset.title=correctExam password reset 19 | email.reset.greeting=Dear {0} 20 | email.reset.text1=For your correctExam account a password reset was requested, please click on the URL below to reset it: 21 | email.reset.text2=Regards, 22 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/service/dto/CommentsDTOTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import static org.assertj.core.api.Assertions.assertThat; 5 | import fr.istic.TestUtil; 6 | 7 | public class CommentsDTOTest { 8 | 9 | @Test 10 | public void dtoEqualsVerifier() throws Exception { 11 | TestUtil.equalsVerifier(CommentsDTO.class); 12 | CommentsDTO commentsDTO1 = new CommentsDTO(); 13 | commentsDTO1.id = 1L; 14 | CommentsDTO commentsDTO2 = new CommentsDTO(); 15 | assertThat(commentsDTO1).isNotEqualTo(commentsDTO2); 16 | commentsDTO2.id = commentsDTO1.id; 17 | assertThat(commentsDTO1).isEqualTo(commentsDTO2); 18 | commentsDTO2.id = 2L; 19 | assertThat(commentsDTO1).isNotEqualTo(commentsDTO2); 20 | commentsDTO1.id = null; 21 | assertThat(commentsDTO1).isNotEqualTo(commentsDTO2); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/service/dto/QuestionDTOTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import static org.assertj.core.api.Assertions.assertThat; 5 | import fr.istic.TestUtil; 6 | 7 | public class QuestionDTOTest { 8 | 9 | @Test 10 | public void dtoEqualsVerifier() throws Exception { 11 | TestUtil.equalsVerifier(QuestionDTO.class); 12 | QuestionDTO questionDTO1 = new QuestionDTO(); 13 | questionDTO1.id = 1L; 14 | QuestionDTO questionDTO2 = new QuestionDTO(); 15 | assertThat(questionDTO1).isNotEqualTo(questionDTO2); 16 | questionDTO2.id = questionDTO1.id; 17 | assertThat(questionDTO1).isEqualTo(questionDTO2); 18 | questionDTO2.id = 2L; 19 | assertThat(questionDTO1).isNotEqualTo(questionDTO2); 20 | questionDTO1.id = null; 21 | assertThat(questionDTO1).isNotEqualTo(questionDTO2); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/service/dto/TemplateDTOTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import static org.assertj.core.api.Assertions.assertThat; 5 | import fr.istic.TestUtil; 6 | 7 | public class TemplateDTOTest { 8 | 9 | @Test 10 | public void dtoEqualsVerifier() throws Exception { 11 | TestUtil.equalsVerifier(TemplateDTO.class); 12 | TemplateDTO templateDTO1 = new TemplateDTO(); 13 | templateDTO1.id = 1L; 14 | TemplateDTO templateDTO2 = new TemplateDTO(); 15 | assertThat(templateDTO1).isNotEqualTo(templateDTO2); 16 | templateDTO2.id = templateDTO1.id; 17 | assertThat(templateDTO1).isEqualTo(templateDTO2); 18 | templateDTO2.id = 2L; 19 | assertThat(templateDTO1).isNotEqualTo(templateDTO2); 20 | templateDTO1.id = null; 21 | assertThat(templateDTO1).isNotEqualTo(templateDTO2); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.jhipster/Comments.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Comments", 3 | "fields": [ 4 | { 5 | "fieldName": "zonegeneratedid", 6 | "fieldType": "String" 7 | }, 8 | { 9 | "fieldName": "jsonData", 10 | "fieldType": "byte[]", 11 | "fieldTypeBlobContent": "text" 12 | } 13 | ], 14 | "relationships": [ 15 | { 16 | "relationshipType": "many-to-one", 17 | "otherEntityName": "studentResponse", 18 | "otherEntityRelationshipName": "comments", 19 | "relationshipName": "studentResponse", 20 | "otherEntityField": "id" 21 | } 22 | ], 23 | "changelogDate": "20220426094348", 24 | "entityTableName": "comments", 25 | "dto": "mapstruct", 26 | "pagination": "pagination", 27 | "service": "serviceClass", 28 | "jpaMetamodelFiltering": false, 29 | "fluentMethods": true, 30 | "readOnly": false, 31 | "embedded": false, 32 | "clientRootFolder": "", 33 | "applications": "*" 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/ResizeZoneDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto; 2 | 3 | import io.quarkus.runtime.annotations.RegisterForReflection; 4 | 5 | @RegisterForReflection 6 | public class ResizeZoneDTO { 7 | private int left; 8 | 9 | private int top; 10 | private double x; 11 | private double y; 12 | 13 | public int getLeft() { return left; } 14 | public void setLeft(int value) { this.left = value; } 15 | 16 | public int getTop() { return top; } 17 | public void setTop(int value) { this.top = value; } 18 | 19 | public double getX() { return x; } 20 | public void setX(double value) { this.x = value; } 21 | 22 | public double getY() { return y; } 23 | public void setY(double value) { this.y = value; } 24 | @Override 25 | public String toString() { 26 | return "ResizeZoneDTO [left=" + left + ", top=" + top + ", x=" + x + ", y=" + y + "]"; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/domain/StudentResponseTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.domain; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import fr.istic.TestUtil; 6 | import org.junit.jupiter.api.Test; 7 | 8 | 9 | public class StudentResponseTest { 10 | 11 | @Test 12 | public void equalsVerifier() throws Exception { 13 | TestUtil.equalsVerifier(StudentResponse.class); 14 | StudentResponse studentResponse1 = new StudentResponse(); 15 | studentResponse1.id = 1L; 16 | StudentResponse studentResponse2 = new StudentResponse(); 17 | studentResponse2.id = studentResponse1.id; 18 | assertThat(studentResponse1).isEqualTo(studentResponse2); 19 | studentResponse2.id = 2L; 20 | assertThat(studentResponse1).isNotEqualTo(studentResponse2); 21 | studentResponse1.id = null; 22 | assertThat(studentResponse1).isNotEqualTo(studentResponse2); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/exportpdf/Gradedcommentspdf.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto.exportpdf; 2 | 3 | import io.quarkus.runtime.annotations.RegisterForReflection; 4 | 5 | @RegisterForReflection 6 | public class Gradedcommentspdf { 7 | private String description; 8 | private double grade; 9 | private String text; 10 | private String zonegeneratedid; 11 | 12 | public String getDescription() { return description; } 13 | public void setDescription(String value) { this.description = value; } 14 | 15 | public double getGrade() { return grade; } 16 | public void setGrade(double value) { this.grade = value; } 17 | 18 | public String getText() { return text; } 19 | public void setText(String value) { this.text = value; } 20 | 21 | public String getZonegeneratedid() { return zonegeneratedid; } 22 | public void setZonegeneratedid(String value) { this.zonegeneratedid = value; } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/service/dto/ExamSheetDTOTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import static org.assertj.core.api.Assertions.assertThat; 5 | import fr.istic.TestUtil; 6 | 7 | public class ExamSheetDTOTest { 8 | 9 | @Test 10 | public void dtoEqualsVerifier() throws Exception { 11 | TestUtil.equalsVerifier(ExamSheetDTO.class); 12 | ExamSheetDTO examSheetDTO1 = new ExamSheetDTO(); 13 | examSheetDTO1.id = 1L; 14 | ExamSheetDTO examSheetDTO2 = new ExamSheetDTO(); 15 | assertThat(examSheetDTO1).isNotEqualTo(examSheetDTO2); 16 | examSheetDTO2.id = examSheetDTO1.id; 17 | assertThat(examSheetDTO1).isEqualTo(examSheetDTO2); 18 | examSheetDTO2.id = 2L; 19 | assertThat(examSheetDTO1).isNotEqualTo(examSheetDTO2); 20 | examSheetDTO1.id = null; 21 | assertThat(examSheetDTO1).isNotEqualTo(examSheetDTO2); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/docker/exampleconf/nginx.conf: -------------------------------------------------------------------------------- 1 | user nginx; 2 | worker_processes auto; 3 | 4 | error_log /var/log/nginx/error.log notice; 5 | pid /var/run/nginx.pid; 6 | 7 | 8 | events { 9 | worker_connections 1024; 10 | } 11 | 12 | 13 | http { 14 | sendfile on; 15 | tcp_nopush on; 16 | tcp_nodelay on; 17 | keepalive_timeout 1000s; 18 | types_hash_max_size 2048; 19 | 20 | 21 | include /etc/nginx/mime.types; 22 | default_type application/octet-stream; 23 | 24 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 25 | '$status $body_bytes_sent "$http_referer" ' 26 | '"$http_user_agent" "$http_x_forwarded_for"'; 27 | 28 | access_log /var/log/nginx/access.log main; 29 | 30 | sendfile on; 31 | #tcp_nopush on; 32 | 33 | keepalive_timeout 65; 34 | 35 | gzip on; 36 | client_max_body_size 10G; 37 | 38 | include /etc/nginx/conf.d/*.conf; 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/config/JHipsterProperties.java: -------------------------------------------------------------------------------- 1 | package fr.istic.config; 2 | 3 | import io.smallrye.config.ConfigMapping; 4 | 5 | @ConfigMapping(prefix = "jhipster") 6 | public interface JHipsterProperties { 7 | public Security security(); 8 | public Mail mail(); 9 | 10 | public interface Security { 11 | public Authentication authentication(); 12 | 13 | public interface Authentication { 14 | public Jwt jwt(); 15 | 16 | public interface Jwt { 17 | public String issuer(); 18 | public long tokenValidityInSeconds(); 19 | public long tokenValidityInSecondsForRememberMe(); 20 | public PrivateKey privateKey(); 21 | 22 | public interface PrivateKey { 23 | public String location(); 24 | } 25 | } 26 | } 27 | } 28 | 29 | public interface Mail { 30 | public String baseUrl(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/exportpdf/Studentpdf.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto.exportpdf; 2 | 3 | import io.quarkus.runtime.annotations.RegisterForReflection; 4 | 5 | @RegisterForReflection 6 | public class Studentpdf { 7 | private String firstname; 8 | private long id; 9 | private String ine; 10 | private String mail; 11 | private String name; 12 | 13 | public String getFirstname() { return firstname; } 14 | public void setFirstname(String value) { this.firstname = value; } 15 | 16 | public long getID() { return id; } 17 | public void setID(long value) { this.id = value; } 18 | 19 | public String getIne() { return ine; } 20 | public void setIne(String value) { this.ine = value; } 21 | 22 | public String getMail() { return mail; } 23 | public void setMail(String value) { this.mail = value; } 24 | 25 | public String getName() { return name; } 26 | public void setName(String value) { this.name = value; } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/correctexamstate/SheetStateDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto.correctexamstate; 2 | 3 | import io.quarkus.runtime.annotations.RegisterForReflection; 4 | 5 | @RegisterForReflection 6 | public class SheetStateDTO { 7 | private long id; 8 | private long answeredSheets; 9 | private long firstUnmarkedQuestion; 10 | 11 | public long getId() { 12 | return id; 13 | } 14 | 15 | public void setId(long value) { 16 | this.id = value; 17 | } 18 | 19 | 20 | public long getAnsweredSheets() { 21 | return answeredSheets; 22 | } 23 | 24 | public void setAnsweredSheets(long value) { 25 | this.answeredSheets = value; 26 | } 27 | 28 | public long getFirstUnmarkedQuestion() { 29 | return firstUnmarkedQuestion; 30 | } 31 | 32 | public void setFirstUnmarkedQuestion(long firstMarkedQuestion) { 33 | this.firstUnmarkedQuestion = firstMarkedQuestion; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/resources/i18n/messages_fr.properties: -------------------------------------------------------------------------------- 1 | # Error page 2 | error.title=Votre demande ne peut être traitée 3 | error.subtitle=Désolé, une erreur s'est produite. 4 | error.status=Statut : 5 | error.message=Message : 6 | 7 | # Activation email 8 | email.activation.title=Activation de votre compte correctExam 9 | email.activation.greeting=Cher {0} 10 | email.activation.text1=Votre compte correctExam a été créé, pour l'activer merci de cliquer sur le lien ci-dessous : 11 | email.activation.text2=Cordialement, 12 | email.signature=correctExam. 13 | 14 | # Creation email 15 | email.creation.text1=Votre compte correctExam a été créé, merci de cliquer sur le lien ci-dessous pour y accéder : 16 | 17 | # Reset email 18 | email.reset.title=correctExam Réinitialisation de mot de passe 19 | email.reset.greeting=Cher {0} 20 | email.reset.text1=Un nouveau mot de passe pour votre compte correctExam a été demandé, veuillez cliquer sur le lien ci-dessous pour le réinitialiser : 21 | email.reset.text2=Cordialement, 22 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/service/dto/CourseGroupDTOTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import static org.assertj.core.api.Assertions.assertThat; 5 | import fr.istic.TestUtil; 6 | 7 | public class CourseGroupDTOTest { 8 | 9 | @Test 10 | public void dtoEqualsVerifier() throws Exception { 11 | TestUtil.equalsVerifier(CourseGroupDTO.class); 12 | CourseGroupDTO courseGroupDTO1 = new CourseGroupDTO(); 13 | courseGroupDTO1.id = 1L; 14 | CourseGroupDTO courseGroupDTO2 = new CourseGroupDTO(); 15 | assertThat(courseGroupDTO1).isNotEqualTo(courseGroupDTO2); 16 | courseGroupDTO2.id = courseGroupDTO1.id; 17 | assertThat(courseGroupDTO1).isEqualTo(courseGroupDTO2); 18 | courseGroupDTO2.id = 2L; 19 | assertThat(courseGroupDTO1).isNotEqualTo(courseGroupDTO2); 20 | courseGroupDTO1.id = null; 21 | assertThat(courseGroupDTO1).isNotEqualTo(courseGroupDTO2); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/service/dto/FinalResultDTOTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import static org.assertj.core.api.Assertions.assertThat; 5 | import fr.istic.TestUtil; 6 | 7 | public class FinalResultDTOTest { 8 | 9 | @Test 10 | public void dtoEqualsVerifier() throws Exception { 11 | TestUtil.equalsVerifier(FinalResultDTO.class); 12 | FinalResultDTO finalResultDTO1 = new FinalResultDTO(); 13 | finalResultDTO1.id = 1L; 14 | FinalResultDTO finalResultDTO2 = new FinalResultDTO(); 15 | assertThat(finalResultDTO1).isNotEqualTo(finalResultDTO2); 16 | finalResultDTO2.id = finalResultDTO1.id; 17 | assertThat(finalResultDTO1).isEqualTo(finalResultDTO2); 18 | finalResultDTO2.id = 2L; 19 | assertThat(finalResultDTO1).isNotEqualTo(finalResultDTO2); 20 | finalResultDTO1.id = null; 21 | assertThat(finalResultDTO1).isNotEqualTo(finalResultDTO2); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/service/dto/TextCommentDTOTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import static org.assertj.core.api.Assertions.assertThat; 5 | import fr.istic.TestUtil; 6 | 7 | public class TextCommentDTOTest { 8 | 9 | @Test 10 | public void dtoEqualsVerifier() throws Exception { 11 | TestUtil.equalsVerifier(TextCommentDTO.class); 12 | TextCommentDTO textCommentDTO1 = new TextCommentDTO(); 13 | textCommentDTO1.id = 1L; 14 | TextCommentDTO textCommentDTO2 = new TextCommentDTO(); 15 | assertThat(textCommentDTO1).isNotEqualTo(textCommentDTO2); 16 | textCommentDTO2.id = textCommentDTO1.id; 17 | assertThat(textCommentDTO1).isEqualTo(textCommentDTO2); 18 | textCommentDTO2.id = 2L; 19 | assertThat(textCommentDTO1).isNotEqualTo(textCommentDTO2); 20 | textCommentDTO1.id = null; 21 | assertThat(textCommentDTO1).isNotEqualTo(textCommentDTO2); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/correctexamstate/MarkingExamStateDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto.correctexamstate; 2 | 3 | import java.util.ArrayList; 4 | 5 | import java.util.List; 6 | import io.quarkus.runtime.annotations.RegisterForReflection; 7 | 8 | @RegisterForReflection 9 | public class MarkingExamStateDTO { 10 | private String nameExam; 11 | private List questions = new ArrayList(); 12 | private List sheets = new ArrayList(); 13 | 14 | public String getNameExam() { return nameExam; } 15 | public void setNameExam(String value) { this.nameExam = value; } 16 | 17 | public List getQuestions() { return questions; } 18 | public void setQuestions(List value) { this.questions = value; } 19 | 20 | public List getSheets() { return sheets; } 21 | public void setSheets(List value) { this.sheets = value; } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/docker/es.yml: -------------------------------------------------------------------------------- 1 | version: '1' 2 | services: 3 | correctexam-es: 4 | image: elasticsearch:8.8.0 5 | ports: 6 | - 9200:9200 7 | - 9300:9300 8 | networks: 9 | - elastic 10 | environment: 11 | - discovery.type=single-node 12 | - xpack.security.enabled=false 13 | - "ES_JAVA_OPTS=-Xms512m -Xmx2048m" 14 | - cluster.routing.allocation.disk.threshold_enabled=false 15 | deploy: 16 | resources: 17 | limits: 18 | cpus: '2.0' 19 | reservations: 20 | cpus: '1.0' 21 | correctexam-kibana: 22 | image: docker.elastic.co/kibana/kibana:8.7.1 23 | container_name: kibana 24 | environment: 25 | XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY: d1a66dfd-c4d3-4a0a-8290-2abcb83ab3aa 26 | ports: 27 | - 5601:5601 28 | networks: 29 | - elastic 30 | deploy: 31 | resources: 32 | limits: 33 | cpus: '2.0' 34 | reservations: 35 | cpus: '1.0' -------------------------------------------------------------------------------- /src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/grade-scope-istic . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/grade-scope-istic 15 | # 16 | ### 17 | FROM quay.io/quarkus/ubi9-quarkus-micro-image:2.0 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | EXPOSE 8080 24 | USER 1001 25 | 26 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0", "-Dquarkus.datasource.jdbc.url=jdbc:mysql://correctexam-mysql:3306/correctexam?useUnicode=true&characterEncoding=utf8&useSSL=false"] 27 | #, "-Dquarkus.flyway.locations=filesystem:/work/migration/"] 28 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/service/dto/QuestionTypeDTOTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import static org.assertj.core.api.Assertions.assertThat; 5 | import fr.istic.TestUtil; 6 | 7 | public class QuestionTypeDTOTest { 8 | 9 | @Test 10 | public void dtoEqualsVerifier() throws Exception { 11 | TestUtil.equalsVerifier(QuestionTypeDTO.class); 12 | QuestionTypeDTO questionTypeDTO1 = new QuestionTypeDTO(); 13 | questionTypeDTO1.id = 1L; 14 | QuestionTypeDTO questionTypeDTO2 = new QuestionTypeDTO(); 15 | assertThat(questionTypeDTO1).isNotEqualTo(questionTypeDTO2); 16 | questionTypeDTO2.id = questionTypeDTO1.id; 17 | assertThat(questionTypeDTO1).isEqualTo(questionTypeDTO2); 18 | questionTypeDTO2.id = 2L; 19 | assertThat(questionTypeDTO1).isNotEqualTo(questionTypeDTO2); 20 | questionTypeDTO1.id = null; 21 | assertThat(questionTypeDTO1).isNotEqualTo(questionTypeDTO2); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/mapper/CommentsMapper.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.mapper; 2 | 3 | 4 | import fr.istic.domain.*; 5 | import fr.istic.service.dto.CommentsDTO; 6 | 7 | import org.mapstruct.*; 8 | 9 | /** 10 | * Mapper for the entity {@link Comments} and its DTO {@link CommentsDTO}. 11 | */ 12 | @Mapper(componentModel = "jakarta", uses = {StudentResponseMapper.class}, injectionStrategy = InjectionStrategy.CONSTRUCTOR) 13 | public interface CommentsMapper extends EntityMapper { 14 | 15 | @Mapping(source = "studentResponse.id", target = "studentResponseId") 16 | CommentsDTO toDto(Comments comments); 17 | 18 | @Mapping(source = "studentResponseId", target = "studentResponse") 19 | Comments toEntity(CommentsDTO commentsDTO); 20 | 21 | default Comments fromId(Long id) { 22 | if (id == null) { 23 | return null; 24 | } 25 | Comments comments = new Comments(); 26 | comments.id = id; 27 | return comments; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/web/rest/ManagementInfoResource.java: -------------------------------------------------------------------------------- 1 | package fr.istic.web.rest; 2 | 3 | import fr.istic.service.ManagementInfoService; 4 | 5 | import jakarta.enterprise.context.RequestScoped; 6 | import jakarta.inject.Inject; 7 | import jakarta.ws.rs.Consumes; 8 | import jakarta.ws.rs.GET; 9 | import jakarta.ws.rs.Path; 10 | import jakarta.ws.rs.Produces; 11 | import jakarta.ws.rs.core.MediaType; 12 | import jakarta.ws.rs.core.Response; 13 | 14 | @Path("/management/info") 15 | @Produces(MediaType.APPLICATION_JSON) 16 | @Consumes(MediaType.APPLICATION_JSON) 17 | @RequestScoped 18 | public class ManagementInfoResource { 19 | 20 | private final ManagementInfoService managementInfoService; 21 | 22 | @Inject 23 | public ManagementInfoResource(ManagementInfoService managementInfoService) { 24 | this.managementInfoService = managementInfoService; 25 | } 26 | 27 | @GET 28 | public Response info(){ 29 | return Response.ok(managementInfoService.getManagementInfo()).build(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /.jhipster/FinalResult.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "FinalResult", 3 | "fields": [ 4 | { 5 | "fieldName": "note", 6 | "fieldType": "Integer" 7 | } 8 | ], 9 | "relationships": [ 10 | { 11 | "relationshipType": "many-to-one", 12 | "otherEntityName": "student", 13 | "otherEntityRelationshipName": "finalResult", 14 | "relationshipName": "student", 15 | "otherEntityField": "name" 16 | }, 17 | { 18 | "relationshipType": "many-to-one", 19 | "otherEntityName": "exam", 20 | "otherEntityRelationshipName": "finalResult", 21 | "relationshipName": "exam", 22 | "otherEntityField": "name" 23 | } 24 | ], 25 | "changelogDate": "20220309165435", 26 | "entityTableName": "final_result", 27 | "dto": "mapstruct", 28 | "pagination": "pagination", 29 | "service": "serviceClass", 30 | "jpaMetamodelFiltering": false, 31 | "fluentMethods": true, 32 | "readOnly": false, 33 | "embedded": false, 34 | "clientRootFolder": "", 35 | "applications": "*" 36 | } 37 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/service/dto/GradedCommentDTOTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import static org.assertj.core.api.Assertions.assertThat; 5 | import fr.istic.TestUtil; 6 | 7 | public class GradedCommentDTOTest { 8 | 9 | @Test 10 | public void dtoEqualsVerifier() throws Exception { 11 | TestUtil.equalsVerifier(GradedCommentDTO.class); 12 | GradedCommentDTO gradedCommentDTO1 = new GradedCommentDTO(); 13 | gradedCommentDTO1.id = 1L; 14 | GradedCommentDTO gradedCommentDTO2 = new GradedCommentDTO(); 15 | assertThat(gradedCommentDTO1).isNotEqualTo(gradedCommentDTO2); 16 | gradedCommentDTO2.id = gradedCommentDTO1.id; 17 | assertThat(gradedCommentDTO1).isEqualTo(gradedCommentDTO2); 18 | gradedCommentDTO2.id = 2L; 19 | assertThat(gradedCommentDTO1).isNotEqualTo(gradedCommentDTO2); 20 | gradedCommentDTO1.id = null; 21 | assertThat(gradedCommentDTO1).isNotEqualTo(gradedCommentDTO2); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.jhipster/TextComment.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "TextComment", 3 | "fields": [ 4 | { 5 | "fieldName": "text", 6 | "fieldType": "String" 7 | }, 8 | { 9 | "fieldName": "description", 10 | "fieldType": "byte[]", 11 | "fieldTypeBlobContent": "text" 12 | }, 13 | { 14 | "fieldName": "zonegeneratedid", 15 | "fieldType": "String" 16 | } 17 | ], 18 | "relationships": [ 19 | { 20 | "relationshipType": "many-to-one", 21 | "otherEntityName": "studentResponse", 22 | "otherEntityRelationshipName": "textcomments", 23 | "relationshipName": "studentResponse", 24 | "otherEntityField": "id" 25 | } 26 | ], 27 | "changelogDate": "20220422123107", 28 | "entityTableName": "text_comment", 29 | "dto": "mapstruct", 30 | "pagination": "pagination", 31 | "service": "serviceClass", 32 | "jpaMetamodelFiltering": false, 33 | "fluentMethods": true, 34 | "readOnly": false, 35 | "embedded": false, 36 | "clientRootFolder": "", 37 | "applications": "*" 38 | } 39 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | wrapperVersion=3.3.2 18 | distributionType=only-script 19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip 20 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/service/dto/StudentResponseDTOTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import static org.assertj.core.api.Assertions.assertThat; 5 | import fr.istic.TestUtil; 6 | 7 | public class StudentResponseDTOTest { 8 | 9 | @Test 10 | public void dtoEqualsVerifier() throws Exception { 11 | TestUtil.equalsVerifier(StudentResponseDTO.class); 12 | StudentResponseDTO studentResponseDTO1 = new StudentResponseDTO(); 13 | studentResponseDTO1.id = 1L; 14 | StudentResponseDTO studentResponseDTO2 = new StudentResponseDTO(); 15 | assertThat(studentResponseDTO1).isNotEqualTo(studentResponseDTO2); 16 | studentResponseDTO2.id = studentResponseDTO1.id; 17 | assertThat(studentResponseDTO1).isEqualTo(studentResponseDTO2); 18 | studentResponseDTO2.id = 2L; 19 | assertThat(studentResponseDTO1).isNotEqualTo(studentResponseDTO2); 20 | studentResponseDTO1.id = null; 21 | assertThat(studentResponseDTO1).isNotEqualTo(studentResponseDTO2); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/config/SPARouting.java: -------------------------------------------------------------------------------- 1 | package fr.istic.config; 2 | 3 | import java.util.function.Predicate; 4 | import java.util.regex.Pattern; 5 | import java.util.stream.Stream; 6 | 7 | import jakarta.enterprise.context.ApplicationScoped; 8 | import jakarta.enterprise.event.Observes; 9 | 10 | import io.vertx.ext.web.Router; 11 | 12 | @ApplicationScoped 13 | public class SPARouting { 14 | private static final String[] PATH_PREFIXES = { "/api/", "/q/", "/management" }; 15 | private static final Predicate FILE_NAME_PREDICATE = Pattern.compile(".*[.][a-zA-Z\\d]+").asMatchPredicate(); 16 | 17 | public void init(@Observes Router router) { 18 | router.get("/*").handler(rc -> { 19 | final String path = rc.normalizedPath(); 20 | if (!path.equals("/") 21 | && Stream.of(PATH_PREFIXES).noneMatch(path::startsWith) 22 | && !FILE_NAME_PREDICATE.test(path)) { 23 | rc.reroute("/"); 24 | } else { 25 | rc.next(); 26 | } 27 | }); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/mapper/ExamSheetMapper.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.mapper; 2 | 3 | 4 | import fr.istic.domain.*; 5 | import fr.istic.service.dto.ExamSheetDTO; 6 | 7 | import org.mapstruct.*; 8 | 9 | /** 10 | * Mapper for the entity {@link ExamSheet} and its DTO {@link ExamSheetDTO}. 11 | */ 12 | @Mapper(componentModel = "jakarta", uses = {ScanMapper.class}, injectionStrategy = InjectionStrategy.CONSTRUCTOR) 13 | public interface ExamSheetMapper extends EntityMapper { 14 | 15 | @Mapping(source = "scan.id", target = "scanId") 16 | @Mapping(source = "scan.name", target = "scanName") 17 | ExamSheetDTO toDto(ExamSheet examSheet); 18 | 19 | @Mapping(source = "scanId", target = "scan") 20 | @Mapping(target = "students", ignore = true) 21 | ExamSheet toEntity(ExamSheetDTO examSheetDTO); 22 | 23 | default ExamSheet fromId(Long id) { 24 | if (id == null) { 25 | return null; 26 | } 27 | ExamSheet examSheet = new ExamSheet(); 28 | examSheet.id = id; 29 | return examSheet; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/mapper/CourseMapper.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.mapper; 2 | 3 | 4 | import fr.istic.domain.*; 5 | import fr.istic.service.dto.CourseDTO; 6 | 7 | import org.mapstruct.*; 8 | 9 | /** 10 | * Mapper for the entity {@link Course} and its DTO {@link CourseDTO}. 11 | */ 12 | @Mapper(componentModel = "jakarta", uses = {UserMapper.class}, injectionStrategy = InjectionStrategy.CONSTRUCTOR) 13 | public interface CourseMapper extends EntityMapper { 14 | 15 | // @Mapping(source = "prof.id", target = "profId") 16 | // @Mapping(source = "prof.login", target = "profLogin") 17 | // CourseDTO toDto(Course course); 18 | 19 | @Mapping(target = "exams", ignore = true) 20 | @Mapping(target = "groups", ignore = true) 21 | // @Mapping(source = "profId", target = "prof") 22 | Course toEntity(CourseDTO courseDTO); 23 | 24 | default Course fromId(Long id) { 25 | if (id == null) { 26 | return null; 27 | } 28 | Course course = new Course(); 29 | course.id = id; 30 | return course; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/mapper/TextCommentMapper.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.mapper; 2 | 3 | 4 | import fr.istic.domain.*; 5 | import fr.istic.service.dto.TextCommentDTO; 6 | 7 | import org.mapstruct.*; 8 | 9 | /** 10 | * Mapper for the entity {@link TextComment} and its DTO {@link TextCommentDTO}. 11 | */ 12 | @Mapper(componentModel = "jakarta", uses = {QuestionMapper.class}, injectionStrategy = InjectionStrategy.CONSTRUCTOR) 13 | public interface TextCommentMapper extends EntityMapper { 14 | 15 | @Mapping(source = "question.id", target = "questionId") 16 | TextCommentDTO toDto(TextComment textComment); 17 | 18 | @Mapping(source = "questionId", target = "question") 19 | @Mapping(target = "studentResponses", ignore = true) 20 | TextComment toEntity(TextCommentDTO textCommentDTO); 21 | 22 | default TextComment fromId(Long id) { 23 | if (id == null) { 24 | return null; 25 | } 26 | TextComment textComment = new TextComment(); 27 | textComment.id = id; 28 | return textComment; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /.jhipster/CourseGroup.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CourseGroup", 3 | "fields": [ 4 | { 5 | "fieldName": "groupName", 6 | "fieldType": "String", 7 | "fieldValidateRules": ["required"] 8 | } 9 | ], 10 | "relationships": [ 11 | { 12 | "relationshipType": "many-to-many", 13 | "otherEntityName": "student", 14 | "otherEntityRelationshipName": "groups", 15 | "relationshipName": "students", 16 | "otherEntityField": "name", 17 | "ownerSide": true 18 | }, 19 | { 20 | "relationshipType": "many-to-one", 21 | "otherEntityName": "course", 22 | "otherEntityRelationshipName": "groups", 23 | "relationshipName": "course", 24 | "otherEntityField": "name" 25 | } 26 | ], 27 | "changelogDate": "20220309164735", 28 | "entityTableName": "course_group", 29 | "dto": "mapstruct", 30 | "pagination": "pagination", 31 | "service": "serviceClass", 32 | "jpaMetamodelFiltering": false, 33 | "fluentMethods": true, 34 | "readOnly": false, 35 | "embedded": false, 36 | "clientRootFolder": "", 37 | "applications": "*" 38 | } 39 | -------------------------------------------------------------------------------- /src/main/docker/monitoring.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | correctExam-prometheus: 4 | image: prom/prometheus:v2.18.1 5 | volumes: 6 | - ./prometheus/:/etc/prometheus/ 7 | command: 8 | - '--config.file=/etc/prometheus/prometheus.yml' 9 | ports: 10 | - 9090:9090 11 | # On MacOS, remove next line and replace localhost by host.docker.internal in prometheus/prometheus.yml and 12 | # grafana/provisioning/datasources/datasource.yml 13 | network_mode: 'host' # to test locally running service 14 | correctExam-grafana: 15 | image: grafana/grafana:7.0.1 16 | volumes: 17 | - ./grafana/provisioning/:/etc/grafana/provisioning/ 18 | environment: 19 | - GF_SECURITY_ADMIN_PASSWORD=admin 20 | - GF_USERS_ALLOW_SIGN_UP=false 21 | - GF_INSTALL_PLUGINS=grafana-piechart-panel 22 | ports: 23 | - 3000:3000 24 | # On MacOS, remove next line and replace localhost by host.docker.internal in prometheus/prometheus.yml and 25 | # grafana/provisioning/datasources/datasource.yml 26 | network_mode: 'host' # to test locally running service 27 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/ArchTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic; 2 | 3 | import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses; 4 | 5 | import com.tngtech.archunit.core.domain.JavaClasses; 6 | import com.tngtech.archunit.core.importer.ClassFileImporter; 7 | import com.tngtech.archunit.core.importer.ImportOption; 8 | import org.junit.jupiter.api.Test; 9 | 10 | class ArchTest { 11 | 12 | @Test 13 | void servicesAndRepositoriesShouldNotDependOnWebLayer() { 14 | JavaClasses importedClasses = new ClassFileImporter() 15 | .withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS) 16 | .importPackages("fr.istic"); 17 | 18 | noClasses() 19 | .that() 20 | .resideInAnyPackage("..service..") 21 | .or() 22 | .resideInAnyPackage("..repository..") 23 | .should() 24 | .dependOnClassesThat() 25 | .resideInAnyPackage("..fr.istic.web..") 26 | .because("Services and repositories should not depend on web layer") 27 | .check(importedClasses); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/mapper/CourseGroupMapper.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.mapper; 2 | 3 | 4 | import fr.istic.domain.*; 5 | import fr.istic.service.dto.CourseGroupDTO; 6 | 7 | import org.mapstruct.*; 8 | 9 | /** 10 | * Mapper for the entity {@link CourseGroup} and its DTO {@link CourseGroupDTO}. 11 | */ 12 | @Mapper(componentModel = "jakarta", uses = {StudentMapper.class, CourseMapper.class}, injectionStrategy = InjectionStrategy.CONSTRUCTOR) 13 | public interface CourseGroupMapper extends EntityMapper { 14 | 15 | @Mapping(source = "course.id", target = "courseId") 16 | @Mapping(source = "course.name", target = "courseName") 17 | CourseGroupDTO toDto(CourseGroup courseGroup); 18 | 19 | @Mapping(source = "courseId", target = "course") 20 | CourseGroup toEntity(CourseGroupDTO courseGroupDTO); 21 | 22 | default CourseGroup fromId(Long id) { 23 | if (id == null) { 24 | return null; 25 | } 26 | CourseGroup courseGroup = new CourseGroup(); 27 | courseGroup.id = id; 28 | return courseGroup; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /.jhipster/GradedComment.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "GradedComment", 3 | "fields": [ 4 | { 5 | "fieldName": "zonegeneratedid", 6 | "fieldType": "String" 7 | }, 8 | { 9 | "fieldName": "text", 10 | "fieldType": "String" 11 | }, 12 | { 13 | "fieldName": "description", 14 | "fieldType": "byte[]", 15 | "fieldTypeBlobContent": "text" 16 | }, 17 | { 18 | "fieldName": "grade", 19 | "fieldType": "Integer" 20 | } 21 | ], 22 | "relationships": [ 23 | { 24 | "relationshipType": "many-to-one", 25 | "otherEntityName": "studentResponse", 26 | "otherEntityRelationshipName": "gradedcomments", 27 | "relationshipName": "studentResponse", 28 | "otherEntityField": "id" 29 | } 30 | ], 31 | "changelogDate": "20220422123207", 32 | "entityTableName": "graded_comment", 33 | "dto": "mapstruct", 34 | "pagination": "pagination", 35 | "service": "serviceClass", 36 | "jpaMetamodelFiltering": false, 37 | "fluentMethods": true, 38 | "readOnly": false, 39 | "embedded": false, 40 | "clientRootFolder": "", 41 | "applications": "*" 42 | } 43 | -------------------------------------------------------------------------------- /.jhipster/Template.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Template", 3 | "fields": [ 4 | { 5 | "fieldName": "name", 6 | "fieldType": "String", 7 | "fieldValidateRules": ["required"] 8 | }, 9 | { 10 | "fieldName": "content", 11 | "fieldType": "byte[]", 12 | "fieldTypeBlobContent": "any" 13 | }, 14 | { 15 | "fieldName": "mark", 16 | "fieldType": "Boolean" 17 | }, 18 | { 19 | "fieldName": "autoMapStudentCopyToList", 20 | "fieldType": "Boolean" 21 | } 22 | ], 23 | "relationships": [ 24 | { 25 | "relationshipType": "one-to-one", 26 | "otherEntityName": "exam", 27 | "otherEntityRelationshipName": "template", 28 | "relationshipName": "exam", 29 | "ownerSide": false 30 | } 31 | ], 32 | "changelogDate": "20220309165035", 33 | "entityTableName": "template", 34 | "dto": "mapstruct", 35 | "pagination": "pagination", 36 | "service": "serviceClass", 37 | "jpaMetamodelFiltering": false, 38 | "fluentMethods": true, 39 | "readOnly": false, 40 | "embedded": false, 41 | "clientRootFolder": "", 42 | "applications": "*" 43 | } 44 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 correctexam 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/dto/ScanDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | 4 | import io.quarkus.runtime.annotations.RegisterForReflection; 5 | import jakarta.validation.constraints.*; 6 | import java.io.Serializable; 7 | import java.util.Objects; 8 | import jakarta.persistence.Lob; 9 | 10 | /** 11 | * A DTO for the {@link fr.istic.domain.Scan} entity. 12 | */ 13 | @RegisterForReflection 14 | public class ScanDTO implements Serializable { 15 | 16 | public Long id; 17 | 18 | @NotNull 19 | public String name; 20 | 21 | public String contentContentType; 22 | 23 | 24 | @Override 25 | public boolean equals(Object o) { 26 | if (this == o) { 27 | return true; 28 | } 29 | if (!(o instanceof ScanDTO)) { 30 | return false; 31 | } 32 | 33 | return id != null && id.equals(((ScanDTO) o).id); 34 | } 35 | 36 | @Override 37 | public int hashCode() { 38 | return 31; 39 | } 40 | 41 | @Override 42 | public String toString() { 43 | return "ScanDTO{" + 44 | "id=" + id + 45 | ", name='" + name + "'" + 46 | "}"; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/StudentDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto; 2 | 3 | import io.quarkus.runtime.annotations.RegisterForReflection; 4 | 5 | @RegisterForReflection 6 | public class StudentDTO { 7 | private String ine; 8 | private String nom; 9 | private String prenom; 10 | private String mail; 11 | private String groupe; 12 | 13 | public String getIne() { return ine; } 14 | public void setIne(String value) { this.ine = value; } 15 | 16 | public String getNom() { return nom; } 17 | public void setNom(String value) { this.nom = value; } 18 | 19 | public String getPrenom() { return prenom; } 20 | public void setPrenom(String value) { this.prenom = value; } 21 | 22 | public String getMail() { return mail; } 23 | public void setMail(String value) { this.mail = value; } 24 | 25 | public String getGroupe() { return groupe; } 26 | public void setGroupe(String value) { this.groupe = value; } 27 | @Override 28 | public String toString() { 29 | return "StudentDTO [groupe=" + groupe + ", ine=" + ine + ", mail=" + mail + ", nom=" + nom + ", prenom=" 30 | + prenom + "]"; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/ManagementInfoService.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service; 2 | 3 | 4 | import fr.istic.config.JHipsterInfo; 5 | import fr.istic.service.dto.ManagementInfoDTO; 6 | import io.quarkus.runtime.LaunchMode; 7 | import jakarta.enterprise.context.ApplicationScoped; 8 | import jakarta.inject.Inject; 9 | 10 | /** 11 | * Provides information for management/info resource 12 | */ 13 | @ApplicationScoped 14 | public class ManagementInfoService { 15 | 16 | private final JHipsterInfo JHipsterInfo; 17 | 18 | @Inject 19 | public ManagementInfoService(JHipsterInfo JHipsterInfo) { 20 | this.JHipsterInfo = JHipsterInfo; 21 | } 22 | 23 | public ManagementInfoDTO getManagementInfo(){ 24 | var info = new ManagementInfoDTO(); 25 | if(JHipsterInfo.isEnable()){ 26 | info.activeProfiles.add("swagger"); 27 | info.activeProfiles.add("api-docs"); 28 | 29 | } 30 | // List profiles= ConfigUtils.getProfiles(); 31 | info.activeProfiles.add(LaunchMode.current().getProfileKey()); 32 | info.displayRibbonOnProfiles = LaunchMode.current().getProfileKey(); 33 | return info; 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/config/LocalDateProvider.java: -------------------------------------------------------------------------------- 1 | package fr.istic.config; 2 | 3 | import jakarta.ws.rs.ext.ParamConverter; 4 | import jakarta.ws.rs.ext.ParamConverterProvider; 5 | import jakarta.ws.rs.ext.Provider; 6 | import java.lang.annotation.Annotation; 7 | import java.lang.reflect.Type; 8 | import java.time.LocalDate; 9 | import java.time.format.DateTimeFormatter; 10 | 11 | @Provider 12 | public class LocalDateProvider implements ParamConverterProvider { 13 | 14 | public static DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern(Constants.LOCAL_DATE_FORMAT); 15 | 16 | @Override 17 | public ParamConverter getConverter(Class rawType, Type genericType, Annotation[] annotations) { 18 | if(!rawType.equals(LocalDate.class)){ 19 | return null; 20 | } 21 | return new ParamConverter<>() { 22 | @Override 23 | public T fromString(String value) { 24 | return (T) LocalDate.parse(value, dateFormatter); 25 | } 26 | 27 | @Override 28 | public String toString(T value) { 29 | return ((LocalDate) value).format(dateFormatter); 30 | } 31 | }; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/web/rest/vm/LoggerVM.java: -------------------------------------------------------------------------------- 1 | package fr.istic.web.rest.vm; 2 | 3 | import io.quarkus.runtime.annotations.RegisterForReflection; 4 | 5 | import java.util.Optional; 6 | import java.util.logging.Level; 7 | import java.util.logging.Logger; 8 | 9 | @RegisterForReflection 10 | public class LoggerVM { 11 | public String name; 12 | public String effectiveLevel; 13 | public String configuredLevel; 14 | 15 | public LoggerVM(String name, Logger logger) { 16 | this.name = name; 17 | this.configuredLevel = Optional.of(logger).map(Logger::getLevel).map(Level::getName).orElse(null); 18 | this.effectiveLevel = retrieveEffectiveLogLevel(logger); 19 | } 20 | 21 | public LoggerVM(String name, String effectiveLevel, String configuredLevel) { 22 | this.name = name; 23 | this.effectiveLevel = effectiveLevel; 24 | this.configuredLevel = configuredLevel; 25 | } 26 | 27 | public LoggerVM() {} 28 | 29 | private String retrieveEffectiveLogLevel(Logger logger) { 30 | if (logger == null) { 31 | return null; 32 | } 33 | if (logger.getLevel() != null) { 34 | return logger.getLevel().getName(); 35 | } 36 | 37 | return retrieveEffectiveLogLevel(logger.getParent()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/Paged.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service; 2 | 3 | import io.quarkus.hibernate.orm.panache.PanacheQuery; 4 | 5 | import java.util.Collections; 6 | import java.util.List; 7 | import java.util.function.Function; 8 | import java.util.stream.Collectors; 9 | 10 | public class Paged { 11 | 12 | public final long index; 13 | public final long size; 14 | 15 | public final long totalCount; 16 | public final long pageCount; 17 | 18 | public final List content; 19 | 20 | public Paged(PanacheQuery query) { 21 | this(query.page().index, query.page().size, query.count(), query.pageCount(), query.list()); 22 | } 23 | 24 | public Paged(long index, long size, long totalCount, long pageCount, List content) { 25 | this.index = index; 26 | this.size = size; 27 | this.totalCount = totalCount; 28 | this.pageCount = pageCount; 29 | this.content = Collections.unmodifiableList(content); 30 | } 31 | 32 | public Paged map(Function mapper) { 33 | var mapped = content.stream().map(mapper).collect(Collectors.toList()); 34 | return new Paged(this.index, this.size, this.totalCount, this.pageCount, mapped); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/UserModelShare.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto; 2 | 3 | import io.quarkus.runtime.annotations.RegisterForReflection; 4 | 5 | @RegisterForReflection 6 | public class UserModelShare { 7 | private String name; 8 | 9 | 10 | private String firstname; 11 | private String login; 12 | 13 | public UserModelShare(){} 14 | 15 | public UserModelShare(String name, String firstname, String login) { 16 | this.name = name; 17 | this.firstname = firstname; 18 | this.login = login; 19 | } 20 | public String getName() { 21 | return name; 22 | } 23 | public void setName(String name) { 24 | this.name = name; 25 | } 26 | public String getFirstname() { 27 | return firstname; 28 | } 29 | public void setFirstname(String firstname) { 30 | this.firstname = firstname; 31 | } 32 | public String getLogin() { 33 | return login; 34 | } 35 | public void setLogin(String login) { 36 | this.login = login; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return "UserModelShare [firstname=" + firstname + ", login=" + login + ", name=" + name + "]"; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/web/rest/AuthorityResource.java: -------------------------------------------------------------------------------- 1 | package fr.istic.web.rest; 2 | 3 | import fr.istic.security.AuthoritiesConstants; 4 | import fr.istic.service.UserService; 5 | import java.util.List; 6 | import jakarta.annotation.security.RolesAllowed; 7 | import jakarta.enterprise.context.RequestScoped; 8 | import jakarta.inject.Inject; 9 | import jakarta.ws.rs.Consumes; 10 | import jakarta.ws.rs.GET; 11 | import jakarta.ws.rs.Path; 12 | import jakarta.ws.rs.Produces; 13 | import jakarta.ws.rs.core.MediaType; 14 | 15 | /** 16 | * REST controller to manage authorities. 17 | */ 18 | @Path("/api") 19 | @Produces(MediaType.APPLICATION_JSON) 20 | @Consumes(MediaType.APPLICATION_JSON) 21 | @RequestScoped 22 | public class AuthorityResource { 23 | 24 | final UserService userService; 25 | 26 | @Inject 27 | public AuthorityResource(UserService userService) { 28 | this.userService = userService; 29 | } 30 | 31 | /** 32 | * Gets a list of all roles. 33 | * 34 | * @return a string list of all roles. 35 | */ 36 | @GET 37 | @Path("/authorities") 38 | @RolesAllowed(AuthoritiesConstants.ADMIN) 39 | public List getAuthorities() { 40 | return userService.getAuthorities(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/web/rest/vm/SortRequestVM.java: -------------------------------------------------------------------------------- 1 | package fr.istic.web.rest.vm; 2 | 3 | import io.quarkus.panache.common.Sort; 4 | 5 | import jakarta.ws.rs.QueryParam; 6 | import java.util.List; 7 | 8 | public class SortRequestVM { 9 | 10 | @QueryParam("sort") 11 | public List sort; 12 | 13 | public Sort toSort() { 14 | Sort resultSort = null; 15 | 16 | for(String currentSort : sort) { 17 | var sortDetails = currentSort.split(","); 18 | var columnName = sortDetails[0]; 19 | var direction = sortDetails.length > 1 ? sortDetails[1] : null; 20 | 21 | if(resultSort == null) { 22 | resultSort = Sort.by(columnName, toDirection(direction)); 23 | } else { 24 | resultSort.and(columnName, toDirection(direction)); 25 | } 26 | } 27 | 28 | return resultSort; 29 | } 30 | 31 | private Sort.Direction toDirection(String direction) { 32 | return "asc".equals(direction) ? Sort.Direction.Ascending : Sort.Direction.Descending; 33 | } 34 | 35 | @Override 36 | public String toString() { 37 | return "SortRequestVM{" + 38 | "sort='" + sort + '\'' + 39 | '}'; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /.jhipster/ExamSheet.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ExamSheet", 3 | "fields": [ 4 | { 5 | "fieldName": "name", 6 | "fieldType": "String", 7 | "fieldValidateRules": ["required"] 8 | }, 9 | { 10 | "fieldName": "pagemin", 11 | "fieldType": "Integer" 12 | }, 13 | { 14 | "fieldName": "pagemax", 15 | "fieldType": "Integer" 16 | } 17 | ], 18 | "relationships": [ 19 | { 20 | "relationshipType": "many-to-one", 21 | "otherEntityName": "scan", 22 | "otherEntityRelationshipName": "sheets", 23 | "relationshipName": "scan", 24 | "otherEntityField": "name" 25 | }, 26 | { 27 | "relationshipType": "many-to-many", 28 | "otherEntityName": "student", 29 | "otherEntityRelationshipName": "examSheets", 30 | "relationshipName": "students", 31 | "otherEntityField": "name", 32 | "ownerSide": false 33 | } 34 | ], 35 | "changelogDate": "20220309165235", 36 | "entityTableName": "exam_sheet", 37 | "dto": "mapstruct", 38 | "pagination": "pagination", 39 | "service": "serviceClass", 40 | "jpaMetamodelFiltering": false, 41 | "fluentMethods": true, 42 | "readOnly": false, 43 | "embedded": false, 44 | "clientRootFolder": "", 45 | "applications": "*" 46 | } 47 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/master.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/main/resources/config/liquibase/mastertest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.github/workflows/develop.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven 3 | 4 | name: Java CI with Maven 5 | 6 | on: 7 | push: 8 | branches: [ develop ] 9 | 10 | jobs: 11 | build: 12 | 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - uses: actions/checkout@v4 17 | - name: Set up JDK 21 18 | uses: actions/setup-java@v4 19 | with: 20 | java-version: '21' 21 | distribution: 'temurin' 22 | cache: maven 23 | - name: Build with Maven 24 | run: mvn -B package --file pom.xml -Pnative 25 | - name: Set up Docker Buildx 26 | uses: docker/setup-buildx-action@v2 27 | - name: Login to DockerHub 28 | uses: docker/login-action@v2 29 | with: 30 | username: ${{ secrets.DOCKERHUB_USERNAME }} 31 | password: ${{ secrets.DOCKERHUB_TOKEN }} 32 | - name: Build and push 33 | uses: docker/build-push-action@v4 34 | with: 35 | context: ./ 36 | file: ./src/main/docker/Dockerfile.native 37 | push: true 38 | tags: barais/grade-scope-istic:develop 39 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/dto/CommentsDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | 4 | import io.quarkus.runtime.annotations.RegisterForReflection; 5 | import java.io.Serializable; 6 | import java.util.Objects; 7 | 8 | /** 9 | * A DTO for the {@link fr.istic.domain.Comments} entity. 10 | */ 11 | @RegisterForReflection 12 | public class CommentsDTO implements Serializable { 13 | 14 | public Long id; 15 | 16 | public String zonegeneratedid; 17 | 18 | public String jsonData; 19 | 20 | public Long studentResponseId; 21 | 22 | @Override 23 | public boolean equals(Object o) { 24 | if (this == o) { 25 | return true; 26 | } 27 | if (!(o instanceof CommentsDTO)) { 28 | return false; 29 | } 30 | 31 | return id != null && id.equals(((CommentsDTO) o).id); 32 | } 33 | 34 | @Override 35 | public int hashCode() { 36 | return 31; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return "CommentsDTO{" + 42 | "id=" + id + 43 | ", zonegeneratedid='" + zonegeneratedid + "'" + 44 | ", jsonData='" + jsonData + "'" + 45 | ", studentResponseId=" + studentResponseId + 46 | "}"; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/TemplateCaseDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto; 2 | 3 | 4 | import io.quarkus.runtime.annotations.RegisterForReflection; 5 | import jakarta.validation.constraints.*; 6 | import java.io.Serializable; 7 | 8 | import com.fasterxml.jackson.annotation.JsonProperty; 9 | 10 | /** 11 | * A DTO for the {@link fr.istic.domain.Template} entity. 12 | */ 13 | @RegisterForReflection 14 | public class TemplateCaseDTO implements Serializable { 15 | 16 | public Long id; 17 | 18 | 19 | public String contentContentType; 20 | 21 | @JsonProperty("caseboxname") 22 | public Boolean caseboxname; 23 | 24 | 25 | 26 | @Override 27 | public boolean equals(Object o) { 28 | if (this == o) { 29 | return true; 30 | } 31 | if (!(o instanceof TemplateCaseDTO)) { 32 | return false; 33 | } 34 | 35 | return id != null && id.equals(((TemplateCaseDTO) o).id); 36 | } 37 | 38 | @Override 39 | public int hashCode() { 40 | return 31; 41 | } 42 | 43 | @Override 44 | public String toString() { 45 | return "TemplateCaseDTO{" + 46 | "id=" + id + 47 | ", caseboxname='" + caseboxname + "'" + 48 | "}"; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/mapper/FinalResultMapper.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.mapper; 2 | 3 | 4 | import fr.istic.domain.*; 5 | import fr.istic.service.dto.FinalResultDTO; 6 | 7 | import org.mapstruct.*; 8 | 9 | /** 10 | * Mapper for the entity {@link FinalResult} and its DTO {@link FinalResultDTO}. 11 | */ 12 | @Mapper(componentModel = "jakarta", uses = {StudentMapper.class, ExamMapper.class}, injectionStrategy = InjectionStrategy.CONSTRUCTOR) 13 | public interface FinalResultMapper extends EntityMapper { 14 | 15 | @Mapping(source = "student.id", target = "studentId") 16 | @Mapping(source = "student.name", target = "studentName") 17 | @Mapping(source = "exam.id", target = "examId") 18 | @Mapping(source = "exam.name", target = "examName") 19 | FinalResultDTO toDto(FinalResult finalResult); 20 | 21 | @Mapping(source = "studentId", target = "student") 22 | @Mapping(source = "examId", target = "exam") 23 | FinalResult toEntity(FinalResultDTO finalResultDTO); 24 | 25 | default FinalResult fromId(Long id) { 26 | if (id == null) { 27 | return null; 28 | } 29 | FinalResult finalResult = new FinalResult(); 30 | finalResult.id = id; 31 | return finalResult; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/mapper/PredictionMapper.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.mapper; 2 | 3 | import fr.istic.domain.*; 4 | import fr.istic.service.dto.PredictionDTO; 5 | 6 | import org.mapstruct.*; 7 | 8 | /** 9 | * Mapper for the entity {@link Prediction} and its DTO {@link PredictionDTO}. 10 | */ 11 | @Mapper(componentModel = "jakarta", uses = {QuestionMapper.class, ExamSheetMapper.class}, injectionStrategy = InjectionStrategy.CONSTRUCTOR) 12 | public interface PredictionMapper extends EntityMapper { 13 | 14 | @Mapping(source = "question.id", target = "questionId") 15 | @Mapping(source = "sheet.id", target = "sheetId") 16 | @Mapping(source = "sheet.pagemin", target = "sheetPageMin") 17 | @Mapping(source = "sheet.pagemax", target = "sheetPageMax") 18 | PredictionDTO toDto(Prediction prediction); 19 | 20 | @Mapping(source = "questionId", target = "question") 21 | @Mapping(source = "sheetId", target = "sheet") 22 | Prediction toEntity(PredictionDTO predictionDTO); 23 | 24 | default Prediction fromId(Long id) { 25 | if (id == null) { 26 | return null; 27 | } 28 | Prediction prediction = new Prediction(); 29 | prediction.id = id; 30 | return prediction; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/domain/AuthorityTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.domain; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import fr.istic.security.AuthoritiesConstants; 6 | import io.quarkus.test.junit.QuarkusTest; 7 | import org.junit.jupiter.api.Test; 8 | 9 | public class AuthorityTest { 10 | 11 | @Test 12 | public void testAuthorityEquals() { 13 | var authorityA = new Authority(); 14 | assertThat(authorityA).isEqualTo(authorityA); 15 | assertThat(authorityA).isNotEqualTo(null); 16 | assertThat(authorityA).isNotEqualTo(new Object()); 17 | assertThat(authorityA.hashCode()).isEqualTo(0); 18 | assertThat(authorityA.toString()).isNotNull(); 19 | 20 | var authorityB = new Authority(); 21 | assertThat(authorityA).isEqualTo(authorityB); 22 | 23 | authorityB.name = AuthoritiesConstants.ADMIN; 24 | assertThat(authorityA).isNotEqualTo(authorityB); 25 | 26 | authorityA.name = AuthoritiesConstants.USER; 27 | assertThat(authorityA).isNotEqualTo(authorityB); 28 | 29 | authorityB.name = AuthoritiesConstants.USER; 30 | assertThat(authorityA).isEqualTo(authorityB); 31 | assertThat(authorityA.hashCode()).isEqualTo(authorityB.hashCode()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /.jhipster/Course.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Course", 3 | "fields": [ 4 | { 5 | "fieldName": "name", 6 | "fieldType": "String", 7 | "fieldValidateRules": ["required"] 8 | } 9 | ], 10 | "relationships": [ 11 | { 12 | "relationshipType": "one-to-many", 13 | "otherEntityName": "exam", 14 | "otherEntityRelationshipName": "course", 15 | "relationshipName": "exam" 16 | }, 17 | { 18 | "relationshipType": "one-to-many", 19 | "otherEntityName": "courseGroup", 20 | "otherEntityRelationshipName": "course", 21 | "relationshipName": "groups" 22 | }, 23 | { 24 | "relationshipType": "many-to-many", 25 | "otherEntityName": "user", 26 | "otherEntityRelationshipName": "course", 27 | "relationshipValidateRules": "required", 28 | "relationshipName": "prof", 29 | "otherEntityField": "login", 30 | "ownerSide": true 31 | } 32 | ], 33 | "changelogDate": "20220309164635", 34 | "entityTableName": "course", 35 | "dto": "mapstruct", 36 | "pagination": "pagination", 37 | "service": "serviceClass", 38 | "jpaMetamodelFiltering": false, 39 | "fluentMethods": true, 40 | "readOnly": false, 41 | "embedded": false, 42 | "clientRootFolder": "", 43 | "applications": "*" 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/dto/ScanDTOContent.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | 4 | import io.quarkus.runtime.annotations.RegisterForReflection; 5 | import jakarta.validation.constraints.*; 6 | import java.io.Serializable; 7 | import java.util.Objects; 8 | import jakarta.persistence.Lob; 9 | 10 | /** 11 | * A DTO for the {@link fr.istic.domain.Scan} entity. 12 | */ 13 | @RegisterForReflection 14 | public class ScanDTOContent implements Serializable { 15 | 16 | public Long id; 17 | 18 | @NotNull 19 | public String name; 20 | 21 | @Lob 22 | public byte[] content; 23 | 24 | public String contentContentType; 25 | 26 | 27 | @Override 28 | public boolean equals(Object o) { 29 | if (this == o) { 30 | return true; 31 | } 32 | if (!(o instanceof ScanDTO)) { 33 | return false; 34 | } 35 | 36 | return id != null && id.equals(((ScanDTO) o).id); 37 | } 38 | 39 | @Override 40 | public int hashCode() { 41 | return 31; 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return "ScanDTO{" + 47 | "id=" + id + 48 | ", name='" + name + "'" + 49 | ", content='" + content + "'" + 50 | "}"; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/dto/ZoneDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | 4 | import io.quarkus.runtime.annotations.RegisterForReflection; 5 | import java.io.Serializable; 6 | 7 | /** 8 | * A DTO for the {@link fr.istic.domain.Zone} entity. 9 | */ 10 | @RegisterForReflection 11 | public class ZoneDTO implements Serializable { 12 | 13 | public Long id; 14 | 15 | public Integer pageNumber; 16 | 17 | public Integer xInit; 18 | 19 | public Integer yInit; 20 | 21 | public Integer width; 22 | 23 | public Integer height; 24 | 25 | 26 | @Override 27 | public boolean equals(Object o) { 28 | if (this == o) { 29 | return true; 30 | } 31 | if (!(o instanceof ZoneDTO)) { 32 | return false; 33 | } 34 | 35 | return id != null && id.equals(((ZoneDTO) o).id); 36 | } 37 | 38 | @Override 39 | public int hashCode() { 40 | return 31; 41 | } 42 | 43 | @Override 44 | public String toString() { 45 | return "ZoneDTO{" + 46 | "id=" + id + 47 | ", pageNumber=" + pageNumber + 48 | ", xInit=" + xInit + 49 | ", yInit=" + yInit + 50 | ", width=" + width + 51 | ", height=" + height + 52 | "}"; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/WorstAndBestSolution.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import io.quarkus.runtime.annotations.RegisterForReflection; 7 | 8 | @RegisterForReflection 9 | public class WorstAndBestSolution { 10 | private long numero; 11 | 12 | private List bestSolutions = new ArrayList<>(); 13 | private List worstSolutions= new ArrayList<>(); 14 | 15 | public WorstAndBestSolution(){ 16 | 17 | } 18 | 19 | public WorstAndBestSolution(long numero) { 20 | this.numero = numero; 21 | } 22 | public long getNumero() { return numero; } 23 | public void setNumero(long value) { this.numero = value; } 24 | 25 | public List getBestSolutions() { return bestSolutions; } 26 | public void setBestSolutions(List value) { this.bestSolutions = value; } 27 | 28 | public List getWorstSolutions() { return worstSolutions; } 29 | public void setWorstSolutions(List value) { this.worstSolutions = value; } 30 | 31 | @Override 32 | public String toString() { 33 | return "WorstAndBestSolution [bestSolutions=" + bestSolutions + ", numero=" + numero + ", worstSolutions=" 34 | + worstSolutions + "]"; 35 | } 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/dto/QuestionTypeDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | 4 | import io.quarkus.runtime.annotations.RegisterForReflection; 5 | import jakarta.validation.constraints.*; 6 | import java.io.Serializable; 7 | import java.util.Objects; 8 | 9 | /** 10 | * A DTO for the {@link fr.istic.domain.QuestionType} entity. 11 | */ 12 | @RegisterForReflection 13 | public class QuestionTypeDTO implements Serializable { 14 | 15 | public Long id; 16 | 17 | @NotNull 18 | public String algoName; 19 | 20 | public String endpoint; 21 | 22 | public String jsFunction; 23 | 24 | 25 | @Override 26 | public boolean equals(Object o) { 27 | if (this == o) { 28 | return true; 29 | } 30 | if (!(o instanceof QuestionTypeDTO)) { 31 | return false; 32 | } 33 | 34 | return id != null && id.equals(((QuestionTypeDTO) o).id); 35 | } 36 | 37 | @Override 38 | public int hashCode() { 39 | return 31; 40 | } 41 | 42 | @Override 43 | public String toString() { 44 | return "QuestionTypeDTO{" + 45 | "id=" + id + 46 | ", algoName='" + algoName + "'" + 47 | ", endpoint='" + endpoint + "'" + 48 | ", jsFunction='" + jsFunction + "'" + 49 | "}"; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/exportpdf/Zonepdf.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto.exportpdf; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | import io.quarkus.runtime.annotations.RegisterForReflection; 6 | 7 | @RegisterForReflection 8 | public class Zonepdf { 9 | private long height; 10 | private long id; 11 | private long pageNumber; 12 | private long width; 13 | 14 | @JsonProperty("xInit") 15 | private long xInit; 16 | private long yInit; 17 | 18 | public long getHeight() { return height; } 19 | public void setHeight(long value) { this.height = value; } 20 | 21 | public long getID() { return id; } 22 | public void setID(long value) { this.id = value; } 23 | 24 | public long getPageNumber() { return pageNumber; } 25 | public void setPageNumber(long value) { this.pageNumber = value; } 26 | 27 | public long getWidth() { return width; } 28 | public void setWidth(long value) { this.width = value; } 29 | 30 | @JsonProperty("xInit") 31 | public long getXInit() { return xInit; } 32 | @JsonProperty("xInit") 33 | public void setXInit(long value) { this.xInit = value; } 34 | 35 | @JsonProperty("yInit") 36 | public long getYInit() { return yInit; } 37 | @JsonProperty("yInit") 38 | public void setYInit(long value) { this.yInit = value; } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/docker/Dockerfile.build.amd64: -------------------------------------------------------------------------------- 1 | FROM quay.io/quarkus/ubi-quarkus-graalvmce-builder-image:jdk-21 AS build-step 2 | USER root 3 | WORKDIR /app 4 | # RUN gu install native-image 5 | RUN microdnf install git -y 6 | RUN git clone https://github.com/correctexam/corrigeExamBack 7 | WORKDIR /app/corrigeExamBack 8 | RUN git checkout develop 9 | WORKDIR /app/corrigeExamBack 10 | 11 | RUN mkdir -p /opt/maven 12 | WORKDIR /opt/maven 13 | RUN curl -O "https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz" && tar xzvf "apache-maven-3.9.6-bin.tar.gz" && rm "apache-maven-3.9.6-bin.tar.gz" 14 | 15 | WORKDIR /app/corrigeExamBack 16 | RUN /opt/maven/apache-maven-3.9.6/bin/mvn package -Pnative 17 | 18 | FROM quay.io/quarkus/quarkus-micro-image:2.0-amd64 as prod 19 | WORKDIR /work/ 20 | RUN chown 1001 /work \ 21 | && chmod "g+rwX" /work \ 22 | && chown 1001:root /work 23 | COPY --chown=1001:root --from=build-step /app/corrigeExamBack/target/*-runner /work/application 24 | # COPY --chown=1001:root ./src/main/resources/db/migration/ /work/migration 25 | EXPOSE 8080 26 | USER 1001 27 | 28 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0", "-Dquarkus.datasource.jdbc.url=jdbc:mysql://correctexam-mysql:3306/correctexam?useUnicode=true&characterEncoding=utf8&useSSL=false"] 29 | #, "-Dquarkus.flyway.locations=filesystem:/work/migration/"] 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/dto/CourseDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | 4 | import io.quarkus.runtime.annotations.RegisterForReflection; 5 | import jakarta.validation.constraints.*; 6 | import java.io.Serializable; 7 | import java.util.HashSet; 8 | import java.util.Set; 9 | import java.util.Objects; 10 | 11 | /** 12 | * A DTO for the {@link fr.istic.domain.Course} entity. 13 | */ 14 | @RegisterForReflection 15 | public class CourseDTO implements Serializable { 16 | 17 | public Long id; 18 | 19 | @NotNull 20 | public String name; 21 | 22 | public Boolean archived = false; 23 | 24 | 25 | public Set profs = new HashSet<>(); 26 | 27 | @Override 28 | public boolean equals(Object o) { 29 | if (this == o) { 30 | return true; 31 | } 32 | if (!(o instanceof CourseDTO)) { 33 | return false; 34 | } 35 | 36 | return id != null && id.equals(((CourseDTO) o).id); 37 | } 38 | 39 | @Override 40 | public int hashCode() { 41 | return 31; 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return "CourseDTO{" + 47 | "id=" + id + 48 | ", name='" + name + "'" + 49 | ", archived='" + archived + "'" + 50 | ", profs='" + profs + "'" + 51 | "}"; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/security/RandomUtil.java: -------------------------------------------------------------------------------- 1 | package fr.istic.security; 2 | 3 | import java.security.SecureRandom; 4 | import org.apache.commons.lang3.RandomStringUtils; 5 | 6 | public class RandomUtil { 7 | private static final int DEF_COUNT = 20; 8 | 9 | private static final SecureRandom SECURE_RANDOM; 10 | 11 | static { 12 | SECURE_RANDOM = new SecureRandom(); 13 | SECURE_RANDOM.nextBytes(new byte[64]); 14 | } 15 | 16 | private RandomUtil() {} 17 | 18 | public static String generateRandomAlphanumericString() { 19 | return RandomStringUtils.random(DEF_COUNT, 0, 0, true, true, null, SECURE_RANDOM); 20 | } 21 | 22 | /** 23 | * Generate a password. 24 | * 25 | * @return the generated password. 26 | */ 27 | public static String generatePassword() { 28 | return generateRandomAlphanumericString(); 29 | } 30 | 31 | /** 32 | * Generate an activation key. 33 | * 34 | * @return the generated activation key. 35 | */ 36 | public static String generateActivationKey() { 37 | return generateRandomAlphanumericString(); 38 | } 39 | 40 | /** 41 | * Generate a reset key. 42 | * 43 | * @return the generated reset key. 44 | */ 45 | public static String generateResetKey() { 46 | return generateRandomAlphanumericString(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/dto/FinalResultDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | 4 | import io.quarkus.runtime.annotations.RegisterForReflection; 5 | import java.io.Serializable; 6 | import java.util.Objects; 7 | 8 | /** 9 | * A DTO for the {@link fr.istic.domain.FinalResult} entity. 10 | */ 11 | @RegisterForReflection 12 | public class FinalResultDTO implements Serializable { 13 | 14 | public Long id; 15 | 16 | public Integer note; 17 | 18 | public Long studentId; 19 | public String studentName; 20 | public Long examId; 21 | public String examName; 22 | 23 | @Override 24 | public boolean equals(Object o) { 25 | if (this == o) { 26 | return true; 27 | } 28 | if (!(o instanceof FinalResultDTO)) { 29 | return false; 30 | } 31 | 32 | return id != null && id.equals(((FinalResultDTO) o).id); 33 | } 34 | 35 | @Override 36 | public int hashCode() { 37 | return 31; 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return "FinalResultDTO{" + 43 | "id=" + id + 44 | ", note=" + note + 45 | ", studentId=" + studentId + 46 | ", studentName='" + studentName + "'" + 47 | ", examId=" + examId + 48 | ", examName='" + examName + "'" + 49 | "}"; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/dto/TextCommentDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | 4 | import io.quarkus.runtime.annotations.RegisterForReflection; 5 | import java.io.Serializable; 6 | import java.util.Objects; 7 | import jakarta.persistence.Lob; 8 | 9 | /** 10 | * A DTO for the {@link fr.istic.domain.TextComment} entity. 11 | */ 12 | @RegisterForReflection 13 | public class TextCommentDTO implements Serializable { 14 | 15 | public Long id; 16 | 17 | public String text; 18 | 19 | @Lob 20 | public String description; 21 | 22 | public String zonegeneratedid; 23 | 24 | public Long questionId; 25 | 26 | @Override 27 | public boolean equals(Object o) { 28 | if (this == o) { 29 | return true; 30 | } 31 | if (!(o instanceof TextCommentDTO)) { 32 | return false; 33 | } 34 | 35 | return id != null && id.equals(((TextCommentDTO) o).id); 36 | } 37 | 38 | @Override 39 | public int hashCode() { 40 | return 31; 41 | } 42 | 43 | @Override 44 | public String toString() { 45 | return "TextCommentDTO{" + 46 | "id=" + id + 47 | ", text='" + text + "'" + 48 | ", description='" + description + "'" + 49 | ", zonegeneratedid='" + zonegeneratedid + "'" + 50 | ", questionId=" + questionId + 51 | "}"; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /.github/workflows/maven.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven 3 | 4 | name: Java CI with Maven 5 | 6 | on: 7 | push: 8 | branches: [ deploy ] 9 | 10 | jobs: 11 | build: 12 | 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - uses: actions/checkout@v4 17 | - name: Set up JDK 21 18 | uses: actions/setup-java@v4 19 | with: 20 | java-version: '21' 21 | distribution: 'temurin' 22 | cache: maven 23 | - name: Build with Maven 24 | run: mvn -B package --file pom.xml -Pnative,shib 25 | # - name: Build the Docker image 26 | # run: docker build -f src/main/docker/Dockerfile.native -t barais/grade-scope-istic . 27 | - name: Set up Docker Buildx 28 | uses: docker/setup-buildx-action@v2 29 | - name: Login to DockerHub 30 | uses: docker/login-action@v2 31 | with: 32 | username: ${{ secrets.DOCKERHUB_USERNAME }} 33 | password: ${{ secrets.DOCKERHUB_TOKEN }} 34 | - name: Build and push 35 | uses: docker/build-push-action@v4 36 | with: 37 | context: ./ 38 | file: ./src/main/docker/Dockerfile.native 39 | push: true 40 | tags: barais/grade-scope-istic:latest 41 | -------------------------------------------------------------------------------- /src/main/docker/prometheus/prometheus.yml: -------------------------------------------------------------------------------- 1 | # Sample global config for monitoring JHipster applications 2 | global: 3 | scrape_interval: 15s # By default, scrape targets every 15 seconds. 4 | evaluation_interval: 15s # By default, scrape targets every 15 seconds. 5 | # scrape_timeout is set to the global default (10s). 6 | 7 | # Attach these labels to any time series or alerts when communicating with 8 | # external systems (federation, remote storage, Alertmanager). 9 | external_labels: 10 | monitor: 'jhipster' 11 | 12 | # A scrape configuration containing exactly one endpoint to scrape: 13 | # Here it's Prometheus itself. 14 | scrape_configs: 15 | # The job name is added as a label `job=` to any timeseries scraped from this config. 16 | - job_name: 'prometheus' 17 | 18 | # Override the global default and scrape targets from this job every 5 seconds. 19 | scrape_interval: 5s 20 | 21 | # scheme defaults to 'http' enable https in case your application is server via https 22 | #scheme: https 23 | # basic auth is not needed by default. See https://www.jhipster.tech/monitoring/#configuring-metrics-forwarding for details 24 | #basic_auth: 25 | # username: admin 26 | # password: admin 27 | metrics_path: /management/prometheus 28 | static_configs: 29 | - targets: 30 | # On MacOS, replace localhost by host.docker.internal 31 | - localhost:8080 32 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/dto/ExamSheetDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | 4 | import io.quarkus.runtime.annotations.RegisterForReflection; 5 | import jakarta.validation.constraints.*; 6 | import java.io.Serializable; 7 | import java.util.Objects; 8 | 9 | /** 10 | * A DTO for the {@link fr.istic.domain.ExamSheet} entity. 11 | */ 12 | @RegisterForReflection 13 | public class ExamSheetDTO implements Serializable { 14 | 15 | public Long id; 16 | 17 | @NotNull 18 | public String name; 19 | 20 | public Integer pagemin; 21 | 22 | public Integer pagemax; 23 | 24 | public Long scanId; 25 | public String scanName; 26 | 27 | @Override 28 | public boolean equals(Object o) { 29 | if (this == o) { 30 | return true; 31 | } 32 | if (!(o instanceof ExamSheetDTO)) { 33 | return false; 34 | } 35 | 36 | return id != null && id.equals(((ExamSheetDTO) o).id); 37 | } 38 | 39 | @Override 40 | public int hashCode() { 41 | return 31; 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return "ExamSheetDTO{" + 47 | "id=" + id + 48 | ", name='" + name + "'" + 49 | ", pagemin=" + pagemin + 50 | ", pagemax=" + pagemax + 51 | ", scanId=" + scanId + 52 | ", scanName='" + scanName + "'" + 53 | "}"; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/test/java/fr/istic/config/LocalDateProviderTest.java: -------------------------------------------------------------------------------- 1 | package fr.istic.config; 2 | import org.junit.jupiter.api.Test; 3 | 4 | import jakarta.ws.rs.ext.ParamConverter; 5 | import java.time.LocalDate; 6 | 7 | import static org.assertj.core.api.AssertionsForClassTypes.assertThat; 8 | 9 | class LocalDateProviderTest { 10 | 11 | private LocalDateProvider localDateProvider = new LocalDateProvider(); 12 | 13 | @Test 14 | void should_ReturnParamConverterAndConverterConverts(){ 15 | final ParamConverter converter = localDateProvider.getConverter(LocalDate.class, null, null); 16 | assertThat(converter).isNotNull(); 17 | } 18 | 19 | @Test 20 | void should_ConvertLocalDateToString(){ 21 | final ParamConverter converter = localDateProvider.getConverter(LocalDate.class, null, null); 22 | final LocalDate now = LocalDate.now(); 23 | final String expected = LocalDateProvider.dateFormatter.format(now); 24 | assertThat(converter.toString(now)).isEqualTo(expected); 25 | } 26 | 27 | @Test 28 | void should_ConvertStringToLocalDate(){ 29 | final ParamConverter converter = localDateProvider.getConverter(LocalDate.class, null, null); 30 | final LocalDate date = LocalDate.now(); 31 | final String dateString = LocalDateProvider.dateFormatter.format(date); 32 | assertThat(converter.fromString(dateString)).isEqualTo(date); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/docker/exampleconf/myadmin.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 90; 3 | # listen [::]:90; 4 | # server name to change based on your own domain name for phpmyadmin 5 | # server_name myadmin.barais.fr; 6 | server_name localhost; 7 | #charset koi8-r; 8 | #access_log /var/log/nginx/host.access.log main; 9 | 10 | location / { 11 | proxy_pass http://myadmin:80; 12 | proxy_set_header Host $http_host; 13 | 14 | } 15 | 16 | 17 | 18 | #error_page 404 /404.html; 19 | 20 | # redirect server error pages to the static page /50x.html 21 | # 22 | error_page 500 502 503 504 /50x.html; 23 | location = /50x.html { 24 | root /usr/share/nginx/html; 25 | } 26 | 27 | # proxy the PHP scripts to Apache listening on 127.0.0.1:80 28 | # 29 | #location ~ \.php$ { 30 | # proxy_pass http://127.0.0.1; 31 | #} 32 | 33 | # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 34 | # 35 | #location ~ \.php$ { 36 | # root html; 37 | # fastcgi_pass 127.0.0.1:9000; 38 | # fastcgi_index index.php; 39 | # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 40 | # include fastcgi_params; 41 | #} 42 | 43 | # deny access to .htaccess files, if Apache's document root 44 | # concurs with nginx's one 45 | # 46 | #location ~ /\.ht { 47 | # deny all; 48 | #} 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/dto/CourseGroupDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | 4 | import io.quarkus.runtime.annotations.RegisterForReflection; 5 | import jakarta.validation.constraints.*; 6 | import java.io.Serializable; 7 | import java.util.HashSet; 8 | import java.util.Set; 9 | import java.util.Objects; 10 | 11 | /** 12 | * A DTO for the {@link fr.istic.domain.CourseGroup} entity. 13 | */ 14 | @RegisterForReflection 15 | public class CourseGroupDTO implements Serializable { 16 | 17 | public Long id; 18 | 19 | @NotNull 20 | public String groupName; 21 | 22 | public Set students = new HashSet<>(); 23 | public Long courseId; 24 | public String courseName; 25 | 26 | @Override 27 | public boolean equals(Object o) { 28 | if (this == o) { 29 | return true; 30 | } 31 | if (!(o instanceof CourseGroupDTO)) { 32 | return false; 33 | } 34 | 35 | return id != null && id.equals(((CourseGroupDTO) o).id); 36 | } 37 | 38 | @Override 39 | public int hashCode() { 40 | return 31; 41 | } 42 | 43 | @Override 44 | public String toString() { 45 | return "CourseGroupDTO{" + 46 | "id=" + id + 47 | ", groupName='" + groupName + "'" + 48 | ", students='" + students + "'" + 49 | ", courseId=" + courseId + 50 | ", courseName='" + courseName + "'" + 51 | "}"; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/dto/GradedCommentDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | 4 | import io.quarkus.runtime.annotations.RegisterForReflection; 5 | import java.io.Serializable; 6 | import java.util.Objects; 7 | import jakarta.persistence.Lob; 8 | 9 | /** 10 | * A DTO for the {@link fr.istic.domain.GradedComment} entity. 11 | */ 12 | @RegisterForReflection 13 | public class GradedCommentDTO implements Serializable { 14 | 15 | public Long id; 16 | 17 | public String zonegeneratedid; 18 | 19 | public String text; 20 | 21 | @Lob 22 | public String description; 23 | 24 | public Double grade; 25 | 26 | public Long questionId; 27 | 28 | @Override 29 | public boolean equals(Object o) { 30 | if (this == o) { 31 | return true; 32 | } 33 | if (!(o instanceof GradedCommentDTO)) { 34 | return false; 35 | } 36 | 37 | return id != null && id.equals(((GradedCommentDTO) o).id); 38 | } 39 | 40 | @Override 41 | public int hashCode() { 42 | return 31; 43 | } 44 | 45 | @Override 46 | public String toString() { 47 | return "GradedCommentDTO{" + 48 | "id=" + id + 49 | ", zonegeneratedid='" + zonegeneratedid + "'" + 50 | ", text='" + text + "'" + 51 | ", description='" + description + "'" + 52 | ", grade=" + grade + 53 | ", questionId=" + questionId + 54 | "}"; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/docker/k8s/correctexam-mysql-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | labels: 5 | fr.correctexam.service: correctexam-mysql 6 | name: correctexam-mysql 7 | namespace: correctexam 8 | spec: 9 | replicas: 1 10 | selector: 11 | matchLabels: 12 | fr.correctexam.service: correctexam-mysql 13 | strategy: 14 | type: Recreate 15 | template: 16 | metadata: 17 | labels: 18 | fr.correctexam.service: correctexam-mysql 19 | spec: 20 | containers: 21 | - args: 22 | - mysqld 23 | - --lower_case_table_names=1 24 | - --skip-ssl 25 | - --character_set_server=utf8mb4 26 | - --explicit_defaults_for_timestamp 27 | env: 28 | - name: MYSQL_ALLOW_EMPTY_PASSWORD 29 | value: "yes" 30 | - name: MYSQL_DATABASE 31 | value: correctexam 32 | - name: MYSQL_USER 33 | value: root 34 | image: mysql:8.0.20 35 | name: correctexam-mysql 36 | ports: 37 | - containerPort: 3306 38 | resources: {} 39 | volumeMounts: 40 | - mountPath: /docker-entrypoint-initdb.d/v1.sql 41 | name: correctexam-mysql-claim0 42 | subPath: v1Sql 43 | restartPolicy: Always 44 | volumes: 45 | - name: correctexam-mysql-claim0 46 | configMap: 47 | name: mysqlinit-cfgmap 48 | status: {} 49 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/exportpdf/Questionspdf.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto.exportpdf; 2 | 3 | import io.quarkus.runtime.annotations.RegisterForReflection; 4 | 5 | @RegisterForReflection 6 | public class Questionspdf { 7 | private String gradeType; 8 | private long id; 9 | private long numero; 10 | private Double point; 11 | private long step; 12 | private String typeAlgoName; 13 | private long typeID; 14 | private Zonepdf zonepdf; 15 | 16 | public String getGradeType() { return gradeType; } 17 | public void setGradeType(String value) { this.gradeType = value; } 18 | 19 | public long getID() { return id; } 20 | public void setID(long value) { this.id = value; } 21 | 22 | public long getNumero() { return numero; } 23 | public void setNumero(long value) { this.numero = value; } 24 | 25 | public Double getPoint() { return point; } 26 | public void setPoint(Double value) { this.point = value; } 27 | 28 | public long getStep() { return step; } 29 | public void setStep(long value) { this.step = value; } 30 | 31 | public String getTypeAlgoName() { return typeAlgoName; } 32 | public void setTypeAlgoName(String value) { this.typeAlgoName = value; } 33 | 34 | public long getTypeID() { return typeID; } 35 | public void setTypeID(long value) { this.typeID = value; } 36 | 37 | public Zonepdf getZonepdf() { return zonepdf; } 38 | public void setZonepdf(Zonepdf value) { this.zonepdf = value; } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/exportcomments/Answer.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto.exportcomments; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import io.quarkus.runtime.annotations.RegisterForReflection; 7 | @RegisterForReflection 8 | 9 | public class Answer { 10 | private Long sheetId; 11 | private String sheetName; 12 | private Double grade; 13 | private Integer pagemin; 14 | private Integer pagemax; 15 | private List comments = new ArrayList<>(); 16 | private Prediction prediction; 17 | 18 | public Long getSheetId() { return sheetId; } 19 | public void setSheetId(Long value) { this.sheetId = value; } 20 | 21 | public String getSheetName() { return sheetName; } 22 | public void setSheetName(String value) { this.sheetName = value; } 23 | 24 | public Double getGrade() { return grade; } 25 | public void setGrade(Double value) { this.grade = value; } 26 | 27 | public Integer getPagemin() { return pagemin; } 28 | public void setPagemin(Integer value) { this.pagemin = value; } 29 | 30 | public Integer getPagemax() { return pagemax; } 31 | public void setPagemax(Integer value) { this.pagemax = value; } 32 | 33 | public List getComments() { return comments; } 34 | public void setComments(List value) { this.comments = value; } 35 | 36 | public Prediction getPrediction() { return prediction; } 37 | public void setPrediction(Prediction value) { this.prediction = value; } 38 | } 39 | -------------------------------------------------------------------------------- /.jhipster/Student.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Student", 3 | "fields": [ 4 | { 5 | "fieldName": "name", 6 | "fieldType": "String", 7 | "fieldValidateRules": ["required"] 8 | }, 9 | { 10 | "fieldName": "firstname", 11 | "fieldType": "String" 12 | }, 13 | { 14 | "fieldName": "ine", 15 | "fieldType": "String", 16 | "fieldValidateRules": ["required"] 17 | }, 18 | { 19 | "fieldName": "caslogin", 20 | "fieldType": "String" 21 | }, 22 | { 23 | "fieldName": "mail", 24 | "fieldType": "String" 25 | } 26 | ], 27 | "relationships": [ 28 | { 29 | "relationshipType": "many-to-many", 30 | "otherEntityName": "examSheet", 31 | "otherEntityRelationshipName": "students", 32 | "relationshipName": "examSheets", 33 | "otherEntityField": "name", 34 | "ownerSide": true 35 | }, 36 | { 37 | "relationshipType": "many-to-many", 38 | "otherEntityName": "courseGroup", 39 | "otherEntityRelationshipName": "students", 40 | "relationshipName": "groups", 41 | "otherEntityField": "groupName", 42 | "ownerSide": false 43 | } 44 | ], 45 | "changelogDate": "20220309164835", 46 | "entityTableName": "student", 47 | "dto": "mapstruct", 48 | "pagination": "pagination", 49 | "service": "serviceClass", 50 | "jpaMetamodelFiltering": false, 51 | "fluentMethods": true, 52 | "readOnly": false, 53 | "embedded": false, 54 | "clientRootFolder": "", 55 | "applications": "*" 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/exportpdf/Sheetspdf.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto.exportpdf; 2 | 3 | import java.util.List; 4 | 5 | import io.quarkus.runtime.annotations.RegisterForReflection; 6 | 7 | @RegisterForReflection 8 | 9 | public class Sheetspdf { 10 | private long id; 11 | private String name; 12 | private double finalresult; 13 | private long pagemax; 14 | private long pagemin; 15 | private List studentpdf; 16 | private List studentResponsepdf; 17 | 18 | public long getID() { return id; } 19 | public void setID(long value) { this.id = value; } 20 | 21 | public String getName() { return name; } 22 | public void setName(String value) { this.name = value; } 23 | 24 | public double getFinalresult() { return finalresult; } 25 | public void setFinalresult(double value) { this.finalresult = value; } 26 | 27 | public long getPagemax() { return pagemax; } 28 | public void setPagemax(long value) { this.pagemax = value; } 29 | 30 | public long getPagemin() { return pagemin; } 31 | public void setPagemin(long value) { this.pagemin = value; } 32 | 33 | public List getStudentpdf() { return studentpdf; } 34 | public void setStudentpdf(List value) { this.studentpdf = value; } 35 | 36 | public List getStudentResponsepdf() { return studentResponsepdf; } 37 | public void setStudentResponsepdf(List value) { this.studentResponsepdf = value; } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/exportpdf/ExportPDFDto.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto.exportpdf; 2 | 3 | import java.util.List; 4 | 5 | import io.quarkus.runtime.annotations.RegisterForReflection; 6 | 7 | @RegisterForReflection 8 | public class ExportPDFDto { 9 | private Zonepdf firstnamezonepdf; 10 | private long id; 11 | 12 | private String name; 13 | private Zonepdf namezonepdf; 14 | private long scanfileID; 15 | private List sheetspdf; 16 | private List questionspdf; 17 | 18 | public Zonepdf getFirstnamezonepdf() { return firstnamezonepdf; } 19 | public void setFirstnamezonepdf(Zonepdf value) { this.firstnamezonepdf = value; } 20 | 21 | public long getID() { return id; } 22 | public void setID(long value) { this.id = value; } 23 | 24 | public String getName() { return name; } 25 | public void setName(String value) { this.name = value; } 26 | 27 | public Zonepdf getNamezonepdf() { return namezonepdf; } 28 | public void setNamezonepdf(Zonepdf value) { this.namezonepdf = value; } 29 | 30 | public long getScanfileID() { return scanfileID; } 31 | public void setScanfileID(long value) { this.scanfileID = value; } 32 | 33 | public List getSheetspdf() { return sheetspdf; } 34 | public void setSheetspdf(List value) { this.sheetspdf = value; } 35 | 36 | public List getQuestionspdf() { return questionspdf; } 37 | public void setQuestionspdf(List value) { this.questionspdf = value; } 38 | } 39 | -------------------------------------------------------------------------------- /.yo-rc.json: -------------------------------------------------------------------------------- 1 | { 2 | "generator-jhipster": { 3 | "promptValues": { 4 | "packageName": "fr.istic", 5 | "nativeLanguage": "fr" 6 | }, 7 | "jhipsterVersion": "6.10.5", 8 | "applicationType": "monolith", 9 | "baseName": "gradeScopeIstic", 10 | "packageName": "fr.istic", 11 | "packageFolder": "fr/istic", 12 | "serverPort": "8080", 13 | "authenticationType": "jwt", 14 | "cacheProvider": "caffeine", 15 | "enableHibernateCache": true, 16 | "websocket": false, 17 | "databaseType": "sql", 18 | "devDatabaseType": "h2Disk", 19 | "prodDatabaseType": "mysql", 20 | "messageBroker": false, 21 | "buildTool": "maven", 22 | "jwtSecretKey": "MTljNTFhZTE4YjI0ZDViODg0ODdhZTM1ZjY4Nzg0ZTc3NjAyNzExYzYxNWE4ZDI5Y2Q3YWUxMjdmMGEwM2JlZjg0OTI0OWI5OWY0YTZlYTcwYTRhM2FlZWE2MGM2NWNlZDA0ZWU1Njc0YjA0MzM1ZDYyNDUyY2JhNDUxNzViNTY=", 23 | "embeddableLaunchScript": false, 24 | "creationTimestamp": 1646843861472, 25 | "jhiPrefix": "jhi", 26 | "entitySuffix": "", 27 | "dtoSuffix": "DTO", 28 | "otherModules": [ 29 | { 30 | "name": "generator-jhipster-quarkus", 31 | "version": "1.1.1" 32 | } 33 | ], 34 | "enableTranslation": true, 35 | "clientPackageManager": "npm", 36 | "nativeLanguage": "fr", 37 | "languages": ["fr", "en"], 38 | "blueprints": [ 39 | { 40 | "name": "generator-jhipster-quarkus", 41 | "version": "1.1.1" 42 | } 43 | ], 44 | "skipClient": true, 45 | "searchEngine": false, 46 | "serviceDiscoveryType": false 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/dto/TemplateDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | 4 | import io.quarkus.runtime.annotations.RegisterForReflection; 5 | import jakarta.validation.constraints.*; 6 | import java.io.Serializable; 7 | 8 | import com.fasterxml.jackson.annotation.JsonProperty; 9 | 10 | /** 11 | * A DTO for the {@link fr.istic.domain.Template} entity. 12 | */ 13 | @RegisterForReflection 14 | public class TemplateDTO implements Serializable { 15 | 16 | public Long id; 17 | 18 | @NotNull 19 | public String name; 20 | 21 | public String contentContentType; 22 | 23 | @JsonProperty("mark") 24 | public Boolean mark; 25 | 26 | @JsonProperty("caseboxname") 27 | public Boolean caseboxname; 28 | 29 | 30 | public Boolean autoMapStudentCopyToList; 31 | 32 | 33 | @Override 34 | public boolean equals(Object o) { 35 | if (this == o) { 36 | return true; 37 | } 38 | if (!(o instanceof TemplateDTO)) { 39 | return false; 40 | } 41 | 42 | return id != null && id.equals(((TemplateDTO) o).id); 43 | } 44 | 45 | @Override 46 | public int hashCode() { 47 | return 31; 48 | } 49 | 50 | @Override 51 | public String toString() { 52 | return "TemplateDTO{" + 53 | "id=" + id + 54 | ", name='" + name + "'" + 55 | ", mark='" + mark + "'" + 56 | ", caseboxname='" + caseboxname + "'" + 57 | ", autoMapStudentCopyToList='" + autoMapStudentCopyToList + "'" + 58 | "}"; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/mapper/Answer2HybridGradedCommentMapper.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.mapper; 2 | 3 | import fr.istic.domain.*; 4 | import fr.istic.service.dto.Answer2HybridGradedCommentDTO; 5 | import org.mapstruct.*; 6 | 7 | /** 8 | * Mapper for the entity {@link Answer2HybridGradedComment} and its DTO {@link Answer2HybridGradedCommentDTO}. 9 | */ 10 | @Mapper(componentModel = "jakarta", uses = { HybridGradedCommentMapper.class, StudentResponseMapper.class }, injectionStrategy = InjectionStrategy.CONSTRUCTOR) 11 | public interface Answer2HybridGradedCommentMapper extends EntityMapper { 12 | @Mapping(source = "hybridcomments.id", target = "hybridcommentsId") 13 | @Mapping(source = "hybridcomments.text", target = "hybridcommentsText") 14 | @Mapping(source = "studentResponse.id", target = "studentResponseId") 15 | Answer2HybridGradedCommentDTO toDto(Answer2HybridGradedComment answer2HybridGradedComment); 16 | 17 | @Mapping(source = "hybridcommentsId", target = "hybridcomments") 18 | @Mapping(source = "studentResponseId", target = "studentResponse") 19 | Answer2HybridGradedComment toEntity(Answer2HybridGradedCommentDTO answer2HybridGradedCommentDTO); 20 | 21 | default Answer2HybridGradedComment fromId(Long id) { 22 | if (id == null) { 23 | return null; 24 | } 25 | Answer2HybridGradedComment answer2HybridGradedComment = new Answer2HybridGradedComment(); 26 | answer2HybridGradedComment.id = id; 27 | return answer2HybridGradedComment; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/dto/StudentDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | 4 | import io.quarkus.runtime.annotations.RegisterForReflection; 5 | import jakarta.validation.constraints.*; 6 | import java.io.Serializable; 7 | import java.util.HashSet; 8 | import java.util.Set; 9 | 10 | /** 11 | * A DTO for the {@link fr.istic.domain.Student} entity. 12 | */ 13 | @RegisterForReflection 14 | public class StudentDTO implements Serializable { 15 | 16 | public Long id; 17 | 18 | @NotNull 19 | public String name; 20 | 21 | public String firstname; 22 | 23 | @NotNull 24 | public String ine; 25 | 26 | public String caslogin; 27 | 28 | public String mail; 29 | 30 | public Set examSheets = new HashSet<>(); 31 | 32 | @Override 33 | public boolean equals(Object o) { 34 | if (this == o) { 35 | return true; 36 | } 37 | if (!(o instanceof StudentDTO)) { 38 | return false; 39 | } 40 | 41 | return id != null && id.equals(((StudentDTO) o).id); 42 | } 43 | 44 | @Override 45 | public int hashCode() { 46 | return 31; 47 | } 48 | 49 | @Override 50 | public String toString() { 51 | return "StudentDTO{" + 52 | "id=" + id + 53 | ", name='" + name + "'" + 54 | ", firstname='" + firstname + "'" + 55 | ", ine='" + ine + "'" + 56 | ", caslogin='" + caslogin + "'" + 57 | ", mail='" + mail + "'" + 58 | ", examSheets='" + examSheets + "'" + 59 | "}"; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/dto/Answer2HybridGradedCommentDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | import io.quarkus.runtime.annotations.RegisterForReflection; 4 | import java.io.Serializable; 5 | import java.util.Objects; 6 | 7 | /** 8 | * A DTO for the {@link fr.istic.domain.Answer2HybridGradedComment} entity. 9 | */ 10 | @RegisterForReflection 11 | public class Answer2HybridGradedCommentDTO implements Serializable { 12 | 13 | public Long id; 14 | 15 | public Integer stepValue; 16 | 17 | public Long hybridcommentsId; 18 | public String hybridcommentsText; 19 | public Long studentResponseId; 20 | 21 | @Override 22 | public boolean equals(Object o) { 23 | if (this == o) { 24 | return true; 25 | } 26 | if (!(o instanceof Answer2HybridGradedCommentDTO)) { 27 | return false; 28 | } 29 | 30 | return id != null && id.equals(((Answer2HybridGradedCommentDTO) o).id); 31 | } 32 | 33 | @Override 34 | public int hashCode() { 35 | return 31; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return ( 41 | "Answer2HybridGradedCommentDTO{" + 42 | "id=" + 43 | id + 44 | ", stepValue=" + 45 | stepValue + 46 | ", hybridcommentsId=" + 47 | hybridcommentsId + 48 | ", hybridcommentsText='" + 49 | hybridcommentsText + 50 | "'" + 51 | ", studentResponseId=" + 52 | studentResponseId + 53 | "}" 54 | ); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/dto/PredictionDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | import io.quarkus.runtime.annotations.RegisterForReflection; 4 | import java.io.Serializable; 5 | import jakarta.persistence.Lob; 6 | 7 | /** 8 | * A DTO for the {@link fr.istic.domain.Prediction} entity. 9 | */ 10 | @RegisterForReflection 11 | public class PredictionDTO implements Serializable { 12 | 13 | public Long id; 14 | 15 | public String text; 16 | 17 | @Lob 18 | public String jsonData; 19 | 20 | public String questionNumber; 21 | 22 | public Long questionId; 23 | 24 | public Long sheetId; 25 | public Long sheetPageMin; 26 | public Long sheetPageMax; 27 | 28 | public Double predictionconfidence; 29 | 30 | 31 | @Override 32 | public boolean equals(Object o) { 33 | if (this == o) { 34 | return true; 35 | } 36 | if (!(o instanceof PredictionDTO)) { 37 | return false; 38 | } 39 | 40 | return id != null && id.equals(((PredictionDTO) o).id); 41 | } 42 | 43 | @Override 44 | public int hashCode() { 45 | return 31; 46 | } 47 | 48 | @Override 49 | public String toString() { 50 | return "PredictionDTO{" + 51 | "id=" + id + 52 | ", text='" + text + "'" + 53 | ", jsonData='" + jsonData + "'" + 54 | ", predictionconfidence='" + predictionconfidence + "'" + 55 | ", questionNumber='" + questionNumber + "'" + 56 | ", questionId=" + questionId + 57 | ", sheetId=" + sheetId + 58 | "}"; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/domain/Authority.java: -------------------------------------------------------------------------------- 1 | package fr.istic.domain; 2 | 3 | import io.quarkus.hibernate.orm.panache.PanacheEntityBase; 4 | import io.quarkus.runtime.annotations.RegisterForReflection; 5 | import java.io.Serializable; 6 | import java.util.Objects; 7 | import jakarta.persistence.Column; 8 | import jakarta.persistence.Entity; 9 | import jakarta.persistence.Id; 10 | import jakarta.persistence.Table; 11 | import jakarta.validation.constraints.NotNull; 12 | import jakarta.validation.constraints.Size; 13 | import jakarta.persistence.*; 14 | 15 | /** 16 | * An authority (a security role). 17 | */ 18 | @Entity 19 | @Table(name = "jhi_authority") 20 | @Cacheable 21 | @RegisterForReflection 22 | public class Authority extends PanacheEntityBase implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | @NotNull 26 | @Size(max = 50) 27 | @Id 28 | @Column(length = 50) 29 | public String name; 30 | 31 | public Authority() { 32 | //empty 33 | } 34 | 35 | public Authority(String name) { 36 | //for jsonb 37 | this.name = name; 38 | } 39 | 40 | @Override 41 | public boolean equals(Object o) { 42 | if (this == o) { 43 | return true; 44 | } 45 | if (!(o instanceof Authority)) { 46 | return false; 47 | } 48 | return Objects.equals(name, ((Authority) o).name); 49 | } 50 | 51 | @Override 52 | public int hashCode() { 53 | return Objects.hashCode(name); 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | return "Authority{" + "name='" + name + '\'' + "}"; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/mapper/GradedCommentMapper.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.mapper; 2 | 3 | 4 | import fr.istic.domain.*; 5 | import fr.istic.service.dto.GradedCommentDTO; 6 | 7 | import org.mapstruct.*; 8 | 9 | /** 10 | * Mapper for the entity {@link GradedComment} and its DTO {@link GradedCommentDTO}. 11 | */ 12 | @Mapper(componentModel = "jakarta", uses = {QuestionMapper.class}, injectionStrategy = InjectionStrategy.CONSTRUCTOR) 13 | public interface GradedCommentMapper extends EntityMapper { 14 | 15 | @Mapping(source = "question.id", target = "questionId") 16 | @Mapping(source = "gradequarter", target = "grade", qualifiedByName = "gradequarter2grade") 17 | GradedCommentDTO toDto(GradedComment gradedComment); 18 | 19 | @Mapping(source = "questionId", target = "question") 20 | @Mapping(target = "studentResponses", ignore = true) 21 | @Mapping(source = "grade", target = "gradequarter", qualifiedByName = "grade2gradequarter") 22 | GradedComment toEntity(GradedCommentDTO gradedCommentDTO); 23 | 24 | default GradedComment fromId(Long id) { 25 | if (id == null) { 26 | return null; 27 | } 28 | GradedComment gradedComment = new GradedComment(); 29 | gradedComment.id = id; 30 | return gradedComment; 31 | } 32 | 33 | @Named("gradequarter2grade") 34 | public static double quarterpoint2point(int gradequarter) { 35 | return Integer.valueOf(gradequarter).doubleValue() /4; 36 | } 37 | 38 | @Named("grade2gradequarter") 39 | public static int point2quarterpoint(double grade) { 40 | return Double.valueOf(grade *4).intValue(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/dto/TemplateDTOContent.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | 4 | import io.quarkus.runtime.annotations.RegisterForReflection; 5 | import jakarta.validation.constraints.*; 6 | import java.io.Serializable; 7 | import java.util.Objects; 8 | 9 | import com.fasterxml.jackson.annotation.JsonProperty; 10 | 11 | import jakarta.persistence.Lob; 12 | 13 | /** 14 | * A DTO for the {@link fr.istic.domain.Template} entity. 15 | */ 16 | @RegisterForReflection 17 | public class TemplateDTOContent implements Serializable { 18 | 19 | public Long id; 20 | 21 | @NotNull 22 | public String name; 23 | 24 | @Lob 25 | public byte[] content; 26 | 27 | public String contentContentType; 28 | 29 | public Boolean mark; 30 | 31 | public Boolean autoMapStudentCopyToList; 32 | 33 | @JsonProperty("caseboxname") 34 | public Boolean caseboxname; 35 | 36 | @Override 37 | public boolean equals(Object o) { 38 | if (this == o) { 39 | return true; 40 | } 41 | if (!(o instanceof TemplateDTO)) { 42 | return false; 43 | } 44 | 45 | return id != null && id.equals(((TemplateDTO) o).id); 46 | } 47 | 48 | @Override 49 | public int hashCode() { 50 | return 31; 51 | } 52 | 53 | @Override 54 | public String toString() { 55 | return "TemplateDTO{" + 56 | "id=" + id + 57 | ", name='" + name + "'" + 58 | ", caseboxname='" + caseboxname + "'" + 59 | ", content='" + content + "'" + 60 | ", mark='" + mark + "'" + 61 | ", autoMapStudentCopyToList='" + autoMapStudentCopyToList + "'" + 62 | "}"; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | My Web Application 8 | 9 | 23 | 24 | html 25 | text/html 26 | 27 | 28 | txt 29 | text/plain 30 | 31 | 32 | jpg 33 | image/jpeg 34 | 35 | 36 | png 37 | image/png 38 | 39 | 40 | js 41 | text/plain 42 | 43 | 44 | mjs 45 | text/plain 46 | 47 | 48 | css 49 | text/css 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /src/main/resources/db/migration/V1__Initial_versionjusdata.sql: -------------------------------------------------------------------------------- 1 | 2 | START TRANSACTION; 3 | 4 | 5 | 6 | INSERT INTO `jhi_user` (`id`, `login`, `password_hash`, `first_name`, `last_name`, `email`, `image_url`, `activated`, `lang_key`, `activation_key`, `reset_key`, `created_by`, `created_date`, `reset_date`, `last_modified_by`, `last_modified_date`) VALUES 7 | (1, 'system', '$2a$10$mE.qmcV0mFU5NcKh73TZx.z4ueI/.bDWbj0T1BYyqP481kGGarKLG', 'System', 'System', 'system@localhost', '', b'1', 'fr', NULL, NULL, 'system', NULL, NULL, 'system', NULL), 8 | (2, 'anonymoususer', '$2a$10$j8S5d7Sr7.8VTOYNviDPOeWX8KcYILUVJBsYV83Y5NtECayypx9lO', 'Anonymous', 'User', 'anonymous@localhost', '', b'1', 'fr', NULL, NULL, 'system', NULL, NULL, 'system', NULL), 9 | (3, 'admin', '$2a$10$gSAhZrxMllrbgj/kkK9UceBPpChGWJA7SYIb1Mqo.n5aNLq1/oRrC', 'Administrator', 'Administrator', 'admin@localhost', '', b'1', 'fr', NULL, NULL, 'system', NULL, NULL, 'system', NULL), 10 | (4, 'user', '$2a$10$VEjxo0jq2YG9Rbk2HmX9S.k1uZBGYUHdUcid3g/vfiEl7lwWgOH/K', 'User', 'User', 'user@localhost', '', b'1', 'fr', NULL, NULL, 'system', NULL, NULL, 'system', NULL); 11 | 12 | -- -------------------------------------------------------- 13 | 14 | -- 15 | -- Déchargement des données de la table `jhi_authority` 16 | -- 17 | 18 | INSERT INTO `jhi_authority` (`name`) VALUES 19 | ('ROLE_ADMIN'), 20 | ('ROLE_USER'); 21 | -- 22 | -- Déchargement des données de la table `jhi_user_authority` 23 | -- 24 | 25 | INSERT INTO `jhi_user_authority` (`user_id`, `authority_name`) VALUES 26 | (1, 'ROLE_ADMIN'), 27 | (3, 'ROLE_ADMIN'), 28 | (1, 'ROLE_USER'), 29 | (3, 'ROLE_USER'), 30 | (4, 'ROLE_USER'); 31 | 32 | alter table question add column randomhorizontalcorrection bit default 0; 33 | 34 | 35 | COMMIT; 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/dto/HybridGradedCommentDTO.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.dto; 2 | 3 | import io.quarkus.runtime.annotations.RegisterForReflection; 4 | import java.io.Serializable; 5 | import java.util.Objects; 6 | import jakarta.persistence.Lob; 7 | 8 | /** 9 | * A DTO for the {@link fr.istic.domain.HybridGradedComment} entity. 10 | */ 11 | @RegisterForReflection 12 | public class HybridGradedCommentDTO implements Serializable { 13 | 14 | public Long id; 15 | 16 | public String text; 17 | 18 | @Lob 19 | public String description; 20 | 21 | public Double grade; 22 | 23 | public Boolean relative; 24 | 25 | public Integer step; 26 | 27 | public Long questionId; 28 | 29 | @Override 30 | public boolean equals(Object o) { 31 | if (this == o) { 32 | return true; 33 | } 34 | if (!(o instanceof HybridGradedCommentDTO)) { 35 | return false; 36 | } 37 | 38 | return id != null && id.equals(((HybridGradedCommentDTO) o).id); 39 | } 40 | 41 | @Override 42 | public int hashCode() { 43 | return 31; 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return ( 49 | "HybridGradedCommentDTO{" + 50 | "id=" + 51 | id + 52 | ", text='" + 53 | text + 54 | "'" + 55 | ", description='" + 56 | description + 57 | "'" + 58 | ", grade=" + 59 | grade + 60 | ", relative='" + 61 | relative + 62 | "'" + 63 | ", step=" + 64 | step + 65 | ", questionId=" + 66 | questionId + 67 | "}" 68 | ); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/mapper/HybridGradedCommentMapper.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.mapper; 2 | 3 | import fr.istic.domain.*; 4 | import fr.istic.service.dto.HybridGradedCommentDTO; 5 | import org.mapstruct.*; 6 | 7 | /** 8 | * Mapper for the entity {@link HybridGradedComment} and its DTO {@link HybridGradedCommentDTO}. 9 | */ 10 | @Mapper(componentModel = "jakarta", uses = {QuestionMapper.class}, injectionStrategy = InjectionStrategy.CONSTRUCTOR) 11 | public interface HybridGradedCommentMapper extends EntityMapper { 12 | @Mapping(source = "question.id", target = "questionId") 13 | @Mapping(source = "grade", target = "grade", qualifiedByName = "quarterpoint2point") 14 | HybridGradedCommentDTO toDto(HybridGradedComment hybridGradedComment); 15 | 16 | @Mapping(source = "questionId", target = "question") 17 | @Mapping(target = "valueAnswers", ignore = true) 18 | @Mapping(source = "grade", target = "grade", qualifiedByName = "point2quarterpoint") 19 | 20 | HybridGradedComment toEntity(HybridGradedCommentDTO hybridGradedCommentDTO); 21 | 22 | default HybridGradedComment fromId(Long id) { 23 | if (id == null) { 24 | return null; 25 | } 26 | HybridGradedComment hybridGradedComment = new HybridGradedComment(); 27 | hybridGradedComment.id = id; 28 | return hybridGradedComment; 29 | } 30 | 31 | @Named("quarterpoint2point") 32 | public static Double quarterpoint2point(Integer quarterpoint) { 33 | return Integer.valueOf(quarterpoint).doubleValue() /4; 34 | } 35 | 36 | @Named("point2quarterpoint") 37 | public static Integer point2quarterpoint(Double point) { 38 | return Double.valueOf(point *4).intValue(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/web/rest/JHipsterConfigurationEndpoint.java: -------------------------------------------------------------------------------- 1 | package fr.istic.web.rest; 2 | 3 | import fr.istic.web.rest.vm.ConfigPropsVM; 4 | import fr.istic.web.rest.vm.EnvVM; 5 | import io.quarkus.runtime.LaunchMode; 6 | import io.quarkus.runtime.configuration.ConfigUtils; 7 | import fr.istic.security.AuthoritiesConstants; 8 | import org.eclipse.microprofile.config.ConfigProvider; 9 | import org.eclipse.microprofile.config.spi.ConfigSource; 10 | 11 | import jakarta.enterprise.context.RequestScoped; 12 | import jakarta.ws.rs.GET; 13 | import jakarta.ws.rs.Path; 14 | import jakarta.ws.rs.Produces; 15 | import jakarta.ws.rs.core.MediaType; 16 | import jakarta.annotation.security.RolesAllowed; 17 | import java.util.List; 18 | import java.util.stream.Collectors; 19 | import java.util.stream.StreamSupport; 20 | 21 | @Path("/management") 22 | @Produces(MediaType.APPLICATION_JSON) 23 | @RequestScoped 24 | public class JHipsterConfigurationEndpoint { 25 | 26 | @GET 27 | @Path("/configprops") 28 | @RolesAllowed(AuthoritiesConstants.ADMIN) 29 | public ConfigPropsVM getConfigs() { 30 | return new ConfigPropsVM(); 31 | } 32 | 33 | @GET 34 | @Path("/env") 35 | @RolesAllowed(AuthoritiesConstants.ADMIN) 36 | public EnvVM getEnvs() { 37 | Iterable configSources = ConfigProvider.getConfig().getConfigSources(); 38 | List propertySources = StreamSupport 39 | .stream(configSources.spliterator(), false) 40 | .map(configSource -> new EnvVM.PropertySource(configSource.getName(), configSource.getProperties())) 41 | .collect(Collectors.toList()); 42 | List profiles= ConfigUtils.getProfiles(); 43 | // LaunchMode.current().getProfileKey(); 44 | 45 | return new EnvVM(profiles, propertySources); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/docker/grafana/provisioning/datasources/datasource.yml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | # list of datasources that should be deleted from the database 4 | deleteDatasources: 5 | - name: Prometheus 6 | orgId: 1 7 | 8 | # list of datasources to insert/update depending 9 | # whats available in the database 10 | datasources: 11 | # name of the datasource. Required 12 | - name: Prometheus 13 | # datasource type. Required 14 | type: prometheus 15 | # access mode. direct or proxy. Required 16 | access: proxy 17 | # org id. will default to orgId 1 if not specified 18 | orgId: 1 19 | # url 20 | # On MacOS, replace localhost by host.docker.internal 21 | url: http://localhost:9090 22 | # database password, if used 23 | password: 24 | # database user, if used 25 | user: 26 | # database name, if used 27 | database: 28 | # enable/disable basic auth 29 | basicAuth: false 30 | # basic auth username 31 | basicAuthUser: admin 32 | # basic auth password 33 | basicAuthPassword: admin 34 | # enable/disable with credentials headers 35 | withCredentials: 36 | # mark as default datasource. Max one per org 37 | isDefault: true 38 | # fields that will be converted to json and stored in json_data 39 | jsonData: 40 | graphiteVersion: '1.1' 41 | tlsAuth: false 42 | tlsAuthWithCACert: false 43 | # json object of data that will be encrypted. 44 | secureJsonData: 45 | tlsCACert: '...' 46 | tlsClientCert: '...' 47 | tlsClientKey: '...' 48 | version: 1 49 | # allow users to edit datasources from the UI. 50 | editable: true 51 | -------------------------------------------------------------------------------- /src/main/java/fr/istic/service/customdto/exportpdf/Hybridcommentspdf.java: -------------------------------------------------------------------------------- 1 | package fr.istic.service.customdto.exportpdf; 2 | 3 | import io.quarkus.runtime.annotations.RegisterForReflection; 4 | 5 | @RegisterForReflection 6 | public class Hybridcommentspdf { 7 | private String description; 8 | private double grade; 9 | private String text; 10 | private double stepMax; 11 | private double stepValue; 12 | private boolean relative; 13 | private double answerGrade; 14 | 15 | 16 | 17 | 18 | public String getDescription() { return description; } 19 | public void setDescription(String value) { this.description = value; } 20 | 21 | public double getGrade() { return grade; } 22 | public void setGrade(double value) { this.grade = value; } 23 | 24 | public String getText() { return text; } 25 | public void setText(String value) { this.text = value; } 26 | 27 | 28 | public double getStepMax() { 29 | return this.stepMax; 30 | } 31 | 32 | public void setStepMax(double stepMax) { 33 | this.stepMax = stepMax; 34 | } 35 | 36 | public double getStepValue() { 37 | return this.stepValue; 38 | } 39 | 40 | public void setStepValue(double stepValue) { 41 | this.stepValue = stepValue; 42 | } 43 | 44 | public boolean isRelative() { 45 | return this.relative; 46 | } 47 | 48 | public boolean getRelative() { 49 | return this.relative; 50 | } 51 | 52 | public void setRelative(boolean relative) { 53 | this.relative = relative; 54 | } 55 | 56 | 57 | public double getAnswerGrade() { 58 | return this.answerGrade; 59 | } 60 | 61 | public void setAnswerGrade(double answerGrade) { 62 | this.answerGrade = answerGrade; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/resources/jwt/privateKey.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCWK8UjyoHgPTLa 3 | PLQJ8SoXLLjpHSjtLxMqmzHnFscqhTVVaDpCRCb6e3Ii/WniQTWw8RA7vf4djz4H 4 | OzvlfBFNgvUGZHXDwnmGaNVaNzpHYFMEYBhE8VGGiveSkzqeLZI+Y02G6sQAfDtN 5 | qqzM/l5QX8X34oQFaTBW1r49nftvCpITiwJvWyhkWtXP9RP8sXi1im5Vi3dhupOh 6 | nelk5n0BfajUYIbfHA6ORzjHRbt7NtBl0L2J+0/FUdHyKs6KMlFGNw8O0Dq88qnM 7 | uXoLJiewhg9332W3DFMeOveel+//cvDnRsCRtPgd4sXFPHh+UShkso7+DRsChXa6 8 | oGGQD3GdAgMBAAECggEAAjfTSZwMHwvIXIDZB+yP+pemg4ryt84iMlbofclQV8hv 9 | 6TsI4UGwcbKxFOM5VSYxbNOisb80qasb929gixsyBjsQ8284bhPJR7r0q8h1C+jY 10 | URA6S4pk8d/LmFakXwG9Tz6YPo3pJziuh48lzkFTk0xW2Dp4SLwtAptZY/+ZXyJ6 11 | 96QXDrZKSSM99Jh9s7a0ST66WoxSS0UC51ak+Keb0KJ1jz4bIJ2C3r4rYlSu4hHB 12 | Y73GfkWORtQuyUDa9yDOem0/z0nr6pp+pBSXPLHADsqvZiIhxD/O0Xk5I6/zVHB3 13 | zuoQqLERk0WvA8FXz2o8AYwcQRY2g30eX9kU4uDQAQKBgQDmf7KGImUGitsEPepF 14 | KH5yLWYWqghHx6wfV+fdbBxoqn9WlwcQ7JbynIiVx8MX8/1lLCCe8v41ypu/eLtP 15 | iY1ev2IKdrUStvYRSsFigRkuPHUo1ajsGHQd+ucTDf58mn7kRLW1JGMeGxo/t32B 16 | m96Af6AiPWPEJuVfgGV0iwg+HQKBgQCmyPzL9M2rhYZn1AozRUguvlpmJHU2DpqS 17 | 34Q+7x2Ghf7MgBUhqE0t3FAOxEC7IYBwHmeYOvFR8ZkVRKNF4gbnF9RtLdz0DMEG 18 | 5qsMnvJUSQbNB1yVjUCnDAtElqiFRlQ/k0LgYkjKDY7LfciZl9uJRl0OSYeX/qG2 19 | tRW09tOpgQKBgBSGkpM3RN/MRayfBtmZvYjVWh3yjkI2GbHA1jj1g6IebLB9SnfL 20 | WbXJErCj1U+wvoPf5hfBc7m+jRgD3Eo86YXibQyZfY5pFIh9q7Ll5CQl5hj4zc4Y 21 | b16sFR+xQ1Q9Pcd+BuBWmSz5JOE/qcF869dthgkGhnfVLt/OQzqZluZRAoGAXQ09 22 | nT0TkmKIvlza5Af/YbTqEpq8mlBDhTYXPlWCD4+qvMWpBII1rSSBtftgcgca9XLB 23 | MXmRMbqtQeRtg4u7dishZVh1MeP7vbHsNLppUQT9Ol6lFPsd2xUpJDc6BkFat62d 24 | Xjr3iWNPC9E9nhPPdCNBv7reX7q81obpeXFMXgECgYEAmk2Qlus3OV0tfoNRqNpe 25 | Mb0teduf2+h3xaI1XDIzPVtZF35ELY/RkAHlmWRT4PCdR0zXDidE67L6XdJyecSt 26 | FdOUH8z5qUraVVebRFvJqf/oGsXc4+ex1ZKUTbY0wqY1y9E39yvB3MaTmZFuuqk8 27 | f3cg+fr8aou7pr9SHhJlZCU= 28 | -----END PRIVATE KEY----- 29 | -------------------------------------------------------------------------------- /sonar-project.properties: -------------------------------------------------------------------------------- 1 | sonar.projectKey=correctExam 2 | sonar.projectName=correctExam generated by jhipster 3 | sonar.projectVersion=1.0 4 | 5 | sonar.sources=src/main/ 6 | sonar.host.url=http://localhost:9001 7 | 8 | sonar.tests=src/test/ 9 | sonar.coverage.jacoco.xmlReportPaths=target/jacoco/test/jacoco.xml,target/jacoco/integrationTest/jacoco.xml 10 | sonar.java.codeCoveragePlugin=jacoco 11 | sonar.junit.reportPaths=target/test-results/test,target/test-results/integrationTest 12 | 13 | sonar.sourceEncoding=UTF-8 14 | sonar.exclusions=src/main/webapp/content/**/*.*, src/main/webapp/i18n/*.js, target/classes/META-INF/resources**/*.* 15 | 16 | sonar.issue.ignore.multicriteria=S3437,S4502,S4684,UndocumentedApi 17 | # Rule https://sonarcloud.io/coding_rules?open=squid%3AS3437&rule_key=squid%3AS3437 is ignored, as a JPA-managed field cannot be transient 18 | sonar.issue.ignore.multicriteria.S3437.resourceKey=src/main/java/**/* 19 | sonar.issue.ignore.multicriteria.S3437.ruleKey=squid:S3437 20 | # Rule https://sonarcloud.io/coding_rules?open=squid%3AUndocumentedApi&rule_key=squid%3AUndocumentedApi is ignored, as we want to follow "clean code" guidelines and classes, methods and arguments names should be self-explanatory 21 | sonar.issue.ignore.multicriteria.UndocumentedApi.resourceKey=src/main/java/**/* 22 | sonar.issue.ignore.multicriteria.UndocumentedApi.ruleKey=squid:UndocumentedApi 23 | # Rule https://sonarcloud.io/coding_rules?open=squid%3AS4502&rule_key=squid%3AS4502 is ignored, as for JWT tokens we are not subject to CSRF attack 24 | sonar.issue.ignore.multicriteria.S4502.resourceKey=src/main/java/**/* 25 | sonar.issue.ignore.multicriteria.S4502.ruleKey=squid:S4502 26 | # Rule https://sonarcloud.io/coding_rules?open=java%3AS4684&rule_key=java%3AS4684 27 | sonar.issue.ignore.multicriteria.S4684.resourceKey=src/main/java/**/* 28 | sonar.issue.ignore.multicriteria.S4684.ruleKey=java:S4684 29 | -------------------------------------------------------------------------------- /src/main/docker/k8s/minio-dev.yaml: -------------------------------------------------------------------------------- 1 | 2 | # Deploys a new MinIO Pod into the metadata.namespace Kubernetes namespace 3 | # 4 | # The `spec.containers[0].args` contains the command run on the pod 5 | # The `/data` directory corresponds to the `spec.containers[0].volumeMounts[0].mountPath` 6 | # That mount path corresponds to a Kubernetes HostPath which binds `/data` to a local drive or volume on the worker node where the pod runs 7 | # 8 | apiVersion: v1 9 | kind: Pod 10 | metadata: 11 | labels: 12 | fr.correctexam.service: minio 13 | name: minio 14 | namespace: correctexam # Change this value to match the namespace metadata.name 15 | spec: 16 | containers: 17 | - name: minio 18 | image: quay.io/minio/minio:latest 19 | resources: {} 20 | command: 21 | - /bin/bash 22 | - -c 23 | args: 24 | - minio server /data --console-address :9090 25 | volumeMounts: 26 | - mountPath: /data 27 | name: localvolume # Corresponds to the `spec.volumes` Persistent Volume 28 | # nodeSelector: 29 | # kubernetes.io/hostname: kubealpha.local # Specify a node label associated to the Worker Node on which you want to deploy the pod. 30 | volumes: 31 | - name: localvolume 32 | hostPath: # MinIO generally recommends using locally-attached volumes 33 | path: /data # Specify a path to a local drive or volume on the Kubernetes worker node 34 | type: DirectoryOrCreate # The path to the last directory must exist 35 | --- 36 | 37 | apiVersion: v1 38 | kind: Service 39 | metadata: 40 | labels: 41 | fr.correctexam.service: minio 42 | name: minio 43 | namespace: correctexam 44 | 45 | spec: 46 | ports: 47 | - name: "9090" 48 | port: 9090 49 | targetPort: 9090 50 | - name: "9000" 51 | port: 9000 52 | targetPort: 9000 53 | 54 | selector: 55 | fr.correctexam.service: minio 56 | status: 57 | loadBalancer: {} 58 | --------------------------------------------------------------------------------