[PATCH 2 of 5] issue1658: Do not store Access in State

Wald Commits scm-commit at wald.intevation.org
Thu Nov 7 09:47:12 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1383813739 -3600
# Node ID d2867dc7963f7ef3af46a785c212111ecca74455
# Parent  d828b659a5936566d6570e048a9949e6ae9f19ae
issue1658: Do not store Access in State.

diff -r d828b659a593 -r d2867dc7963f artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadCalculate.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadCalculate.java	Thu Nov 07 09:03:34 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadCalculate.java	Thu Nov 07 09:42:19 2013 +0100
@@ -54,8 +54,6 @@
     public static final String I18N_FACET_SEDIMENTLOAD_TOTAL_LOAD = "facet.sedimentload.total_load";
     public static final String I18N_FACET_SEDIMENTLOAD_TOTAL = "facet.sedimentload.total";
 
-    private transient SedimentLoadAccess access;
-
     static {
         // Active/deactivate facets.
         FacetActivity.Registry.getInstance().register(
@@ -133,9 +131,7 @@
 
         List<Facet> newFacets = new ArrayList<Facet>();
 
-        if (access == null) {
-            access = new SedimentLoadAccess(artifact);
-        }
+        SedimentLoadAccess access = new SedimentLoadAccess(artifact);
 
         CalculationResult res = old instanceof CalculationResult ? (CalculationResult) old
             : new SedimentLoadCalculation().calculate(access);
@@ -153,13 +149,13 @@
 
         String type = access.getYearEpoch();
         if (type.equals("year")) {
-            generateYearFacets(context, newFacets, results, getID(), hash);
+            generateYearFacets(context, newFacets, results, getID(), hash, access);
         }
         else if (type.equals("epoch")) {
-            generateEpochFacets(context, newFacets, results, getID(), hash);
+            generateEpochFacets(context, newFacets, results, getID(), hash, access);
         }
         else if (type.equals("off_epoch")) {
-            generateOffEpochFacets(context, newFacets, results, getID(), hash);
+            generateOffEpochFacets(context, newFacets, results, getID(), hash, access);
         }
         logger.debug("Created " + newFacets.size() + " new Facets.");
 
@@ -199,7 +195,10 @@
 
     protected void generateYearFacets(CallContext context,
         List<Facet> newFacets,
-        SedimentLoadResult[] results, String stateId, String hash
+        SedimentLoadResult[] results,
+        String stateId,
+        String hash,
+        SedimentLoadAccess access
     ) {
         logger.debug("SedimentLoadCalculate.generateFacets " + access.getUnit());
 
@@ -330,7 +329,8 @@
         List<Facet> newFacets,
         SedimentLoadResult[] results,
         String stateId,
-        String hash
+        String hash,
+        SedimentLoadAccess access
     ) {
         logger.debug("SedimentLoadCalculate.generateEpochFacets ");
 
@@ -471,7 +471,8 @@
         List<Facet> newFacets,
         SedimentLoadResult[] results,
         String stateId,
-        String hash
+        String hash,
+        SedimentLoadAccess access
     ) {
         logger.debug("SedimentLoadCalculate.generateOffEpochFacets");
 


More information about the Dive4elements-commits mailing list