changeset 2784:156214e3ca55

FixA: Call computing when reaching the compute state. flys-artifacts/trunk@4523 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sat, 26 May 2012 16:55:15 +0000
parents cbb513a8f548
children f87fcedbfa82
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixationCompute.java
diffstat 2 files changed, 57 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri May 25 13:49:27 2012 +0000
+++ b/flys-artifacts/ChangeLog	Sat May 26 16:55:15 2012 +0000
@@ -1,3 +1,8 @@
+2012-05-26	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/states/fixation/FixationCompute.java:
+	  Call the computing.
+
 2012-05-25  Ingo Weinzierl <ingo@intevation.de>
 
 	* doc/conf/conf.xml: Use the correct Artifacts for wms fixpoints and
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixationCompute.java	Fri May 25 13:49:27 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixationCompute.java	Sat May 26 16:55:15 2012 +0000
@@ -1,16 +1,30 @@
 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.FixationArtifactAccess;
+
+import de.intevation.flys.artifacts.model.CalculationResult;
+import de.intevation.flys.artifacts.model.ReportFacet;
+
+import de.intevation.flys.artifacts.model.fixings.FixCalculation;
 
 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>
  */
 public class FixationCompute extends DefaultState {
 
-    /** The logger used in this class. */
-    private static Logger logger = Logger.getLogger(FixationCompute.class);
+    /** The log used in this class. */
+    private static Logger log = Logger.getLogger(FixationCompute.class);
 
 
     /**
@@ -19,5 +33,40 @@
     public FixationCompute() {
     }
 
+    @Override
+    public Object computeAdvance(
+        FLYSArtifact artifact,
+        String       hash,
+        CallContext  context,
+        List<Facet>  facets,
+        Object       old
+    ) {
+        log.debug("FixationCompute.computeAdvance");
+
+        CalculationResult res;
+
+        if (old instanceof CalculationResult) {
+            res = (CalculationResult)old;
+        }
+        else {
+            FixationArtifactAccess access =
+                new FixationArtifactAccess(artifact);
+
+            FixCalculation calc =
+                new FixCalculation(access);
+
+            res = calc.calculate();
+        }
+
+        if (facets == null) {
+            return res;
+        }
+
+        if (res.getReport().hasProblems()) {
+            facets.add(new ReportFacet(ComputeType.ADVANCE, hash, id));
+        }
+
+        return res;
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org