diff --git a/source/imaer-shared/src/main/java/nl/overheid/aerius/shared/domain/calculation/NCACalculationOptions.java b/source/imaer-shared/src/main/java/nl/overheid/aerius/shared/domain/calculation/NCACalculationOptions.java index 2b5b8fbf..56f4cddb 100644 --- a/source/imaer-shared/src/main/java/nl/overheid/aerius/shared/domain/calculation/NCACalculationOptions.java +++ b/source/imaer-shared/src/main/java/nl/overheid/aerius/shared/domain/calculation/NCACalculationOptions.java @@ -27,6 +27,8 @@ public class NCACalculationOptions implements Serializable { private static final long serialVersionUID = 1L; + private ProjectCategory projectCategory = ProjectCategory.AGRICULTURE; + /** * Regional area for which a permit calculation would apply to. */ @@ -40,7 +42,7 @@ public class NCACalculationOptions implements Serializable { /** * List of meteo years to calculate. */ - private List meteoYears = new ArrayList<>(); + private final List meteoYears = new ArrayList<>(); /** * ADMS version to use. @@ -67,6 +69,15 @@ public class NCACalculationOptions implements Serializable { */ private Double roadLocalFractionNO2; + + public ProjectCategory getProjectCategory() { + return projectCategory; + } + + public void setProjectCategory(final ProjectCategory projectCategory) { + this.projectCategory = projectCategory; + } + public String getPermitArea() { return permitArea; } diff --git a/source/imaer-util/src/main/java/nl/overheid/aerius/util/OptionsMetadataUtil.java b/source/imaer-util/src/main/java/nl/overheid/aerius/util/OptionsMetadataUtil.java index 56573bc4..70315e05 100644 --- a/source/imaer-util/src/main/java/nl/overheid/aerius/util/OptionsMetadataUtil.java +++ b/source/imaer-util/src/main/java/nl/overheid/aerius/util/OptionsMetadataUtil.java @@ -45,6 +45,7 @@ import nl.overheid.aerius.shared.domain.calculation.NCACalculationOptions; import nl.overheid.aerius.shared.domain.calculation.OPSOptions; import nl.overheid.aerius.shared.domain.calculation.OwN2000CalculationOptions; +import nl.overheid.aerius.shared.domain.calculation.ProjectCategory; import nl.overheid.aerius.shared.domain.calculation.RoadLocalFractionNO2Option; /** @@ -90,6 +91,7 @@ public enum Option { /* ADMS options related */ ADMS_VERSION, + ADMS_PROJECT_CATEGORY, ADMS_PERMIT_AREA, ADMS_MIN_MONIN_OBUKHOV_LENGTH, ADMS_SURFACE_ALBEDO, @@ -238,6 +240,7 @@ private static void opsOptionsToMap(final OPSOptions options, final Map map, final Map> prefixedOptionsMap) { + options.setProjectCategory(ProjectCategory.safeValueOf(map.get(Option.ADMS_PROJECT_CATEGORY))); options.setPermitArea(map.get(Option.ADMS_PERMIT_AREA)); options.setRoadLocalFractionNO2ReceptorsOption(RoadLocalFractionNO2Option.safeValueOf(map.get(Option.ROAD_LOCAL_FRACTION_NO2_RECEPTORS_OPTION))); options.setRoadLocalFractionNO2PointsOption(RoadLocalFractionNO2Option.safeValueOf(map.get(Option.ROAD_LOCAL_FRACTION_NO2_POINTS_OPTION))); @@ -315,6 +318,7 @@ private static void ncaParseMetYears(final ADMSOptions admsOptions, final Map mapToAddTo, final NCACalculationOptions options, final boolean addDefaults) { if (options != null) { addValue(mapToAddTo, Option.ADMS_VERSION, options.getAdmsVersion(), addDefaults); + addValue(mapToAddTo, Option.ADMS_PROJECT_CATEGORY, options.getProjectCategory(), addDefaults); addValue(mapToAddTo, Option.ADMS_PERMIT_AREA, options.getPermitArea(), addDefaults); addValue(mapToAddTo, Option.ROAD_LOCAL_FRACTION_NO2_RECEPTORS_OPTION, options.getRoadLocalFractionNO2ReceptorsOption(), addDefaults); addValue(mapToAddTo, Option.ROAD_LOCAL_FRACTION_NO2_POINTS_OPTION, options.getRoadLocalFractionNO2PointsOption(), addDefaults); diff --git a/source/imaer-util/src/test/java/nl/overheid/aerius/util/OptionsMetadataUtilTest.java b/source/imaer-util/src/test/java/nl/overheid/aerius/util/OptionsMetadataUtilTest.java index 2da4f788..082b81d9 100644 --- a/source/imaer-util/src/test/java/nl/overheid/aerius/util/OptionsMetadataUtilTest.java +++ b/source/imaer-util/src/test/java/nl/overheid/aerius/util/OptionsMetadataUtilTest.java @@ -37,6 +37,7 @@ import nl.overheid.aerius.shared.domain.calculation.NCACalculationOptions; import nl.overheid.aerius.shared.domain.calculation.OPSOptions; import nl.overheid.aerius.shared.domain.calculation.OwN2000CalculationOptions; +import nl.overheid.aerius.shared.domain.calculation.ProjectCategory; import nl.overheid.aerius.shared.domain.calculation.RoadLocalFractionNO2Option; import nl.overheid.aerius.shared.domain.calculation.SubReceptorsMode; import nl.overheid.aerius.shared.domain.meteo.Meteo; @@ -198,6 +199,7 @@ void testNcaOptions() { final NCACalculationOptions ncaOptions = options.getNcaCalculationOptions(); ncaOptions.setAdmsVersion("5.0.0.1"); + ncaOptions.setProjectCategory(ProjectCategory.AGRICULTURE); ncaOptions.setPermitArea("London"); ncaOptions.setRoadLocalFractionNO2ReceptorsOption(RoadLocalFractionNO2Option.ONE_CUSTOM_VALUE); ncaOptions.setRoadLocalFractionNO2PointsOption(RoadLocalFractionNO2Option.ONE_CUSTOM_VALUE); @@ -281,6 +283,7 @@ void testNcaOptionsRoundtrip() { final NCACalculationOptions ncaOptions = options.getNcaCalculationOptions(); ncaOptions.setPermitArea("London"); + ncaOptions.setProjectCategory(ProjectCategory.ROADS); ncaOptions.setRoadLocalFractionNO2ReceptorsOption(RoadLocalFractionNO2Option.ONE_CUSTOM_VALUE); ncaOptions.setRoadLocalFractionNO2PointsOption(RoadLocalFractionNO2Option.ONE_CUSTOM_VALUE); ncaOptions.setRoadLocalFractionNO2(0.4);