Skip to content

Commit

Permalink
update file java
Browse files Browse the repository at this point in the history
  • Loading branch information
barais committed Mar 9, 2024
1 parent 37e7d33 commit cbc4282
Show file tree
Hide file tree
Showing 14 changed files with 132 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml -Pnative
run: mvn -B package --file pom.xml -Pnative,shib
# - name: Build the Docker image
# run: docker build -f src/main/docker/Dockerfile.native -t barais/grade-scope-istic .
- name: Set up Docker Buildx
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ ALTER TABLE `gradeScopeIstic`.`answer_2_hybrid_graded_comment` ADD UNIQUE `Uniqu

ALTER TABLE `student_response` ADD UNIQUE(`question_id`, `sheet_id`);

@Table(
name = "product_serial_group_mask",
uniqueConstraints = {@UniqueConstraint(columnNames = {"mask", "group"})}
)

alter table student_response add column lastmodified datetime(6);
alter table student_response add column correctedby_id bigint;
alter table student_response add constraint FKinrpshecm7c6aiqo6000ju87c foreign key (correctedby_id) references jhi_user (id);
Expand Down
58 changes: 18 additions & 40 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<name>CorrectExam</name>
<properties>
<archunit-junit5.version>1.2.1</archunit-junit5.version>
<cas.version>3.6.4</cas.version>
<cas.version>3.8.2</cas.version>
<checkstyle.version>8.27</checkstyle.version>
<git-commit-id-plugin.version>4.0.0</git-commit-id-plugin.version>
<jacoco-maven-plugin.version>0.8.10</jacoco-maven-plugin.version>
Expand Down Expand Up @@ -40,9 +40,9 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<project.testresult.directory>${project.build.directory}/test-results</project.testresult.directory>
<properties-maven-plugin.version>1.0.0</properties-maven-plugin.version>
<quarkus-plugin.version>3.6.4</quarkus-plugin.version>
<quarkus-plugin.version>3.8.1</quarkus-plugin.version>
<quarkus.logManager>org.jboss.logmanager.LogManager</quarkus.logManager>
<quarkus.platform.version>3.6.4</quarkus.platform.version>
<quarkus.platform.version>3.8.2</quarkus.platform.version>
<sonar-maven-plugin.version>3.7.0.1746</sonar-maven-plugin.version>
</properties>
<dependencyManagement>
Expand All @@ -59,6 +59,7 @@
<dependencies>



<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
Expand All @@ -68,7 +69,6 @@
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-awt</artifactId>
<version>3.6.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.camel.quarkus/camel-quarkus-pdf -->
<!--<dependency>
Expand All @@ -81,12 +81,8 @@
<dependency>
<groupId>io.quarkiverse.minio</groupId>
<artifactId>quarkus-minio</artifactId>
<version>3.3.1</version>
<version>3.7.1</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-undertow</artifactId>
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
Expand Down Expand Up @@ -231,6 +227,8 @@
<artifactId>quarkus-jdbc-sqlite</artifactId>
<version>3.0.7</version>
</dependency>
<!-- https://mvnrepository.com/artifact/jakarta.servlet/jakarta.servlet-api -->

<!--<dependency>
<groupId>org.jasig.cas.client</groupId>
<artifactId>cas-client-core</artifactId>
Expand Down Expand Up @@ -300,35 +298,6 @@
</includeOnlyProperties>
</configuration>
</plugin>
<!-- <plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco-maven-plugin.version}</version>
<executions>
<execution>
<id>instrument-ut</id>
<goals>
<goal>instrument</goal>
</goals>
</execution>
<execution>
<id>restore-ut</id>
<goals>
<goal>restore-instrumented-classes</goal>
</goals>
</execution>
<execution>
<id>report-ut</id>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${jacoco.utReportFile}</dataFile>
<outputDirectory>${jacoco.utReportFolder}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>-->
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
Expand Down Expand Up @@ -520,6 +489,15 @@
</dependency>
</dependencies>
</profile>
<profile>
<id>shib</id>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-undertow</artifactId>
</dependency>
</dependencies>
</profile>
<profile>
<id>prod</id>
<build>
Expand Down Expand Up @@ -620,7 +598,7 @@
</dependencies>
<build>
<plugins>
<plugin>
<!-- <plugin>
<groupId>org.cyclonedx</groupId>
<artifactId>cyclonedx-maven-plugin</artifactId>
<configuration>
Expand All @@ -647,7 +625,7 @@
</goals>
</execution>
</executions>
</plugin>
</plugin>-->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<executions>
Expand Down
1 change: 0 additions & 1 deletion src/main/docker/Dockerfile.native
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ RUN chown 1001 /work \
&& chmod "g+rwX" /work \
&& chown 1001:root /work
COPY --chown=1001:root target/*-runner /work/application
# COPY --chown=1001:root ./src/main/resources/db/migration/ /work/migration
EXPOSE 8080
USER 1001

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
* A Answer2HybridGradedComment.
*/
@Entity
@Table(name = "answer_2_hybrid_graded_comment")
@Table(name = "answer_2_hybrid_graded_comment",
uniqueConstraints = {@UniqueConstraint(columnNames = {"student_response_id", "hybridcomments_id"})}
)
@Cacheable
@RegisterForReflection
public class Answer2HybridGradedComment extends PanacheEntityBase implements Serializable {
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/fr/istic/domain/StudentResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
* A StudentResponse.
*/
@Entity
@Table(name = "student_response")
@Table(name = "student_response",
uniqueConstraints = {@UniqueConstraint(columnNames = {"question_id", "sheet_id"})}
)
@Cacheable
@RegisterForReflection
public class StudentResponse extends PanacheEntityBase implements Serializable {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/fr/istic/web/rest/ShibAuth.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import fr.istic.service.UserService;
import io.quarkus.security.runtime.QuarkusSecurityIdentity;

import org.eclipse.microprofile.config.inject.ConfigProperties;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -18,7 +17,8 @@
import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.Response;
import java.net.URI;

import io.quarkus.arc.profile.IfBuildProfile;
@IfBuildProfile("shib")
@Path("/api/shib")
@RequestScoped
public class ShibAuth {
Expand Down
30 changes: 30 additions & 0 deletions src/main/resources/META-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,34 @@
<url-pattern>/h2-console/*</url-pattern>
</servlet-mapping>-->

<mime-mapping>
<extension>html</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
<mime-mapping>
<extension>txt</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
<mime-mapping>
<extension>jpg</extension>
<mime-type>image/jpeg</mime-type>
</mime-mapping>
<mime-mapping>
<extension>png</extension>
<mime-type>image/png</mime-type>
</mime-mapping>
<mime-mapping>
<extension>js</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
<mime-mapping>
<extension>mjs</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
<mime-mapping>
<extension>css</extension>
<mime-type>text/css</mime-type>
</mime-mapping>


</web-app>
6 changes: 3 additions & 3 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ application.name=correctExam
configcas.server_cas = https://sso-cas6-test.univ-rennes1.fr
configcas.domain_service = https://correctexam-test.univ-rennes.fr
#configcas.domain_service = https://127.0.0.1:443

quarkus.liquibase.migrate-at-start=false

%alone.quarkus.liquibase.migrate-at-start=true
%alone.quarkus.hibernate-orm.second-level-caching-enabled=false
# %alone.quarkus.hibernate-orm.sql-load-script=db/migration/V1__Initial_version.sql
%alone.correctexam.uses3=true
%alone.correctexam.shib.redirect.address = https://correctexam-test.univ-rennes.fr?shib=true
%alone.jhipster.mail.base-url=http://127.0.0.1:8080
Expand Down Expand Up @@ -160,11 +160,11 @@ quarkus.http.auth.permission.public.paths=/api/authenticate,/api/register,/api/a
quarkus.http.auth.permission.public.policy=permit

quarkus.http.auth.policy.admin-role.roles-allowed=ROLE_ADMIN
quarkus.http.auth.permission.admin.paths=/api/users,/management/**
quarkus.http.auth.permission.admin.paths=/api/users,/management/*
quarkus.http.auth.permission.admin.policy=admin-role

quarkus.http.auth.policy.user-role.roles-allowed=ROLE_USER
quarkus.http.auth.permission.user.paths=/api/**
quarkus.http.auth.permission.user.paths=/api/*
quarkus.http.auth.permission.user.policy=user-role

quarkus.smallrye-openapi.path=/v3/api-docs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
<column name="exam_id" type="bigint">
<constraints nullable="true" />
</column>

<column name="frozen" type="boolean">
<constraints nullable="true" />
</column>
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here -->
</createTable>
</changeSet>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
<!--
Added the constraints for entity Answer2HybridGradedComment.
-->
<changeSet author="Olivier Barais" id="20240310165535-1">
<addUniqueConstraint catalogName="gradeScopeIstic" tableName="answer_2_hybrid_graded_comment" columnNames="student_response_id, hybridcomments_id" constraintName="UniqueHybridcommentsIdAndStudentResponseId" schemaName="public" validate="true"/>
</changeSet>
<changeSet author="Olivier Barais" id="20240310165535-2">
<addUniqueConstraint catalogName="gradeScopeIstic" tableName="student_response" columnNames="question_id, sheet_id" constraintName="UniqueSRquestionIdAndSheetId" schemaName="public" validate="true"/>
</changeSet>

<!-- alter table student_response add column lastmodified datetime(6);
alter table student_response add column correctedby_id bigint;
alter table student_response add constraint FKinrpshecm7c6aiqo6000ju87c foreign key (correctedby_id) references jhi_user (id);
-->

<changeSet id="20240310165535-3" author="Olivier Barais">

<addColumn tableName="student_response">
<column name="lastmodified" type="timestamp">
<constraints nullable="true" />
</column>
</addColumn>


<addColumn tableName="student_response">
<column name="correctedby_id" type="bigint">
<constraints nullable="true" />
</column>
</addColumn>

<addForeignKeyConstraint baseColumnNames="correctedby_id" baseTableName="student_response" constraintName="fk_studentresponse_user_id" referencedColumnNames="id" referencedTableName="jhi_user"/>

</changeSet>
<!--
alter table question add column randomhorizontalcorrection bit default 0;
-->
<changeSet id="20240310165535-4" author="Olivier Barais">
<addColumn tableName="question">
<column name="randomhorizontalcorrection" type="boolean" defaultValueBoolean="false">
<constraints nullable="true" />
</column>
</addColumn>

</changeSet>

</databaseChangeLog>
2 changes: 2 additions & 0 deletions src/main/resources/config/liquibase/master.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
<include file="config/liquibase/changelog/20231127165535_update_entity_FinalResult.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20231207074904_added_entity_constraints_HybridGradedComment.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20231207074905_added_entity_constraints_Answer2HybridGradedComment.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20240310074905_added_upgrade41.4.xml" relativeToChangelogFile="false"/>


<!-- jhipster-needle-liquibase-add-constraints-changelog - JHipster will add liquibase constraints changelogs here -->
<!-- jhipster-needle-liquibase-add-incremental-changelog - JHipster will add incremental liquibase changelogs here -->
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/config/liquibase/mastertest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<include file="config/liquibase/changelog/20231127165535_update_entity_FinalResult.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20231207074851_added_entity_constraints_Student.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20231207074905_added_entity_constraints_Answer2HybridGradedComment.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20240310074905_added_upgrade41.4.xml" relativeToChangelogFile="false"/>

<!-- jhipster-needle-liquibase-add-constraints-changelog - JHipster will add liquibase constraints changelogs here -->
<!-- jhipster-needle-liquibase-add-incremental-changelog - JHipster will add incremental liquibase changelogs here -->
Expand Down
10 changes: 10 additions & 0 deletions src/main/resources/reflection-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,15 @@
"allPublicMethods" : true,
"allDeclaredFields" : true,
"allPublicFields" : true
},
{
"name" : "liquibase.command.core.StartH2CommandStep",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true,
"allDeclaredFields" : true,
"allPublicFields" : true
}

]

0 comments on commit cbc4282

Please sign in to comment.