Skip to content

Commit

Permalink
Merge branch 'main' into java-21
Browse files Browse the repository at this point in the history
  • Loading branch information
lwih authored Jan 6, 2025
2 parents 02746c2 + 8a7451a commit bf3f5f6
Show file tree
Hide file tree
Showing 316 changed files with 9,224 additions and 3,311 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ variables:
value: "postgres:15.10-alpine"
description: "Image de la base de données"
PROJECT_VERSION:
value: "2.3.5"
value: "2.4.0-rc7"
description: "Version du projet à déployer"
SERVER_ENV_INT:
value: "int-rapportnav-appli01"
Expand Down
4 changes: 2 additions & 2 deletions backend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.lang.System.getenv

group = "fr.gouv.dgampa"
version = "2.3.5"
version = "2.4.0-rc7"
description = "RapportNav"

val kotlinVersion by extra("2.1.0")
Expand Down Expand Up @@ -89,7 +89,7 @@ dependencies {
implementation("org.jodconverter:jodconverter-local-lo:4.4.7")
implementation("com.neovisionaries:nv-i18n:1.29")
testImplementation("org.springframework.boot:spring-boot-starter-test:$springVersion")
testImplementation("org.springframework:spring-webflux:6.1.13")
testImplementation("org.springframework:spring-webflux:6.1.14")
testImplementation("org.springframework.graphql:spring-graphql-test:1.2.4")
testImplementation("org.testcontainers:testcontainers")
testImplementation("org.testcontainers:junit-jupiter")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,9 @@ data class MissionEntity(
}

companion object {
private fun sortActions(
envActions: List<MissionActionEntity.EnvAction>,
fishActions: List<MissionActionEntity.FishAction>,
navActions: List<MissionActionEntity.NavAction>
): List<MissionActionEntity> {
return (envActions + fishActions + navActions).sortedByDescending { action ->

fun sortActionsAsc(actions: List<MissionActionEntity>): List<MissionActionEntity> {
return (actions).sortedByDescending { action ->
when (action) {
is MissionActionEntity.EnvAction -> {
if (action.envAction?.controlAction !== null) {
Expand All @@ -100,8 +97,23 @@ data class MissionEntity(
}
}
}

fun sortActions(
envActions: List<MissionActionEntity.EnvAction>,
fishActions: List<MissionActionEntity.FishAction>,
navActions: List<MissionActionEntity.NavAction>
): List<MissionActionEntity> {
return sortActionsAsc((envActions + fishActions + navActions))
}

fun sortActions(
actions: List<MissionActionEntity>,
): List<MissionActionEntity> {
return sortActionsAsc(actions)
}
}


private fun calculateMissionStatus(
startDateTimeUtc: Instant,
endDateTimeUtc: Instant? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,23 @@ abstract class BaseControlEntity {
open val observations: String? = null
open val hasBeenDone: Boolean? = null
abstract fun shouldToggleOnUnitHasConfirmed(): Boolean


override fun hashCode(): Int {
var result = id.hashCode()
result = 31 * result + actionControlId.hashCode()
result = 31 * result + (observations?.hashCode() ?: 0)
result = 31 * result + (hasBeenDone?.hashCode() ?: 0)
return result
}

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as BaseControlEntity
return (id == other.id
&& hasBeenDone == other.hasBeenDone
&& observations == other.observations
&& actionControlId == other.actionControlId)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ data class ControlAdministrativeEntity(
val compliantSecurityDocuments: ControlResult? = null,
override val observations: String? = null,
override val hasBeenDone: Boolean? = null,
override val infractions: List<InfractionEntity>? = null
override var infractions: List<InfractionEntity>? = null
) : BaseControlEntity() {
override fun shouldToggleOnUnitHasConfirmed(): Boolean =
unitShouldConfirm == true &&
Expand All @@ -26,4 +26,23 @@ data class ControlAdministrativeEntity(
infractions?.isNotEmpty() == true ||
observations != null
)

override fun hashCode(): Int {
var result = missionId.hashCode()
result = 31 * result + amountOfControls
result = 31 * result + (compliantOperatingPermit?.hashCode() ?: 0)
result = 31 * result + (upToDateNavigationPermit?.hashCode() ?: 0)
result = 31 * result + (compliantSecurityDocuments?.hashCode() ?: 0)
return super.hashCode() + result
}

override fun equals(other: Any?): Boolean {
if (!super.equals(other)) return false
other as ControlAdministrativeEntity
return (missionId == other.missionId
&& amountOfControls == other.amountOfControls
&& compliantOperatingPermit == other.compliantOperatingPermit
&& upToDateNavigationPermit == other.upToDateNavigationPermit
&& compliantSecurityDocuments == other.compliantSecurityDocuments)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ data class ControlGensDeMerEntity(
val knowledgeOfFrenchLawAndLanguage: ControlResult? = null,
override val observations: String? = null,
override val hasBeenDone: Boolean? = null,
override val infractions: List<InfractionEntity>? = null
override var infractions: List<InfractionEntity>? = null
) : BaseControlEntity() {
override fun shouldToggleOnUnitHasConfirmed(): Boolean =
unitShouldConfirm == true &&
Expand All @@ -26,4 +26,23 @@ data class ControlGensDeMerEntity(
infractions?.isNotEmpty() == true ||
observations != null
)

override fun hashCode(): Int {
var result = missionId.hashCode()
result = 31 * result + amountOfControls
result = 31 * result + (staffOutnumbered?.hashCode() ?: 0)
result = 31 * result + (upToDateMedicalCheck?.hashCode() ?: 0)
result = 31 * result + (knowledgeOfFrenchLawAndLanguage?.hashCode() ?: 0)
return super.hashCode() + result
}

override fun equals(other: Any?): Boolean {
if (!super.equals(other)) return false
other as ControlGensDeMerEntity
return (missionId == other.missionId
&& amountOfControls == other.amountOfControls
&& staffOutnumbered == other.staffOutnumbered
&& upToDateMedicalCheck == other.upToDateMedicalCheck
&& knowledgeOfFrenchLawAndLanguage == other.knowledgeOfFrenchLawAndLanguage)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ data class ControlNavigationEntity(
override var unitHasConfirmed: Boolean? = null,
override val observations: String? = null,
override val hasBeenDone: Boolean? = null,
override val infractions: List<InfractionEntity>? = null
override var infractions: List<InfractionEntity>? = null
) : BaseControlEntity() {
override fun shouldToggleOnUnitHasConfirmed(): Boolean =
unitShouldConfirm == true &&
Expand All @@ -21,4 +21,17 @@ data class ControlNavigationEntity(
infractions?.isNotEmpty() == true ||
observations != null
)

override fun hashCode(): Int {
var result = missionId.hashCode()
result = 31 * result + amountOfControls
return super.hashCode() + result
}

override fun equals(other: Any?): Boolean {
if (!super.equals(other)) return false
other as ControlNavigationEntity
return (missionId == other.missionId
&& amountOfControls == other.amountOfControls)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ data class ControlSecurityEntity(
override var unitHasConfirmed: Boolean? = null,
override val observations: String? = null,
override val hasBeenDone: Boolean? = null,
override val infractions: List<InfractionEntity>? = null
override var infractions: List<InfractionEntity>? = null
) : BaseControlEntity() {
override fun shouldToggleOnUnitHasConfirmed(): Boolean =
unitShouldConfirm == true &&
Expand All @@ -21,4 +21,17 @@ data class ControlSecurityEntity(
infractions?.isNotEmpty() == true ||
observations != null
)

override fun hashCode(): Int {
var result = missionId.hashCode()
result = 31 * result + amountOfControls
return super.hashCode() + result
}

override fun equals(other: Any?): Boolean {
if (!super.equals(other)) return false
other as ControlSecurityEntity
return (missionId == other.missionId
&& amountOfControls == other.amountOfControls)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@ import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.control.ControlAdmi
import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.control.ControlGensDeMerEntity
import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.control.ControlNavigationEntity
import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.control.ControlSecurityEntity
import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.infraction.InfractionEntity

data class ActionControlEntity(
var controlAdministrative: ControlAdministrativeEntity? = null,
var controlGensDeMer: ControlGensDeMerEntity? = null,
var controlSecurity: ControlSecurityEntity? = null,
var controlNavigation: ControlNavigationEntity? = null
) {

fun seInfractions(infractions: List<InfractionEntity>?) {
controlSecurity?.infractions = infractions?.filter { it.controlId == controlSecurity?.id }
controlGensDeMer?.infractions = infractions?.filter { it.controlId == controlGensDeMer?.id }
controlNavigation?.infractions = infractions?.filter { it.controlId == controlNavigation?.id }
controlAdministrative?.infractions = infractions?.filter { it.controlId == controlAdministrative?.id }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.export

// if you update this enum, update it too in the API and frontend
enum class ExportModeEnum {
INDIVIDUAL_MISSION, // Export one single mission into one document
COMBINED_MISSIONS_IN_ONE, // Export several missions combined into one mission into one document
MULTIPLE_MISSIONS_ZIPPED // Export several missions into several documents into a zip
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.export

// if you update this enum, update it too in the API and frontend
enum class ExportReportTypeEnum {
ALL, // all at once
AEM, // aka tableaux AEM
PATROL // aka rapport de patrouille
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,32 @@ data class InfractionEntity(
var observations: String? = null,
var natinfs: List<String>? = null,
var target: InfractionEnvTargetEntity? = null
)
) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false

other as InfractionEntity
return id == other.id
&& missionId == other.missionId
&& actionId == other.actionId
&& controlId == other.controlId
&& controlType == other.controlType
&& observations == other.observations
&& Objects.equals(target, other.target)
&& Objects.equals(natinfs, other.natinfs)
}

override fun hashCode(): Int {
var result = id.hashCode()
result = 31 * result + missionId
result = 31 * result + actionId.hashCode()
result = 31 * result + (controlId?.hashCode() ?: 0)
result = 31 * result + (controlType?.hashCode() ?: 0)
result = 31 * result + (infractionType?.hashCode() ?: 0)
result = 31 * result + (observations?.hashCode() ?: 0)
result = 31 * result + (natinfs?.hashCode() ?: 0)
result = 31 * result + (target?.hashCode() ?: 0)
return result
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,31 @@ data class InfractionEnvTargetEntity(
var vesselType: VesselTypeEnum? = null,
var vesselSize: VesselSizeEnum? = null,
val vesselIdentifier: String? = null,
) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false

)
other as InfractionEnvTargetEntity
return id == other.id
&& missionId == other.missionId
&& actionId == other.actionId
&& infractionId == other.infractionId
&& identityControlledPerson == other.identityControlledPerson
&& vesselType == other.vesselType
&& vesselSize == other.vesselSize
&& vesselIdentifier == other.vesselIdentifier
}

override fun hashCode(): Int {
var result = id.hashCode()
result = 31 * result + missionId
result = 31 * result + actionId.hashCode()
result = 31 * result + infractionId.hashCode()
result = 31 * result + identityControlledPerson.hashCode()
result = 31 * result + (vesselType?.hashCode() ?: 0)
result = 31 * result + (vesselSize?.hashCode() ?: 0)
result = 31 * result + (vesselIdentifier?.hashCode() ?: 0)
return result
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,33 @@ interface BaseMissionFishAction {
val internalReferenceNumber: String?
val externalReferenceNumber: String?
val ircs: String?
val flagState: CountryCode
val flagState: CountryCode?
val districtCode: String?
val faoAreas: List<String>
val faoAreas: List<String>?
val fishActionType: MissionActionType
val actionDatetimeUtc: Instant
val actionDatetimeUtc: Instant?
val actionEndDatetimeUtc: Instant?
val emitsVms: ControlCheck?
val emitsAis: ControlCheck?
val flightGoals: List<FlightGoal>
val flightGoals: List<FlightGoal>?
val logbookMatchesActivity: ControlCheck?
val licencesMatchActivity: ControlCheck?
val speciesWeightControlled: Boolean?
val speciesSizeControlled: Boolean?
val separateStowageOfPreservedSpecies: ControlCheck?
val logbookInfractions: List<LogbookInfraction>
val logbookInfractions: List<LogbookInfraction>?
val licencesAndLogbookObservations: String?
val gearInfractions: List<GearInfraction>
val speciesInfractions: List<SpeciesInfraction>
val gearInfractions: List<GearInfraction>?
val speciesInfractions: List<SpeciesInfraction>?
val speciesObservations: String?
val seizureAndDiversion: Boolean?
val otherInfractions: List<OtherInfraction>
val otherInfractions: List<OtherInfraction>?
val numberOfVesselsFlownOver: Int?
val unitWithoutOmegaGauge: Boolean?
val controlQualityComments: String?
val feedbackSheetRequired: Boolean?
val userTrigram: String
val segments: List<FleetSegment>
val userTrigram: String?
val segments: List<FleetSegment>?
val facade: String?
val longitude: Double?
val latitude: Double?
Expand All @@ -49,19 +49,19 @@ interface BaseMissionFishAction {
val vesselTargeted: ControlCheck?
val seizureAndDiversionComments: String?
val otherComments: String?
val gearOnboard: List<GearControl>
val speciesOnboard: List<SpeciesControl>
val isFromPoseidon: Boolean
val gearOnboard: List<GearControl>?
val speciesOnboard: List<SpeciesControl>?
val isFromPoseidon: Boolean?
/**
* This field is only used by the `GetVesselControls` use-case.
* /!\ Do not use it to get `controlUnits` as the field will be empty be default.
*/
var controlUnits: List<ControlUnit>
val isDeleted: Boolean
val hasSomeGearsSeized: Boolean
val hasSomeSpeciesSeized: Boolean
var controlUnits: List<ControlUnit>?
val isDeleted: Boolean?
val hasSomeGearsSeized: Boolean?
val hasSomeSpeciesSeized: Boolean?
val completedBy: String?
val completion: Completion
val completion: Completion?
var observationsByUnit: String?
var speciesQuantitySeized: Int ?
}
Loading

0 comments on commit bf3f5f6

Please sign in to comment.