Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import org.apache.poi.xwpf.usermodel.XWPFTableCell
data class EditableBriefRegulatoryAreaEntity(
val id: Int,
val color: String,
val entityName: String,
val facade: String? = null,
override val image: String?,
override val minimap: String?,
val layerName: String,
val polyName: String? = null,
val refReg: String? = null,
val resume: String? = null,
val themes: String? = null,
val type: String? = null,
val url: String? = null,
Expand All @@ -25,7 +26,8 @@ data class EditableBriefRegulatoryAreaEntity(

override fun buildDetailsRows(): List<List<String>> =
listOf(
listOf("Entité", entityName),
listOf("Titre de la zone", polyName ?: ""),
listOf("Résumé", resume ?: ""),
listOf("Ensemble reg", type ?: ""),
listOf("Thématique", themes ?: ""),
listOf("Facade", facade ?: ""),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@ import org.locationtech.jts.geom.MultiPolygon

data class RegulatoryAreaEntity(
val id: Int,
val plan: String? = null,
val date: String? = null,
val dateFin: String? = null,
val dureeValidite: String? = null,
val editeur: String? = null,
val edition: String? = null,
val facade: String? = null,
val geom: MultiPolygon? = null,
val entityName: String? = null,
val url: String? = null,
val layerName: String? = null,
val facade: String? = null,
val polyName: String? = null,
val observation: String? = null,
val refReg: String? = null,
val edition: String? = null,
val editeur: String? = null,
val resume: String? = null,
val source: String? = null,
val observation: String? = null,
val tags: List<TagEntity>,
val themes: List<ThemeEntity>,
val date: String? = null,
val dureeValidite: String? = null,
val dateFin: String? = null,
val temporalite: String? = null,
val themes: List<ThemeEntity>,
val type: String? = null,
val url: String? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import org.locationtech.jts.geom.MultiPolygon

data class RegulatoryAreaWithMetadataDataOutput(
val id: Int,
val entityName: String? = null,
val plan: String? = null,
val facade: String? = null,
val geom: MultiPolygon? = null,
val layerName: String? = null,
val polyName: String? = null,
val refReg: String? = null,
val resume: String? = null,
val tags: List<TagOutput>,
val themes: List<ThemeOutput>,
val type: String? = null,
Expand All @@ -21,11 +23,13 @@ data class RegulatoryAreaWithMetadataDataOutput(
fun fromRegulatoryAreaEntity(regulatoryArea: RegulatoryAreaEntity) =
RegulatoryAreaWithMetadataDataOutput(
id = regulatoryArea.id,
entityName = regulatoryArea.entityName,
plan = regulatoryArea.plan,
facade = regulatoryArea.facade,
geom = regulatoryArea.geom,
layerName = regulatoryArea.layerName,
polyName = regulatoryArea.polyName,
refReg = regulatoryArea.refReg,
resume = regulatoryArea.resume,
tags = regulatoryArea.tags.map { TagOutput.fromTagEntity(it) },
themes = regulatoryArea.themes.map { ThemeOutput.fromThemeEntity(it) },
type = regulatoryArea.type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,20 @@ import org.n52.jackson.datatype.jts.GeometrySerializer
@Table(name = "regulations_cacem")
data class RegulatoryAreaModel(
@Id @Column(name = "id") val id: Int,
@Column(name = "plan") val plan: String?,
@Column(name = "date") val date: String?,
@Column(name = "date_fin") val dateFin: String?,
@Column(name = "duree_validite") val dureeValidite: String?,
@Column(name = "editeur") val editeur: String?,
@Column(name = "edition") val edition: String?,
@Column(name = "entity_name") val entityName: String?,
@Column(name = "facade") val facade: String?,
@JsonSerialize(using = GeometrySerializer::class)
@JsonDeserialize(contentUsing = GeometryDeserializer::class)
@Column(name = "geom")
val geom: MultiPolygon?,
@Column(name = "layer_name") val layerName: String?,
@Column(name = "observation") val observation: String?,
@Column(name = "poly_name") val polyName: String?,
@Column(name = "ref_reg") val refReg: String?,
@Column(name = "source") val source: String?,
@Column(name = "temporalite") val temporalite: String?,
Expand All @@ -45,23 +46,26 @@ data class RegulatoryAreaModel(
fetch = FetchType.LAZY,
)
var themes: List<ThemeRegulatoryAreaModel>,
@Column(name = "resume") val resume: String?,
@Column(name = "type") val type: String?,
@Column(name = "url") val url: String?,
) {
fun toRegulatoryArea() =
RegulatoryAreaEntity(
id = id,
plan = plan,
date = date,
dateFin = dateFin,
dureeValidite = dureeValidite,
editeur = editeur,
edition = edition,
entityName = entityName,
facade = facade,
geom = geom,
layerName = layerName,
polyName = polyName,
observation = observation,
refReg = refReg,
resume = resume,
source = source,
temporalite = temporalite,
tags = toTagEntities(tags),
Expand All @@ -71,5 +75,5 @@ data class RegulatoryAreaModel(
)

override fun toString(): String =
"RegulatoryAreaModel(id=$id, date=$date, dateFin=$dateFin, dureeValidite=$dureeValidite, editeur=$editeur, edition=$edition, entityName=$entityName, facade=$facade, geom=$geom, layerName=$layerName, observation=$observation, refReg=$refReg, source=$source, temporalite=$temporalite, type=$type, url=$url)"
"RegulatoryAreaModel(id=$id, plan=$plan, date=$date, dateFin=$dateFin, dureeValidite=$dureeValidite, editeur=$editeur, edition=$edition, facade=$facade, geom=$geom, layerName=$layerName, observation=$observation, polyName=$polyName, refReg=$refReg, resume=$resume, source=$source, temporalite=$temporalite, type=$type, url=$url)"
}
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class SummaryFile(
styleCell(colorCell, bold = false, fontSize = 8, alignment = ParagraphAlignment.LEFT)

val entityCell = row.getCell(2) ?: row.createCell()
entityCell.text = area.entityName
entityCell.text = area.polyName ?: area.resume ?: ""
setCellWidth(entityCell, 6750)
styleCell(entityCell, bold = false, fontSize = 8, alignment = ParagraphAlignment.LEFT)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
ALTER TABLE public.regulations_cacem
ADD COLUMN plan character varying,
ADD COLUMN poly_name character varying,
ADD COLUMN resume character varying;

UPDATE public.regulations_cacem SET row_hash = md5(
COALESCE(entity_name::text, '') ||
COALESCE(url::text, '') ||
COALESCE(layer_name::text, '') ||
COALESCE(facade::text, '') ||
COALESCE(ref_reg::text, '') ||
COALESCE(editeur::text, '') ||
COALESCE(source::text, '') ||
COALESCE(observation::text, '') ||
COALESCE(thematique::text, '') ||
COALESCE(duree_validite::text, '') ||
COALESCE(temporalite::text, '') ||
COALESCE(type::text, '') ||
COALESCE(date::text, '') ||
COALESCE(date_fin::text, '') ||
COALESCE(edition::text, '') ||
COALESCE(plan::text, '') ||
COALESCE(poly_name::text, '') ||
COALESCE(resume::text, '')

);

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class RegulatoryAreasITests {
RegulatoryAreaEntity(
id = 17,
geom = polygon,
entityName = "Zone au sud de la cale",
url = url,
layerName = "ZMEL_Cale_Querlen",
facade = "NAMO",
Expand All @@ -73,6 +72,9 @@ class RegulatoryAreasITests {
dureeValidite = "15 ans",
dateFin = "2035-07-01",
temporalite = "temporaire",
plan = "PIRC",
polyName = "Zone au sud de la cale",
resume = "Descriptif de la zone réglementaire",
)
given(getAllRegulatoryAreas.execute()).willReturn(listOf(regulatoryArea))

Expand All @@ -83,13 +85,15 @@ class RegulatoryAreasITests {
.andDo(MockMvcResultHandlers.print())
.andExpect(status().isOk)
.andExpect(jsonPath("$[0].id", equalTo(regulatoryArea.id)))
.andExpect(jsonPath("$[0].entityName", equalTo(regulatoryArea.entityName)))
.andExpect(jsonPath("$[0].layerName", equalTo(regulatoryArea.layerName)))
.andExpect(jsonPath("$[0].refReg", equalTo(regulatoryArea.refReg)))
.andExpect(jsonPath("$[0].tags[0].name", equalTo("Mouillage")))
.andExpect(jsonPath("$[0].type", equalTo(regulatoryArea.type)))
.andExpect(jsonPath("$[0].geom.type", equalTo("MultiPolygon")))
.andExpect(jsonPath("$[0].themes[0].name", equalTo("AMP")))
.andExpect(jsonPath("$[0].plan", equalTo("PIRC")))
.andExpect(jsonPath("$[0].polyName", equalTo("Zone au sud de la cale")))
.andExpect(jsonPath("$[0].resume", equalTo("Descriptif de la zone réglementaire")))
}

@Test
Expand All @@ -99,7 +103,6 @@ class RegulatoryAreasITests {
RegulatoryAreaEntity(
id = 17,
geom = polygon,
entityName = "Zone au sud de la cale",
url = url,
layerName = "ZMEL_Cale_Querlen",
facade = "NAMO",
Expand All @@ -114,6 +117,9 @@ class RegulatoryAreasITests {
dureeValidite = "15 ans",
dateFin = "2035-07-01",
temporalite = "temporaire",
plan = "PSCEM",
polyName = "Zone au sud de la cale",
resume = "Descriptif de la zone réglementaire",
)

given(getRegulatoryAreaById.execute(17)).willReturn(regulatoryArea)
Expand All @@ -124,7 +130,6 @@ class RegulatoryAreasITests {
// Then
.andExpect(status().isOk)
.andExpect(jsonPath("$.id", equalTo(regulatoryArea.id)))
.andExpect(jsonPath("$.entityName", equalTo(regulatoryArea.entityName)))
.andExpect(jsonPath("$.facade", equalTo(regulatoryArea.facade)))
.andExpect(jsonPath("$.geom.type", equalTo("MultiPolygon")))
.andExpect(jsonPath("$.layerName", equalTo(regulatoryArea.layerName)))
Expand All @@ -133,5 +138,8 @@ class RegulatoryAreasITests {
.andExpect(jsonPath("$.themes[0].name", equalTo("AMP")))
.andExpect(jsonPath("$.type", equalTo(regulatoryArea.type)))
.andExpect(jsonPath("$.url", equalTo(regulatoryArea.url)))
.andExpect(jsonPath("$.plan", equalTo(regulatoryArea.plan)))
.andExpect(jsonPath("$.polyName", equalTo(regulatoryArea.polyName)))
.andExpect(jsonPath("$.resume", equalTo(regulatoryArea.resume)))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class JpaRegulatoryAreaRepositoryITests : AbstractDBTests() {
RegulatoryAreaModel(
id = 17,
geom = polygon,
entityName = "Zone au sud de la cale",
url =
"http://extranet.legicem.metier.developpement-durable.gouv.fr/zmel-roscanvel-a3474.html?id_rub=1098",
layerName = "ZMEL_Cale_Querlen",
Expand All @@ -54,6 +53,9 @@ class JpaRegulatoryAreaRepositoryITests : AbstractDBTests() {
dateFin = "2035-07-01",
temporalite = "temporaire",
themes = listOf(),
plan = "PIRC, PSCEM",
polyName = "",
resume = "Zone au sud de la cale",
)
val themes =
listOf(
Expand All @@ -76,7 +78,6 @@ class JpaRegulatoryAreaRepositoryITests : AbstractDBTests() {
require(requestedRegulatoryArea !== null)
assertThat(requestedRegulatoryArea.id).isEqualTo(searchedRegulatoryArea.id)
assertThat(requestedRegulatoryArea.geom).isEqualTo(searchedRegulatoryArea.geom)
assertThat(requestedRegulatoryArea.entityName).isEqualTo(searchedRegulatoryArea.entityName)
assertThat(requestedRegulatoryArea.url).isEqualTo(searchedRegulatoryArea.url)
assertThat(requestedRegulatoryArea.layerName).isEqualTo(searchedRegulatoryArea.layerName)
assertThat(requestedRegulatoryArea.facade).isEqualTo(searchedRegulatoryArea.facade)
Expand All @@ -94,6 +95,9 @@ class JpaRegulatoryAreaRepositoryITests : AbstractDBTests() {
assertThat(requestedRegulatoryArea.dureeValidite).isEqualTo(searchedRegulatoryArea.dureeValidite)
assertThat(requestedRegulatoryArea.dateFin).isEqualTo(searchedRegulatoryArea.dateFin)
assertThat(requestedRegulatoryArea.temporalite).isEqualTo(searchedRegulatoryArea.temporalite)
assertThat(requestedRegulatoryArea.plan).isEqualTo(searchedRegulatoryArea.plan)
assertThat(requestedRegulatoryArea.polyName).isEqualTo(searchedRegulatoryArea.polyName)
assertThat(requestedRegulatoryArea.resume).isEqualTo(searchedRegulatoryArea.resume)
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,16 @@ context('LayerTree > Regulatory Layers', () => {
cy.getDataCy('regulatory-result-list').children().should('have.length', 9)
cy.get('#isRegulatorySearchResultsVisible').should('be.checked')
})

it('Should filter regulatory areas by control plan', () => {
cy.getDataCy('regulatory-result-list-button').contains('13 résultats')

cy.fill('Plan de contrôle', 'PIRC')
cy.getDataCy('regulatory-result-list-button').contains('9 résultats')

cy.fill('Plan de contrôle', 'PSCEM')
cy.getDataCy('regulatory-result-list-button').contains('8 résultats')

cy.clickButton('Réinitialiser les filtres')
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ describe('Edit Vigilance Area', () => {
cy.fill('Filtre tags et sous-tags', ['AMP', 'Dragage', 'Mixte'])
cy.get('#root').click(1030, 490)

cy.clickButton("Ajouter la zone réglementaire Partie marine (plus basses eaux) RNN d'Iroise")
cy.clickButton('Ajouter la zone réglementaire Article 1')
cy.clickButton("Ajouter la zone réglementaire Réglementation dans la réserve naturelle nationale d'Iroise")
cy.clickButton('Ajouter la zone réglementaire Interdiction aux engins à moteur')
cy.getDataCy('regulatory-area-item').should('have.length', 2)

cy.clickButton('Valider la sélection')
Expand All @@ -84,7 +84,7 @@ describe('Edit Vigilance Area', () => {
// check if the regulatory area is added
cy.clickButton('Mes zones réglementaires')
cy.clickButton('Interdiction VNM Molene')
cy.getDataCy('my-zone-Article 1').should('exist')
cy.getDataCy('my-zone-Interdiction aux engins à moteur').should('exist')

// Reset data
cy.clickButton('Editer')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ context('Side Window > Vigilance Areas List > Filter Bar', () => {

it('Should filter vigilance areas by type', () => {
cy.fill('Type de zone de vigilance', ['Aucune période de vigilance en cours'])
cy.getDataCy('vigilance-area-row').should('have.length', 1)
cy.getDataCy('vigilance-area-row').should('have.length', 0)

cy.fill('Type de zone de vigilance', ['Période de vigilance critique en cours'])
cy.getDataCy('vigilance-area-row').should('have.length', 1)

cy.fill('Type de zone de vigilance', ['Période de vigilance simple en cours'])
cy.getDataCy('vigilance-area-row').should('have.length', 2)
cy.getDataCy('vigilance-area-row').should('have.length', 3)
})
})
Loading
Loading