Index: Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationActivity.cs =================================================================== diff -u -r1ab13c60f0a6168b2e959bc213d229d2c77af3b6 -r83bf97213a11e77a77f1bd6b35eef856922ff4d7 --- Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationActivity.cs (.../PipingCalculationActivity.cs) (revision 1ab13c60f0a6168b2e959bc213d229d2c77af3b6) +++ Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationActivity.cs (.../PipingCalculationActivity.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.Piping.Data; using RingtoetsCommonServiceResources = Ringtoets.Common.Service.Properties.Resources; namespace Ringtoets.Piping.Service { /// - /// for running a piping calculation. + /// for running a piping calculation. /// - public class PipingCalculationActivity : Activity + public class PipingCalculationActivity : CalculatableActivity { private readonly PipingCalculation calculation; private readonly RoundedDouble normativeAssessmentLevel; /// - /// Initializes a new instance of the class. + /// Creates a new instance of . /// - /// The piping data used for the calculation. + /// The piping calculation to perform. /// The normative assessment level to use in case the manual assessment level is not applicable. /// Thrown when is null. public PipingCalculationActivity(PipingCalculation 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 (!PipingCalculationService.Validate(calculation, normativeAssessmentLevel)) - { - State = ActivityState.Failed; - return; - } - - PipingDataSynchronizationService.ClearCalculationOutput(calculation); - PipingCalculationService.Calculate(calculation, normativeAssessmentLevel); } + protected override bool Validate() + { + return PipingCalculationService.Validate(calculation, normativeAssessmentLevel); + } + protected override void OnCancel() { // Unable to cancel a running kernel, so nothing can be done.