# HG changeset patch # User Sascha L. Teichmann # Date 1338051315 0 # Node ID 156214e3ca55855ad025ae315c2f0c29344421df # Parent cbb513a8f54820c43db95a39afe6f9f0a26f75bf FixA: Call computing when reaching the compute state. flys-artifacts/trunk@4523 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r cbb513a8f548 -r 156214e3ca55 flys-artifacts/ChangeLog --- 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 + + * src/main/java/de/intevation/flys/artifacts/states/fixation/FixationCompute.java: + Call the computing. + 2012-05-25 Ingo Weinzierl * doc/conf/conf.xml: Use the correct Artifacts for wms fixpoints and diff -r cbb513a8f548 -r 156214e3ca55 flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixationCompute.java --- 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 Raimund Renkert */ 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 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 :