changeset 3412:da000d9513f7

FixA: Renamed FixationCompute to FixAnalysisCompute flys-artifacts/trunk@5065 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 19 Jul 2012 14:19:35 +0000
parents 0ef83077c93f
children 4c4d88c0af6a
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/artifacts/fixanalysis.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixationCompute.java
diffstat 4 files changed, 279 insertions(+), 269 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Jul 19 14:11:11 2012 +0000
+++ b/flys-artifacts/ChangeLog	Thu Jul 19 14:19:35 2012 +0000
@@ -1,3 +1,13 @@
+2012-07-19	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/states/fixation/FixationCompute.java:
+	  Removed.
+
+	* src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java:
+	  Re-added.
+
+	* doc/conf/artifacts/fixanalysis.xml: Adjusted.
+
 2012-07-19	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java:
--- a/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Thu Jul 19 14:11:11 2012 +0000
+++ b/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Thu Jul 19 14:19:35 2012 +0000
@@ -122,7 +122,7 @@
 
         <state id="state.fix.analysis.compute"
             description="state.fix.analysis.compute"
-            state="de.intevation.flys.artifacts.states.fixation.FixationCompute">
+            state="de.intevation.flys.artifacts.states.fixation.FixAnalysisCompute">
             <outputmodes>
                 <outputmode name="fix_deltawt_export" description="output.fix_deltawt_export" mine-type="text/plain" type="export">
                     <facets>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java	Thu Jul 19 14:19:35 2012 +0000
@@ -0,0 +1,268 @@
+package de.intevation.flys.artifacts.states.fixation;
+
+import de.intevation.artifactdatabase.state.Facet;
+
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.flys.artifacts.FLYSArtifact;
+
+import de.intevation.flys.artifacts.access.FixAnalysisAccess;
+
+import de.intevation.flys.artifacts.model.CalculationResult;
+import de.intevation.flys.artifacts.model.DataFacet;
+import de.intevation.flys.artifacts.model.DateRange;
+import de.intevation.flys.artifacts.model.FacetTypes;
+import de.intevation.flys.artifacts.model.ReportFacet;
+
+import de.intevation.flys.artifacts.model.fixings.FixAnalysisEventsFacet;
+import de.intevation.flys.artifacts.model.fixings.FixAnalysisPeriodsFacet;
+import de.intevation.flys.artifacts.model.fixings.FixAvSectorFacet;
+import de.intevation.flys.artifacts.model.fixings.FixAnalysisCalculation;
+import de.intevation.flys.artifacts.model.fixings.FixDerivateFacet;
+import de.intevation.flys.artifacts.model.fixings.FixDeviationFacet;
+import de.intevation.flys.artifacts.model.fixings.FixLongitudinalAnalysisFacet;
+import de.intevation.flys.artifacts.model.fixings.FixLongitudinalDeviationFacet;
+import de.intevation.flys.artifacts.model.fixings.FixLongitudinalReferenceFacet;
+import de.intevation.flys.artifacts.model.fixings.FixOutlierFacet;
+import de.intevation.flys.artifacts.model.fixings.FixReferenceEventsFacet;
+import de.intevation.flys.artifacts.model.fixings.FixResult;
+import de.intevation.flys.artifacts.model.fixings.FixWQCurveFacet;
+
+import de.intevation.flys.artifacts.resources.Resources;
+
+import de.intevation.flys.artifacts.states.DefaultState;
+
+import de.intevation.flys.utils.IdGenerator;
+
+import java.text.DateFormat;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+/**
+ * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
+ */
+public class FixAnalysisCompute
+extends      DefaultState
+implements   FacetTypes
+{
+    /** The log used in this class. */
+    private static Logger log = Logger.getLogger(FixAnalysisCompute.class);
+
+    private static final String I18N_REFERENCEPERIOD = "fix.reference.period.events";
+
+    private static final String I18N_ANALYSISPERIODS = "fix.analysis.periods";
+
+    private static final String I18N_DERIVATIVE = "fix.derivative";
+
+    private static final String I18N_OUTLIER = "fix.outlier";
+
+    private static final String I18N_ANALYSIS = "fix.analysis";
+
+    private static final String I18N_DEVIATION = "fix.deviation";
+
+    private static final String I18N_REFERENCEDEVIATION = "fix.reference.deviation";
+
+    public static final String [] SECTOR_LABELS = {
+        "[0 - (MNQ+MQ)/2)",
+        "[(MNQ+MQ)/2 - (MQ+MHQ)/2)",
+        "[(MQ+MHQ)/2 - HQ5)",
+        "[HQ5 - \u221e)"
+    };
+
+    /**
+     * The default constructor that initializes an empty State object.
+     */
+    public FixAnalysisCompute() {
+    }
+
+    @Override
+    public Object computeAdvance(
+        FLYSArtifact artifact,
+        String       hash,
+        CallContext  context,
+        List<Facet>  facets,
+        Object       old
+    ) {
+        log.debug("FixAnalysisCompute.computeAdvance");
+
+        CalculationResult res;
+
+        FixAnalysisAccess access =
+            new FixAnalysisAccess(artifact);
+
+        if (old instanceof CalculationResult) {
+            res = (CalculationResult)old;
+        }
+        else {
+            FixAnalysisCalculation calc = new FixAnalysisCalculation(access);
+            res = calc.calculate();
+        }
+
+        if (facets == null) {
+            return res;
+        }
+
+        if (res.getReport().hasProblems()) {
+            facets.add(new ReportFacet(ComputeType.ADVANCE, hash, id));
+        }
+
+        FixResult fr = (FixResult)res.getData();
+
+        if (fr == null) {
+            return res;
+        }
+
+        facets.add(
+            new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id));
+        facets.add(
+            new DataFacet(
+                FIX_PARAMETERS, "parameters", ComputeType.ADVANCE, hash, id));
+
+        int maxId = -100;
+
+        int sectorMask = fr.getUsedSectorsInAnalysisPeriods();
+
+        int qsS = access.getQSectorStart();
+        int qsE = access.getQSectorEnd();
+
+        // TODO: i18n
+        DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM);
+
+        DateRange [] periods = access.getAnalysisPeriods();
+
+        for (int i = 0; i < periods.length; i++) {
+            DateRange period = periods[i];
+            String startDate = df.format(period.getFrom());
+            String endDate = df.format(period.getTo());
+
+            for (int j = qsS; j <= qsE; j++) {
+
+                // Only emit facets for sectors that really have data.
+                if ((sectorMask & (1 << j)) == 0) {
+                    continue;
+                }
+
+                String sector = SECTOR_LABELS[j];
+                String description = sector + ": " +
+                                     startDate + " - " +
+                                     endDate;
+
+                int sectorNdx = j - qsS;
+                int facetNdx = i << 2;
+                facetNdx = facetNdx | j;
+
+                if (facetNdx > maxId) {
+                    maxId = facetNdx;
+                }
+
+                facets.add(
+                    new FixAvSectorFacet(
+                        facetNdx,
+                        FIX_SECTOR_AVERAGE_DWT + "_" + sectorNdx,
+                        description));
+                facets.add(
+                    new FixLongitudinalAnalysisFacet(
+                        facetNdx,
+                        FIX_SECTOR_AVERAGE_LS + "_" + sectorNdx,
+                        description));
+                // TODO: i18n
+                String dev = "Abweichung: " + description;
+                facets.add(
+                    new FixLongitudinalAnalysisFacet(
+                        facetNdx,
+                        FIX_SECTOR_AVERAGE_LS_DEVIATION + "_" + sectorNdx,
+                        dev));
+                facets.add(
+                    new FixAvSectorFacet(
+                        facetNdx,
+                        FIX_SECTOR_AVERAGE_WQ + "_" + sectorNdx,
+                        description));
+
+            }
+
+            String eventDesc =
+                Resources.getMsg(context.getMeta(),
+                                 I18N_ANALYSIS,
+                                 I18N_ANALYSIS) +
+                ": " + startDate + " - " + endDate;
+            facets.add(new FixAnalysisEventsFacet(i,
+                FIX_ANALYSIS_EVENTS_DWT,
+                eventDesc));
+            facets.add(new FixLongitudinalAnalysisFacet(i,
+                FIX_ANALYSIS_EVENTS_LS,
+                eventDesc));
+            facets.add(new FixAnalysisEventsFacet(i,
+                FIX_ANALYSIS_EVENTS_WQ,
+                eventDesc));
+        }
+
+        IdGenerator idg = new IdGenerator(maxId + 1);
+
+        String i18n_ref = Resources.getMsg(context.getMeta(),
+                I18N_REFERENCEPERIOD,
+                I18N_REFERENCEPERIOD);
+        String i18n_dev = Resources.getMsg(context.getMeta(),
+                I18N_REFERENCEDEVIATION,
+                I18N_REFERENCEDEVIATION);
+
+
+        facets.add(new FixReferenceEventsFacet(idg.next(),
+            FIX_REFERENCE_EVENTS_DWT,
+            i18n_ref));
+        facets.add(new FixLongitudinalReferenceFacet(idg.next(),
+            FIX_REFERENCE_EVENTS_LS,
+            i18n_ref));
+        facets.add(new FixReferenceEventsFacet(idg.next(),
+            FIX_REFERENCE_EVENTS_WQ,
+            i18n_ref));
+
+        facets.add(new FixLongitudinalDeviationFacet(idg.next(),
+            FIX_DEVIATION_LS,
+            i18n_dev));
+
+        String i18n_ana = Resources.getMsg(context.getMeta(),
+                I18N_ANALYSISPERIODS,
+                I18N_ANALYSISPERIODS);
+        facets.add(new FixAnalysisPeriodsFacet(idg.next(),
+            FIX_ANALYSIS_PERIODS_DWT,
+            i18n_ana));
+        facets.add(new FixAnalysisPeriodsFacet(idg.next(),
+            FIX_ANALYSIS_PERIODS_LS,
+            i18n_ana));
+        facets.add(new FixAnalysisPeriodsFacet(idg.next(),
+            FIX_ANALYSIS_PERIODS_WQ,
+            i18n_ana));
+
+
+        facets.add(new FixWQCurveFacet(idg.next(), "W/Q"));
+
+        Boolean preprocessing = access.getPreprocessing();
+
+        if (preprocessing != null && preprocessing) {
+            facets.add(new FixOutlierFacet(
+                idg.next(),
+                FIX_OUTLIER,
+                Resources.getMsg(
+                    context.getMeta(), I18N_OUTLIER, I18N_OUTLIER)));
+        }
+
+        facets.add(new FixDerivateFacet(
+            idg.next(),
+            FIX_DERIVATE,
+            Resources.getMsg(
+                context.getMeta(),
+                I18N_DERIVATIVE,
+                I18N_DERIVATIVE)));
+
+        facets.add(new FixDeviationFacet(
+            idg.next(),
+            FIX_DEVIATION_DWT,
+            Resources.getMsg(context.getMeta(),
+                I18N_DEVIATION,
+                I18N_DEVIATION)));
+        return res;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixationCompute.java	Thu Jul 19 14:11:11 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,268 +0,0 @@
-package de.intevation.flys.artifacts.states.fixation;
-
-import de.intevation.artifactdatabase.state.Facet;
-
-import de.intevation.artifacts.CallContext;
-
-import de.intevation.flys.artifacts.FLYSArtifact;
-
-import de.intevation.flys.artifacts.access.FixAnalysisAccess;
-
-import de.intevation.flys.artifacts.model.CalculationResult;
-import de.intevation.flys.artifacts.model.DataFacet;
-import de.intevation.flys.artifacts.model.DateRange;
-import de.intevation.flys.artifacts.model.FacetTypes;
-import de.intevation.flys.artifacts.model.ReportFacet;
-
-import de.intevation.flys.artifacts.model.fixings.FixAnalysisEventsFacet;
-import de.intevation.flys.artifacts.model.fixings.FixAnalysisPeriodsFacet;
-import de.intevation.flys.artifacts.model.fixings.FixAvSectorFacet;
-import de.intevation.flys.artifacts.model.fixings.FixAnalysisCalculation;
-import de.intevation.flys.artifacts.model.fixings.FixDerivateFacet;
-import de.intevation.flys.artifacts.model.fixings.FixDeviationFacet;
-import de.intevation.flys.artifacts.model.fixings.FixLongitudinalAnalysisFacet;
-import de.intevation.flys.artifacts.model.fixings.FixLongitudinalDeviationFacet;
-import de.intevation.flys.artifacts.model.fixings.FixLongitudinalReferenceFacet;
-import de.intevation.flys.artifacts.model.fixings.FixOutlierFacet;
-import de.intevation.flys.artifacts.model.fixings.FixReferenceEventsFacet;
-import de.intevation.flys.artifacts.model.fixings.FixResult;
-import de.intevation.flys.artifacts.model.fixings.FixWQCurveFacet;
-
-import de.intevation.flys.artifacts.resources.Resources;
-
-import de.intevation.flys.artifacts.states.DefaultState;
-
-import de.intevation.flys.utils.IdGenerator;
-
-import java.text.DateFormat;
-
-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
-implements   FacetTypes
-{
-    /** The log used in this class. */
-    private static Logger log = Logger.getLogger(FixationCompute.class);
-
-    private static final String I18N_REFERENCEPERIOD = "fix.reference.period.events";
-
-    private static final String I18N_ANALYSISPERIODS = "fix.analysis.periods";
-
-    private static final String I18N_DERIVATIVE = "fix.derivative";
-
-    private static final String I18N_OUTLIER = "fix.outlier";
-
-    private static final String I18N_ANALYSIS = "fix.analysis";
-
-    private static final String I18N_DEVIATION = "fix.deviation";
-
-    private static final String I18N_REFERENCEDEVIATION = "fix.reference.deviation";
-
-    public static final String [] SECTOR_LABELS = {
-        "[0 - (MNQ+MQ)/2)",
-        "[(MNQ+MQ)/2 - (MQ+MHQ)/2)",
-        "[(MQ+MHQ)/2 - HQ5)",
-        "[HQ5 - \u221e)"
-    };
-
-    /**
-     * The default constructor that initializes an empty State object.
-     */
-    public FixationCompute() {
-    }
-
-    @Override
-    public Object computeAdvance(
-        FLYSArtifact artifact,
-        String       hash,
-        CallContext  context,
-        List<Facet>  facets,
-        Object       old
-    ) {
-        log.debug("FixationCompute.computeAdvance");
-
-        CalculationResult res;
-
-        FixAnalysisAccess access =
-            new FixAnalysisAccess(artifact);
-
-        if (old instanceof CalculationResult) {
-            res = (CalculationResult)old;
-        }
-        else {
-            FixAnalysisCalculation calc = new FixAnalysisCalculation(access);
-            res = calc.calculate();
-        }
-
-        if (facets == null) {
-            return res;
-        }
-
-        if (res.getReport().hasProblems()) {
-            facets.add(new ReportFacet(ComputeType.ADVANCE, hash, id));
-        }
-
-        FixResult fr = (FixResult)res.getData();
-
-        if (fr == null) {
-            return res;
-        }
-
-        facets.add(
-            new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id));
-        facets.add(
-            new DataFacet(
-                FIX_PARAMETERS, "parameters", ComputeType.ADVANCE, hash, id));
-
-        int maxId = -100;
-
-        int sectorMask = fr.getUsedSectorsInAnalysisPeriods();
-
-        int qsS = access.getQSectorStart();
-        int qsE = access.getQSectorEnd();
-
-        // TODO: i18n
-        DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM);
-
-        DateRange [] periods = access.getAnalysisPeriods();
-
-        for (int i = 0; i < periods.length; i++) {
-            DateRange period = periods[i];
-            String startDate = df.format(period.getFrom());
-            String endDate = df.format(period.getTo());
-
-            for (int j = qsS; j <= qsE; j++) {
-
-                // Only emit facets for sectors that really have data.
-                if ((sectorMask & (1 << j)) == 0) {
-                    continue;
-                }
-
-                String sector = SECTOR_LABELS[j];
-                String description = sector + ": " +
-                                     startDate + " - " +
-                                     endDate;
-
-                int sectorNdx = j - qsS;
-                int facetNdx = i << 2;
-                facetNdx = facetNdx | j;
-
-                if (facetNdx > maxId) {
-                    maxId = facetNdx;
-                }
-
-                facets.add(
-                    new FixAvSectorFacet(
-                        facetNdx,
-                        FIX_SECTOR_AVERAGE_DWT + "_" + sectorNdx,
-                        description));
-                facets.add(
-                    new FixLongitudinalAnalysisFacet(
-                        facetNdx,
-                        FIX_SECTOR_AVERAGE_LS + "_" + sectorNdx,
-                        description));
-                // TODO: i18n
-                String dev = "Abweichung: " + description;
-                facets.add(
-                    new FixLongitudinalAnalysisFacet(
-                        facetNdx,
-                        FIX_SECTOR_AVERAGE_LS_DEVIATION + "_" + sectorNdx,
-                        dev));
-                facets.add(
-                    new FixAvSectorFacet(
-                        facetNdx,
-                        FIX_SECTOR_AVERAGE_WQ + "_" + sectorNdx,
-                        description));
-
-            }
-
-            String eventDesc =
-                Resources.getMsg(context.getMeta(),
-                                 I18N_ANALYSIS,
-                                 I18N_ANALYSIS) +
-                ": " + startDate + " - " + endDate;
-            facets.add(new FixAnalysisEventsFacet(i,
-                FIX_ANALYSIS_EVENTS_DWT,
-                eventDesc));
-            facets.add(new FixLongitudinalAnalysisFacet(i,
-                FIX_ANALYSIS_EVENTS_LS,
-                eventDesc));
-            facets.add(new FixAnalysisEventsFacet(i,
-                FIX_ANALYSIS_EVENTS_WQ,
-                eventDesc));
-        }
-
-        IdGenerator idg = new IdGenerator(maxId + 1);
-
-        String i18n_ref = Resources.getMsg(context.getMeta(),
-                I18N_REFERENCEPERIOD,
-                I18N_REFERENCEPERIOD);
-        String i18n_dev = Resources.getMsg(context.getMeta(),
-                I18N_REFERENCEDEVIATION,
-                I18N_REFERENCEDEVIATION);
-
-
-        facets.add(new FixReferenceEventsFacet(idg.next(),
-            FIX_REFERENCE_EVENTS_DWT,
-            i18n_ref));
-        facets.add(new FixLongitudinalReferenceFacet(idg.next(),
-            FIX_REFERENCE_EVENTS_LS,
-            i18n_ref));
-        facets.add(new FixReferenceEventsFacet(idg.next(),
-            FIX_REFERENCE_EVENTS_WQ,
-            i18n_ref));
-
-        facets.add(new FixLongitudinalDeviationFacet(idg.next(),
-            FIX_DEVIATION_LS,
-            i18n_dev));
-
-        String i18n_ana = Resources.getMsg(context.getMeta(),
-                I18N_ANALYSISPERIODS,
-                I18N_ANALYSISPERIODS);
-        facets.add(new FixAnalysisPeriodsFacet(idg.next(),
-            FIX_ANALYSIS_PERIODS_DWT,
-            i18n_ana));
-        facets.add(new FixAnalysisPeriodsFacet(idg.next(),
-            FIX_ANALYSIS_PERIODS_LS,
-            i18n_ana));
-        facets.add(new FixAnalysisPeriodsFacet(idg.next(),
-            FIX_ANALYSIS_PERIODS_WQ,
-            i18n_ana));
-
-
-        facets.add(new FixWQCurveFacet(idg.next(), "W/Q"));
-
-        Boolean preprocessing = access.getPreprocessing();
-
-        if (preprocessing != null && preprocessing) {
-            facets.add(new FixOutlierFacet(
-                idg.next(),
-                FIX_OUTLIER,
-                Resources.getMsg(
-                    context.getMeta(), I18N_OUTLIER, I18N_OUTLIER)));
-        }
-
-        facets.add(new FixDerivateFacet(
-            idg.next(),
-            FIX_DERIVATE,
-            Resources.getMsg(
-                context.getMeta(),
-                I18N_DERIVATIVE,
-                I18N_DERIVATIVE)));
-
-        facets.add(new FixDeviationFacet(
-            idg.next(),
-            FIX_DEVIATION_DWT,
-            Resources.getMsg(context.getMeta(),
-                I18N_DEVIATION,
-                I18N_DEVIATION)));
-        return res;
-    }
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org