Skip to content

Commit

Permalink
Merge pull request #452 from MTES-MCT/feature/446-hasbeendone-mission…
Browse files Browse the repository at this point in the history
…-action-tag

feat(action): update mission action
  • Loading branch information
xtiannyeto authored Dec 25, 2024
2 parents 1ad568a + 7855cff commit 5abba35
Show file tree
Hide file tree
Showing 70 changed files with 2,753 additions and 166 deletions.
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
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 5abba35

Please sign in to comment.