From 398669a9018a468254ecda0e63e64e4df068ed03 Mon Sep 17 00:00:00 2001 From: Hilbrand Bouwkamp Date: Tue, 13 Oct 2026 11:27:18 +0200 Subject: [PATCH] AER-3979 Replaced duplicate source id check with more generic cohesion check in reading GML The check in GMLConversionData was only used for emission sources. But that check is also part of the cohesion check that also test other id's. Therefore, use more generic one. Note that when imported with schema validation these checks never trigger because the schema validation will already report duplications and not process the file any further. --- .../aerius/gml/base/AbstractGML2Source.java | 2 +- .../aerius/gml/base/GMLConversionData.java | 15 --------------- .../overheid/aerius/importer/ImaerImporter.java | 2 ++ .../shared/exception/ImaerExceptionReason.java | 7 ------- 4 files changed, 3 insertions(+), 23 deletions(-) diff --git a/source/imaer-gml/src/main/java/nl/overheid/aerius/gml/base/AbstractGML2Source.java b/source/imaer-gml/src/main/java/nl/overheid/aerius/gml/base/AbstractGML2Source.java index c3adfacd..a2bda642 100644 --- a/source/imaer-gml/src/main/java/nl/overheid/aerius/gml/base/AbstractGML2Source.java +++ b/source/imaer-gml/src/main/java/nl/overheid/aerius/gml/base/AbstractGML2Source.java @@ -106,9 +106,9 @@ private EmissionSourceFeature handleSourceMember(final FeatureMember member, fin */ public EmissionSource toEmissionSource(final T source, final Geometry geometry) throws AeriusException { final EmissionSource returnSource = visitor.visit(source); + if (returnSource != null) { fromGenericEmissionSource(source, returnSource, geometry); - conversionData.putAndTrack(source.getId()); } return returnSource; } diff --git a/source/imaer-gml/src/main/java/nl/overheid/aerius/gml/base/GMLConversionData.java b/source/imaer-gml/src/main/java/nl/overheid/aerius/gml/base/GMLConversionData.java index 1815d17d..4a88ff8a 100644 --- a/source/imaer-gml/src/main/java/nl/overheid/aerius/gml/base/GMLConversionData.java +++ b/source/imaer-gml/src/main/java/nl/overheid/aerius/gml/base/GMLConversionData.java @@ -17,11 +17,9 @@ package nl.overheid.aerius.gml.base; import java.util.ArrayList; -import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.Set; import nl.overheid.aerius.gml.base.GMLLegacyCodeConverter.Conversion; import nl.overheid.aerius.gml.base.GMLLegacyCodeConverter.GMLLegacyCodeType; @@ -55,7 +53,6 @@ public class GMLConversionData { private final List errors; private final List warnings; - private final Set idMap = new HashSet<>(); private final GMLLegacyCodeConverter legacyCodeConverter; private final int srid; private final ReceptorUtil receptorUtil; @@ -113,18 +110,6 @@ public CharacteristicsType getCharacteristicsType() { return characteristicsSupplier.getCharacteristicsType(); } - /** - * Checks if given id is unique and if not adds it to the list of exceptions. - * @param gmlId Feature Member String id - */ - public void putAndTrack(final String gmlId) { - if (idMap.contains(gmlId)) { - errors.add(new AeriusException(ImaerExceptionReason.GML_ID_NOT_UNIQUE, gmlId, gmlId)); - } else { - idMap.add(gmlId); - } - } - /** * @param codeType The code type to convert. * @param oldCode The old code to try and convert. Will be returned if not converted. diff --git a/source/imaer-gml/src/main/java/nl/overheid/aerius/importer/ImaerImporter.java b/source/imaer-gml/src/main/java/nl/overheid/aerius/importer/ImaerImporter.java index 9fc588b8..cde98ef5 100644 --- a/source/imaer-gml/src/main/java/nl/overheid/aerius/importer/ImaerImporter.java +++ b/source/imaer-gml/src/main/java/nl/overheid/aerius/importer/ImaerImporter.java @@ -62,6 +62,7 @@ import nl.overheid.aerius.validation.DefinitionsValidator; import nl.overheid.aerius.validation.EmissionSourceLimitValidator; import nl.overheid.aerius.validation.EmissionSourceValidator; +import nl.overheid.aerius.validation.SituationCohesionValidator; /** * Importer for IMAER GML files. @@ -162,6 +163,7 @@ public void importStream(final InputStream inputStream, final Set addDefinitions(reader, importOptions, result, situation); setCrs(result); + SituationCohesionValidator.checkCohesion(situation, result.getExceptions(), result.getWarnings()); addCalculationSetOptions(theme, reader, result); LOGGER.info("GML imported with GML version: {}", version); } diff --git a/source/imaer-shared/src/main/java/nl/overheid/aerius/shared/exception/ImaerExceptionReason.java b/source/imaer-shared/src/main/java/nl/overheid/aerius/shared/exception/ImaerExceptionReason.java index 244becfc..42728817 100644 --- a/source/imaer-shared/src/main/java/nl/overheid/aerius/shared/exception/ImaerExceptionReason.java +++ b/source/imaer-shared/src/main/java/nl/overheid/aerius/shared/exception/ImaerExceptionReason.java @@ -388,13 +388,6 @@ public enum ImaerExceptionReason implements Reason { */ GML_INVALID_ROAD_CATEGORY_MATCH(5219), - /** - * The source id string contains a number that already is used on another id, while the string id itself might be unique. - * - * @param 0 violating id. - * @param 1 id that is violated. - */ - GML_ID_NOT_UNIQUE(5220), /** * GML contains an unknown combination of road characteristics that don't match a known vehicle category. *