[PATCH 5 of 5] issue1399: WINFOArtifact: Compute difference also if part of difference building oneselve

Wald Commits scm-commit at wald.intevation.org
Fri Jul 19 13:30:03 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1374233980 -7200
# Node ID 075c00b767d7e504a2c147a553048fd46a7aa395
# Parent  e8e76d50d119b2e85e96d5d55741e0dd16e37fdc
issue1399: WINFOArtifact: Compute difference also if part of difference building oneselve.

diff -r e8e76d50d119 -r 075c00b767d7 artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java	Fri Jul 19 13:36:45 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java	Fri Jul 19 13:39:40 2013 +0200
@@ -197,15 +197,26 @@
 
         String calculationMode = getDataAsString("calculation_mode");
 
-        if (calculationMode.equals("calc.discharge.longitudinal.section")
-        ) {
-            return getDischargeLongitudinalSectionData();
-        }
-        else if (calculationMode.equals("calc.extreme.curve")) {
-            return (CalculationResult)
-                this.compute(context, ComputeType.ADVANCE, false);
+        // If this WINFO-Artifact has a calculation trait.
+        if (calculationMode != null) {
+            if (calculationMode.equals("calc.discharge.longitudinal.section")
+            ) {
+                return getDischargeLongitudinalSectionData();
+            }
+            else if (calculationMode.equals("calc.extreme.curve")) {
+                return (CalculationResult)
+                    this.compute(context, ComputeType.ADVANCE, false);
+            }
+            else if (calculationMode.equals("calc.w.differences")) {
+                return (CalculationResult)
+                    this.compute(context, ComputeType.ADVANCE, true);
+            }
+            else {
+                logger.warn("Unhandled calculation_mode " + calculation_mode);
+            }
         }
 
+        // Otherwise get it from parameterization.
         River river = RiverUtils.getRiver(this);
         if (river == null) {
             return error(new WQKms[0], "no.river.selected");


More information about the Dive4elements-commits mailing list