changeset 3414:1bb6fb621167

FixA: Added stub for the "Ausgelagerte Wasserspiegellagen" calculation. flys-artifacts/trunk@5067 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 19 Jul 2012 14:59:16 +0000
parents 4c4d88c0af6a
children e3c7a3228bc2
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixRealizingAccess.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixRealizingCalculation.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java
diffstat 5 files changed, 115 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Jul 19 14:27:20 2012 +0000
+++ b/flys-artifacts/ChangeLog	Thu Jul 19 14:59:16 2012 +0000
@@ -1,3 +1,18 @@
+2012-07-19	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/fixings/FixRealizingCalculation.java:
+	  New. Stub for 'Ausgelagerte Wasserspiegellagen' calculation.
+
+	* src/main/java/de/intevation/flys/artifacts/access/FixRealizingAccess.java:
+	  New. Stub for accessing the artifact to extract the relevant parameters
+	  for the 'ausgelagerte Wasserspiegellagen' calculation.
+
+	* src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java:
+	  Call the calculation if the state is reached.
+
+	* src/main/java/de/intevation/flys/artifacts/states/DefaultState.java:
+	  Removed trailing whitespace.
+
 2012-07-19	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/states/fixation/FixationVolmerCompute.java:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixRealizingAccess.java	Thu Jul 19 14:59:16 2012 +0000
@@ -0,0 +1,19 @@
+package de.intevation.flys.artifacts.access;
+
+import de.intevation.flys.artifacts.FLYSArtifact;
+
+import org.apache.log4j.Logger;
+
+public class FixRealizingAccess
+extends      Access
+{
+    private static Logger log = Logger.getLogger(FixRealizingAccess.class);
+
+    public FixRealizingAccess() {
+    }
+
+    public FixRealizingAccess(FLYSArtifact artifact) {
+        super(artifact);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixRealizingCalculation.java	Thu Jul 19 14:59:16 2012 +0000
@@ -0,0 +1,28 @@
+package de.intevation.flys.artifacts.model.fixings;
+
+import de.intevation.flys.artifacts.access.FixRealizingAccess;
+
+import de.intevation.flys.artifacts.model.Calculation;
+import de.intevation.flys.artifacts.model.CalculationResult;
+
+import org.apache.log4j.Logger;
+
+public class FixRealizingCalculation
+extends      Calculation
+{
+    private static Logger log =
+        Logger.getLogger(FixRealizingCalculation.class);
+
+    public FixRealizingCalculation() {
+    }
+
+    public FixRealizingCalculation(FixRealizingAccess access) {
+        // TODO: Implement me!
+    }
+
+    public CalculationResult calculate() {
+        // TODO: Implement me!
+        return null;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java	Thu Jul 19 14:27:20 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java	Thu Jul 19 14:59:16 2012 +0000
@@ -198,7 +198,7 @@
     /**
      * This method returns the default value and description for <i>data</i>.
      * Note, that this method returns the defaults only if <i>USE_DEFAULTS</i>
-     * is set; otherwise, null is returned. 
+     * is set; otherwise, null is returned.
      * @param context The CallContext used for i18n.
      * @param data The data objects that the defaults are for.
      * @return a String[] with [default value, default label].
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java	Thu Jul 19 14:27:20 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java	Thu Jul 19 14:59:16 2012 +0000
@@ -1,9 +1,23 @@
 package de.intevation.flys.artifacts.states.fixation;
 
-import org.apache.log4j.Logger;
+import de.intevation.artifactdatabase.state.Facet;
+
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.flys.artifacts.FLYSArtifact;
+
+import de.intevation.flys.artifacts.access.FixRealizingAccess;
+
+import de.intevation.flys.artifacts.model.CalculationResult;
+import de.intevation.flys.artifacts.model.ReportFacet;
+
+import de.intevation.flys.artifacts.model.fixings.FixRealizingCalculation;
 
 import de.intevation.flys.artifacts.states.DefaultState;
 
+import java.util.List;
+
+import org.apache.log4j.Logger;
 
 /**
  * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
@@ -11,13 +25,48 @@
 public class FixRealizingCompute extends DefaultState {
 
     /** The logger used in this class. */
-    private static Logger logger = Logger.getLogger(FixRealizingCompute.class);
-
+    private static Logger log = Logger.getLogger(FixRealizingCompute.class);
 
     /**
      * The default constructor that initializes an empty State object.
      */
     public FixRealizingCompute() {
     }
+
+    @Override
+    public Object computeAdvance(
+        FLYSArtifact artifact,
+        String       hash,
+        CallContext  context,
+        List<Facet>  facets,
+        Object       old
+    ) {
+        log.debug("FixRealizingCompute.computeAdvance");
+
+        CalculationResult res;
+
+        FixRealizingAccess access =
+            new FixRealizingAccess(artifact);
+
+        if (old instanceof CalculationResult) {
+            res = (CalculationResult)old;
+        }
+        else {
+            FixRealizingCalculation calc = new FixRealizingCalculation(access);
+            res = calc.calculate();
+        }
+
+        if (facets == null) {
+            return res;
+        }
+
+        if (res.getReport().hasProblems()) {
+            facets.add(new ReportFacet(ComputeType.ADVANCE, hash, id));
+        }
+
+        // TODO: Added facets
+
+        return res;
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org