Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Service/MacroStabilityInwardsCalculationActivity.cs =================================================================== diff -u -ra5bf4f56dbf07e5cf48d0b874f5d46d7d02f0dba -r83bf97213a11e77a77f1bd6b35eef856922ff4d7 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Service/MacroStabilityInwardsCalculationActivity.cs (.../MacroStabilityInwardsCalculationActivity.cs) (revision a5bf4f56dbf07e5cf48d0b874f5d46d7d02f0dba) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Service/MacroStabilityInwardsCalculationActivity.cs (.../MacroStabilityInwardsCalculationActivity.cs) (revision 83bf97213a11e77a77f1bd6b35eef856922ff4d7) @@ -21,53 +21,46 @@ using System; using Core.Common.Base.Data; -using Core.Common.Base.Service; +using Ringtoets.Common.Service; using Ringtoets.MacroStabilityInwards.Data; using RingtoetsCommonServiceResources = Ringtoets.Common.Service.Properties.Resources; namespace Ringtoets.MacroStabilityInwards.Service { /// - /// for running a macro stability inwards calculation. + /// for running a macro stability inwards calculation. /// - public class MacroStabilityInwardsCalculationActivity : Activity + public class MacroStabilityInwardsCalculationActivity : CalculatableActivity { private readonly RoundedDouble normativeAssessmentLevel; private readonly MacroStabilityInwardsCalculation calculation; /// - /// Initializes a new instance of the class. + /// Creates a new instance of . /// - /// The macro stability inwards data used for the calculation. + /// The macro stability inwards calculation to perform. /// The normative assessment level to use in case the manual assessment level is not applicable. /// Thrown when is null. public MacroStabilityInwardsCalculationActivity(MacroStabilityInwardsCalculation calculation, RoundedDouble normativeAssessmentLevel) + : base(calculation) { - if (calculation == null) - { - throw new ArgumentNullException(nameof(calculation)); - } - this.calculation = calculation; this.normativeAssessmentLevel = normativeAssessmentLevel; Description = string.Format(RingtoetsCommonServiceResources.Perform_calculation_with_name_0_, calculation.Name); } - protected override void OnRun() + protected override void PerformCalculation() { - if (!MacroStabilityInwardsCalculationService.Validate(calculation, normativeAssessmentLevel)) - { - State = ActivityState.Failed; - return; - } - - MacroStabilityInwardsDataSynchronizationService.ClearCalculationOutput(calculation); - MacroStabilityInwardsCalculationService.Calculate(calculation, normativeAssessmentLevel); } + protected override bool Validate() + { + return MacroStabilityInwardsCalculationService.Validate(calculation, normativeAssessmentLevel); + } + protected override void OnCancel() { // Unable to cancel a running kernel, so nothing can be done.