-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMissionFishActionOutput.kt
106 lines (103 loc) · 6.08 KB
/
MissionFishActionOutput.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package fr.gouv.dgampa.rapportnav.infrastructure.api.bff.model.v2
import fr.gouv.dgampa.rapportnav.domain.entities.mission.CompletenessForStatsEntity
import fr.gouv.dgampa.rapportnav.domain.entities.mission.env.MissionSourceEnum
import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.action.ActionType
import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.control.ControlType
import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.status.ActionStatusType
import fr.gouv.dgampa.rapportnav.domain.entities.mission.v2.MissionActionEntity
import fr.gouv.dgampa.rapportnav.domain.entities.mission.v2.MissionFishActionEntity
class MissionFishActionOutput(
override val id: String,
override val missionId: Int,
override val actionType: ActionType,
override val source: MissionSourceEnum,
override val isCompleteForStats: Boolean?,
override val status: ActionStatusType? = null,
override val summaryTags: List<String>? = null,
override val controlsToComplete: List<ControlType>? = null,
override val completenessForStats: CompletenessForStatsEntity? = null,
override val sourcesOfMissingDataForStats: List<MissionSourceEnum>? = null,
override val data: MissionFishActionDataOutput
) : MissionActionOutput(
id = id,
missionId = missionId,
status = status,
actionType = actionType,
summaryTags = summaryTags,
source = source,
controlsToComplete = controlsToComplete,
data = data
) {
companion object {
fun fromMissionActionEntity(action: MissionActionEntity): MissionFishActionOutput {
val fishAction = action as MissionFishActionEntity
return MissionFishActionOutput(
id = fishAction.id.toString(),
source = fishAction.source,
missionId = fishAction.missionId,
actionType = fishAction.actionType,
summaryTags = fishAction.summaryTags,
isCompleteForStats = fishAction.isCompleteForStats,
controlsToComplete = fishAction.controlsToComplete,
sourcesOfMissingDataForStats = fishAction.sourcesOfMissingDataForStats,
data = MissionFishActionDataOutput(
fishActionType = fishAction.fishActionType,
startDateTimeUtc = fishAction.actionDatetimeUtc,
endDateTimeUtc = fishAction.actionEndDatetimeUtc,
vesselId = fishAction.vesselId,
vesselName = fishAction.vesselName,
internalReferenceNumber = fishAction.internalReferenceNumber,
externalReferenceNumber = fishAction.externalReferenceNumber,
districtCode = fishAction.districtCode,
faoAreas = fishAction.faoAreas?: listOf(),
emitsVms = fishAction.emitsVms,
emitsAis = fishAction.emitsAis,
logbookMatchesActivity = fishAction.logbookMatchesActivity,
licencesMatchActivity = fishAction.licencesMatchActivity,
speciesWeightControlled = fishAction.speciesWeightControlled,
speciesSizeControlled = fishAction.speciesSizeControlled,
separateStowageOfPreservedSpecies = fishAction.separateStowageOfPreservedSpecies,
logbookInfractions = fishAction.logbookInfractions?: listOf(),
licencesAndLogbookObservations = fishAction.licencesAndLogbookObservations,
gearInfractions = fishAction.gearInfractions?: listOf(),
speciesInfractions = fishAction.speciesInfractions?: listOf(),
speciesObservations = fishAction.speciesObservations,
seizureAndDiversion = fishAction.seizureAndDiversion,
otherInfractions = fishAction.otherInfractions?: listOf(),
numberOfVesselsFlownOver = fishAction.numberOfVesselsFlownOver,
unitWithoutOmegaGauge = fishAction.unitWithoutOmegaGauge,
controlQualityComments = fishAction.controlQualityComments,
feedbackSheetRequired = fishAction.feedbackSheetRequired,
userTrigram = fishAction.userTrigram,
segments = fishAction.segments?: listOf(),
facade = fishAction.facade,
longitude = fishAction.longitude,
latitude = fishAction.latitude,
portLocode = fishAction.portLocode,
portName = fishAction.portName,
vesselTargeted = fishAction.vesselTargeted,
seizureAndDiversionComments = fishAction.seizureAndDiversionComments,
otherComments = fishAction.otherComments,
gearOnboard = fishAction.gearOnboard?: listOf(),
speciesOnboard = fishAction.speciesOnboard?: listOf(),
isFromPoseidon = fishAction.isFromPoseidon,
isDeleted = fishAction.isDeleted,
hasSomeGearsSeized = fishAction.hasSomeGearsSeized,
hasSomeSpeciesSeized = fishAction.hasSomeSpeciesSeized,
completedBy = fishAction.completedBy,
completion = fishAction.completion,
isAdministrativeControl = fishAction.isAdministrativeControl,
isComplianceWithWaterRegulationsControl = fishAction.isComplianceWithWaterRegulationsControl,
isSafetyEquipmentAndStandardsComplianceControl = fishAction.isSafetyEquipmentAndStandardsComplianceControl,
isSeafarersControl = fishAction.isSeafarersControl,
observationsByUnit = fishAction.observationsByUnit,
speciesQuantitySeized = fishAction.speciesQuantitySeized,
controlSecurity = fishAction.controlSecurity,
controlGensDeMer = fishAction.controlGensDeMer,
controlNavigation = fishAction.controlNavigation,
controlAdministrative = fishAction.controlAdministrative
)
)
}
}
}