Skip to content

Commit

Permalink
Merge pull request #137 from MTES-MCT/events-fix
Browse files Browse the repository at this point in the history
fix(events): add completeForStats and fixes
  • Loading branch information
lwih authored Apr 29, 2024
2 parents 546bfdc + 2b3b45e commit 9b56cf8
Show file tree
Hide file tree
Showing 44 changed files with 1,008 additions and 879 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,47 @@
package fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.action

import fr.gouv.dgampa.rapportnav.config.MandatoryForStats
import fr.gouv.dgampa.rapportnav.domain.utils.EntityCompletenessValidator
import fr.gouv.dgampa.rapportnav.infrastructure.bff.model.action.NavActionAntiPollution
import java.time.ZonedDateTime
import java.util.*

class ActionAntiPollutionEntity(
@MandatoryForStats
val id: UUID,

@MandatoryForStats
val missionId: Int,

var isCompleteForStats: Boolean? = null,

@MandatoryForStats
val startDateTimeUtc: ZonedDateTime,

@MandatoryForStats
val endDateTimeUtc: ZonedDateTime,

val observations: String? = null,
) {

constructor(
id: UUID,
missionId: Int,
startDateTimeUtc: ZonedDateTime,
endDateTimeUtc: ZonedDateTime,
observations: String?
) : this(
id = id,
missionId = missionId,
isCompleteForStats = null,
startDateTimeUtc = startDateTimeUtc,
endDateTimeUtc = endDateTimeUtc,
observations = observations
) {
// completeness for stats being computed at class instantiation in constructor
this.isCompleteForStats = EntityCompletenessValidator.isCompleteForStats(this)
}

fun toNavActionAntiPollution(): NavActionAntiPollution {
return NavActionAntiPollution(
id = id,
Expand All @@ -21,10 +52,11 @@ class ActionAntiPollutionEntity(
)
}

fun toNavAction(): NavActionEntity {
fun toNavActionEntity(): NavActionEntity {
return NavActionEntity(
id = id,
missionId = missionId,
isCompleteForStats = isCompleteForStats,
startDateTimeUtc = startDateTimeUtc,
endDateTimeUtc = endDateTimeUtc,
actionType = ActionType.ANTI_POLLUTION,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,47 @@
package fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.action

import fr.gouv.dgampa.rapportnav.config.MandatoryForStats
import fr.gouv.dgampa.rapportnav.domain.utils.EntityCompletenessValidator
import fr.gouv.dgampa.rapportnav.infrastructure.bff.model.action.NavActionBAAEMPermanence
import java.time.ZonedDateTime
import java.util.*

class ActionBAAEMPermanenceEntity(
@MandatoryForStats
val id: UUID,

@MandatoryForStats
val missionId: Int,

var isCompleteForStats: Boolean? = null,

@MandatoryForStats
val startDateTimeUtc: ZonedDateTime,

@MandatoryForStats
val endDateTimeUtc: ZonedDateTime,

val observations: String? = null,
) {

constructor(
id: UUID,
missionId: Int,
startDateTimeUtc: ZonedDateTime,
endDateTimeUtc: ZonedDateTime,
observations: String?
) : this(
id = id,
missionId = missionId,
isCompleteForStats = null,
startDateTimeUtc = startDateTimeUtc,
endDateTimeUtc = endDateTimeUtc,
observations = observations
) {
// completeness for stats being computed at class instantiation in constructor
this.isCompleteForStats = EntityCompletenessValidator.isCompleteForStats(this)
}

fun toNavActionBAAEMPermanence(): NavActionBAAEMPermanence {
return NavActionBAAEMPermanence(
id = id,
Expand All @@ -21,10 +52,11 @@ class ActionBAAEMPermanenceEntity(
)
}

fun toNavAction(): NavActionEntity {
fun toNavActionEntity(): NavActionEntity {
return NavActionEntity(
id = id,
missionId = missionId,
isCompleteForStats = isCompleteForStats,
startDateTimeUtc = startDateTimeUtc,
endDateTimeUtc = endDateTimeUtc,
actionType = ActionType.BAAEM_PERMANENCE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ data class ActionFreeNoteEntity(
this.isCompleteForStats = EntityCompletenessValidator.isCompleteForStats(this)
}

fun toNavAction(): NavActionEntity {
fun toNavActionEntity(): NavActionEntity {
return NavActionEntity(
id = id,
missionId = missionId,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,68 @@
package fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.action

import fr.gouv.dgampa.rapportnav.config.MandatoryForStats
import fr.gouv.dgampa.rapportnav.domain.utils.EntityCompletenessValidator
import fr.gouv.dgampa.rapportnav.infrastructure.bff.model.action.NavActionIllegalImmigration
import java.time.ZonedDateTime
import java.util.*

class ActionIllegalImmigrationEntity(
@MandatoryForStats
val id: UUID,

@MandatoryForStats
val missionId: Int,

var isCompleteForStats: Boolean? = null,

@MandatoryForStats
val startDateTimeUtc: ZonedDateTime,

@MandatoryForStats
val endDateTimeUtc: ZonedDateTime,

val observations: String? = null,
val latitude: Float? = null,
val longitude: Float? = null,

@MandatoryForStats
val nbOfInterceptedVessels: Int? = null,

@MandatoryForStats
val nbOfInterceptedMigrants: Int? = null,

@MandatoryForStats
val nbOfSuspectedSmugglers: Int? = null,
) {

constructor(
id: UUID,
missionId: Int,
startDateTimeUtc: ZonedDateTime,
endDateTimeUtc: ZonedDateTime,
observations: String? = null,
latitude: Float? = null,
longitude: Float? = null,
nbOfInterceptedVessels: Int? = null,
nbOfInterceptedMigrants: Int? = null,
nbOfSuspectedSmugglers: Int? = null,
) : this(
id = id,
missionId = missionId,
isCompleteForStats = null,
startDateTimeUtc = startDateTimeUtc,
endDateTimeUtc = endDateTimeUtc,
observations = observations,
latitude = latitude,
longitude = longitude,
nbOfInterceptedVessels = nbOfInterceptedVessels,
nbOfInterceptedMigrants = nbOfInterceptedMigrants,
nbOfSuspectedSmugglers = nbOfSuspectedSmugglers,
) {
// completeness for stats being computed at class instantiation in constructor
this.isCompleteForStats = EntityCompletenessValidator.isCompleteForStats(this)
}

fun toNavActionIllegalImmigration(): NavActionIllegalImmigration {
return NavActionIllegalImmigration(
id = id,
Expand All @@ -31,14 +78,15 @@ class ActionIllegalImmigrationEntity(
)
}

fun toNavAction(): NavActionEntity {
fun toNavActionEntity(): NavActionEntity {
return NavActionEntity(
id = id,
missionId = missionId,
isCompleteForStats = isCompleteForStats,
startDateTimeUtc = startDateTimeUtc,
endDateTimeUtc = endDateTimeUtc,
actionType = ActionType.ILLEGAL_IMMIGRATION,
illegalImmigrationAction = this
illegalImmigrationAction = this,
)
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,47 @@
package fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.action

import fr.gouv.dgampa.rapportnav.config.MandatoryForStats
import fr.gouv.dgampa.rapportnav.domain.utils.EntityCompletenessValidator
import fr.gouv.dgampa.rapportnav.infrastructure.bff.model.action.NavActionNauticalEvent
import java.time.ZonedDateTime
import java.util.*

class ActionNauticalEventEntity(
@MandatoryForStats
val id: UUID,

@MandatoryForStats
val missionId: Int,

var isCompleteForStats: Boolean? = null,

@MandatoryForStats
val startDateTimeUtc: ZonedDateTime,

@MandatoryForStats
val endDateTimeUtc: ZonedDateTime,

val observations: String? = null,
) {

constructor(
id: UUID,
missionId: Int,
startDateTimeUtc: ZonedDateTime,
endDateTimeUtc: ZonedDateTime,
observations: String?
) : this(
id = id,
missionId = missionId,
isCompleteForStats = null,
startDateTimeUtc = startDateTimeUtc,
endDateTimeUtc = endDateTimeUtc,
observations = observations
) {
// completeness for stats being computed at class instantiation in constructor
this.isCompleteForStats = EntityCompletenessValidator.isCompleteForStats(this)
}

fun toNavActionNauticalEvent(): NavActionNauticalEvent {
return NavActionNauticalEvent(
id = id,
Expand All @@ -21,10 +52,11 @@ class ActionNauticalEventEntity(
)
}

fun toNavAction(): NavActionEntity {
fun toNavActionEntity(): NavActionEntity {
return NavActionEntity(
id = id,
missionId = missionId,
isCompleteForStats = isCompleteForStats,
startDateTimeUtc = startDateTimeUtc,
endDateTimeUtc = endDateTimeUtc,
actionType = ActionType.NAUTICAL_EVENT,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,47 @@
package fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.action

import fr.gouv.dgampa.rapportnav.config.MandatoryForStats
import fr.gouv.dgampa.rapportnav.domain.utils.EntityCompletenessValidator
import fr.gouv.dgampa.rapportnav.infrastructure.bff.model.action.NavActionPublicOrder
import java.time.ZonedDateTime
import java.util.*

class ActionPublicOrderEntity(
@MandatoryForStats
val id: UUID,

@MandatoryForStats
val missionId: Int,

var isCompleteForStats: Boolean? = null,

@MandatoryForStats
val startDateTimeUtc: ZonedDateTime,

@MandatoryForStats
val endDateTimeUtc: ZonedDateTime,

val observations: String? = null,
) {

constructor(
id: UUID,
missionId: Int,
startDateTimeUtc: ZonedDateTime,
endDateTimeUtc: ZonedDateTime,
observations: String?
) : this(
id = id,
missionId = missionId,
isCompleteForStats = null,
startDateTimeUtc = startDateTimeUtc,
endDateTimeUtc = endDateTimeUtc,
observations = observations
) {
// completeness for stats being computed at class instantiation in constructor
this.isCompleteForStats = EntityCompletenessValidator.isCompleteForStats(this)
}

fun toNavActionPublicOrder(): NavActionPublicOrder {
return NavActionPublicOrder(
id = id,
Expand All @@ -21,10 +52,11 @@ class ActionPublicOrderEntity(
)
}

fun toNavAction(): NavActionEntity {
fun toNavActionEntity(): NavActionEntity {
return NavActionEntity(
id = id,
missionId = missionId,
isCompleteForStats = isCompleteForStats,
startDateTimeUtc = startDateTimeUtc,
endDateTimeUtc = endDateTimeUtc,
actionType = ActionType.PUBLIC_ORDER,
Expand Down
Loading

0 comments on commit 9b56cf8

Please sign in to comment.