changeset 7529:d2867dc7963f

issue1658: Do not store Access in State.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 07 Nov 2013 09:42:19 +0100
parents d828b659a593
children b60485a58d73
files artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadCalculate.java
diffstat 1 files changed, 12 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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");
 

http://dive4elements.wald.intevation.org