Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs =================================================================== diff -u -r755360927a67d206d503b10e0d4c40d5426c4a3b -rc9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision 755360927a67d206d503b10e0d4c40d5426c4a3b) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8) @@ -87,6 +87,20 @@ } } + private static void ReadForeshoreProfiles(this FailureMechanismEntity entity, + ForeshoreProfileCollection foreshoreProfiles, + string foreshoreProfileSourcePath, + ReadConversionCollector collector) + { + if (entity.ForeshoreProfileEntities.Any()) + { + foreshoreProfiles.AddRange(entity.ForeshoreProfileEntities + .OrderBy(fpe => fpe.Order) + .Select(foreshoreProfileEntity => foreshoreProfileEntity.Read(collector)), + foreshoreProfileSourcePath); + } + } + #region Piping /// @@ -241,14 +255,15 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. + /// Thrown when expected table entries could not be found.> internal static void ReadAsHeightStructuresFailureMechanism(this FailureMechanismEntity entity, HeightStructuresFailureMechanism failureMechanism, ReadConversionCollector collector) { HeightStructuresFailureMechanismMetaEntity metaEntity = entity.HeightStructuresFailureMechanismMetaEntities.Single(); entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadHeightStructuresMechanismSectionResults(failureMechanism, collector); - entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, collector); + entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, metaEntity.ForeshoreProfileCollectionSourcePath, collector); entity.ReadHeightStructures(metaEntity, failureMechanism.HeightStructures, collector); entity.ReadGeneralInput(failureMechanism.GeneralInput); ReadHeightStructuresRootCalculationGroup(entity.CalculationGroupEntity, failureMechanism.CalculationsGroup, collector); @@ -400,13 +415,20 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. + /// Thrown when expected table entries cannot be found. internal static void ReadAsClosingStructuresFailureMechanism(this FailureMechanismEntity entity, ClosingStructuresFailureMechanism failureMechanism, ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadClosingStructuresMechanismSectionResults(failureMechanism, collector); - entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, collector); + + ClosingStructuresFailureMechanismMetaEntity metaEntity = + entity.ClosingStructuresFailureMechanismMetaEntities.Single(); + entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, + metaEntity.ForeshoreProfileCollectionSourcePath, + collector); + entity.ReadClosingStructures(failureMechanism.ClosingStructures, collector); entity.ReadGeneralInput(failureMechanism.GeneralInput); ReadClosingStructuresRootCalculationGroup(entity.CalculationGroupEntity, failureMechanism.CalculationsGroup, collector); @@ -520,14 +542,18 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. + /// Thrown when the expected table entries could not be found. internal static void ReadAsWaveImpactAsphaltCoverFailureMechanism(this FailureMechanismEntity entity, WaveImpactAsphaltCoverFailureMechanism failureMechanism, ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadWaveImpactAsphaltCoverMechanismSectionResults(failureMechanism, collector); - entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, collector); + WaveImpactAsphaltCoverFailureMechanismMetaEntity metaEntity = + entity.WaveImpactAsphaltCoverFailureMechanismMetaEntities.Single(); + entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, metaEntity.ForeshoreProfileCollectionSourcePath, collector); + ReadWaveImpactAsphaltCoverRootCalculationGroup(entity.CalculationGroupEntity, failureMechanism.WaveConditionsCalculationGroup, collector); } @@ -565,14 +591,22 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. + /// Thrown when expected table entries could not be found. internal static void ReadAsGrassCoverErosionOutwardsFailureMechanism(this FailureMechanismEntity entity, GrassCoverErosionOutwardsFailureMechanism failureMechanism, ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadGeneralGrassCoverErosionOutwardsCalculationInput(failureMechanism.GeneralInput); entity.ReadGrassCoverErosionOutwardsMechanismSectionResults(failureMechanism, collector); - entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, collector); + + GrassCoverErosionOutwardsFailureMechanismMetaEntity metaEntity = + entity.GrassCoverErosionOutwardsFailureMechanismMetaEntities.Single(); + ReadForeshoreProfiles(entity, + failureMechanism.ForeshoreProfiles, + metaEntity.ForeshoreProfileCollectionSourcePath, + collector); + entity.ReadHydraulicBoundaryLocations(failureMechanism.HydraulicBoundaryLocations, collector); ReadGrassCoverErosionOutwardsWaveConditionsRootCalculationGroup(entity.CalculationGroupEntity, failureMechanism.WaveConditionsCalculationGroup, collector); @@ -800,25 +834,24 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. + /// Thrown when expected table entries cannot be found. internal static void ReadAsStabilityStoneCoverFailureMechanism(this FailureMechanismEntity entity, StabilityStoneCoverFailureMechanism failureMechanism, ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadStabilityStoneCoverMechanismSectionResults(failureMechanism, collector); - entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, collector); - ReadStabilityStoneCoverWaveConditionsRootCalculationGroup(entity.CalculationGroupEntity, failureMechanism.WaveConditionsCalculationGroup, collector); - } + StabilityStoneCoverFailureMechanismMetaEntity metaEntity = + entity.StabilityStoneCoverFailureMechanismMetaEntities.Single(); + ReadForeshoreProfiles(entity, + failureMechanism.ForeshoreProfiles, + metaEntity.ForeshoreProfileCollectionSourcePath, + collector); - private static void ReadForeshoreProfiles(this FailureMechanismEntity entity, ForeshoreProfileCollection foreshoreProfiles, - ReadConversionCollector collector) - { - // TODO: WTI-1112 Add file path location to storage - foreshoreProfiles.AddRange(entity.ForeshoreProfileEntities - .OrderBy(fpe => fpe.Order) - .Select(foreshoreProfileEntity => foreshoreProfileEntity.Read(collector)), - "path"); + ReadStabilityStoneCoverWaveConditionsRootCalculationGroup(entity.CalculationGroupEntity, + failureMechanism.WaveConditionsCalculationGroup, + collector); } private static void ReadStabilityStoneCoverMechanismSectionResults(this FailureMechanismEntity entity, @@ -855,13 +888,20 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. + /// Thrown when expected table entries cannot be found. internal static void ReadAsStabilityPointStructuresFailureMechanism(this FailureMechanismEntity entity, StabilityPointStructuresFailureMechanism failureMechanism, ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadStabilityPointStructuresMechanismSectionResults(failureMechanism, collector); - entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, collector); + + StabilityPointStructuresFailureMechanismMetaEntity metaEntity = + entity.StabilityPointStructuresFailureMechanismMetaEntities.Single(); + entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, + metaEntity.ForeshoreProfileCollectionSourcePath, + collector); + entity.ReadStabilityPointStructures(failureMechanism.StabilityPointStructures, collector); entity.ReadGeneralInput(failureMechanism.GeneralInput); ReadStabilityPointStructuresRootCalculationGroup(entity.CalculationGroupEntity, failureMechanism.CalculationsGroup, collector);