Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/Configurations/HeightStructuresCalculationConfigurationImporter.cs =================================================================== diff -u -r4bf59bb3506b840b284efe0c0f4431b7876e0e5b -rf4c28926da2401b1fddbbe7f907fd663f0f5f4dc --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/Configurations/HeightStructuresCalculationConfigurationImporter.cs (.../HeightStructuresCalculationConfigurationImporter.cs) (revision 4bf59bb3506b840b284efe0c0f4431b7876e0e5b) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/Configurations/HeightStructuresCalculationConfigurationImporter.cs (.../HeightStructuresCalculationConfigurationImporter.cs) (revision f4c28926da2401b1fddbbe7f907fd663f0f5f4dc) @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; +using System.Linq; using Core.Common.Base.Data; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.DikeProfiles; @@ -29,6 +30,7 @@ using Ringtoets.Common.IO.Configurations; using Ringtoets.Common.IO.Configurations.Helpers; using Ringtoets.Common.IO.Configurations.Import; +using Ringtoets.Common.Utils; using Ringtoets.HeightStructures.Data; using RingtoetsCommonIOResources = Ringtoets.Common.IO.Properties.Resources; @@ -44,6 +46,7 @@ private readonly IEnumerable availableHydraulicBoundaryLocations; private readonly IEnumerable availableForeshoreProfiles; private readonly IEnumerable availableStructures; + private readonly HeightStructuresFailureMechanism failureMechanism; /// /// Create new instance of @@ -56,13 +59,15 @@ /// the imported objects contain the right foreshore profile. /// The structures used to check if /// the imported objects contain the right structure. + /// The failure mechanism used to propagate changes. /// Thrown when any parameter is null. public HeightStructuresCalculationConfigurationImporter( string xmlFilePath, CalculationGroup importTarget, IEnumerable hydraulicBoundaryLocations, IEnumerable foreshoreProfiles, - IEnumerable structures) + IEnumerable structures, + HeightStructuresFailureMechanism failureMechanism) : base(xmlFilePath, importTarget) { if (hydraulicBoundaryLocations == null) @@ -77,11 +82,25 @@ { throw new ArgumentNullException(nameof(structures)); } + if (failureMechanism == null) + { + throw new ArgumentNullException(nameof(failureMechanism)); + } availableHydraulicBoundaryLocations = hydraulicBoundaryLocations; availableForeshoreProfiles = foreshoreProfiles; availableStructures = structures; + this.failureMechanism = failureMechanism; } + protected override void DoPostImportUpdates() + { + StructuresHelper.UpdateCalculationToSectionResultAssignments( + failureMechanism.SectionResults, + failureMechanism.Calculations.Cast>()); + + base.DoPostImportUpdates(); + } + protected override HeightStructuresCalculationConfigurationReader CreateCalculationConfigurationReader(string xmlFilePath) { return new HeightStructuresCalculationConfigurationReader(xmlFilePath);