diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java @ 722:4800230fba8a

Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet. flys-artifacts/trunk@2200 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 22 Jun 2011 10:36:27 +0000
parents 757ff56b43b3
children db68806e6563
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java	Wed Jun 22 09:19:16 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java	Wed Jun 22 10:36:27 2011 +0000
@@ -280,7 +280,7 @@
      *
      * @return the identifier of the current state.
      */
-    protected String getCurrentStateId() {
+    public String getCurrentStateId() {
         return currentStateId;
     }
 
@@ -321,6 +321,13 @@
         return engine.getState(getCurrentStateId());
     }
 
+    protected State getState(Object context, String stateID) {
+        FLYSContext flysContext = getFlysContext(context);
+        StateEngine engine      = (StateEngine) flysContext.get(
+            FLYSContext.STATE_ENGINE_KEY);
+        return engine.getState(stateID);
+    }
+
 
     /**
      * Returns the vector of previous state identifiers.
@@ -1035,7 +1042,7 @@
             Object value = entry.getValue().getValue();
 
             hash ^= ((long)key.hashCode() << shift) 
-                 |  ((long)value.hashCode() << (shift + shift));
+                 |  ((long)value.hashCode() << (shift + 3));
             shift += 2;
         }
 
@@ -1077,13 +1084,27 @@
         boolean     generateFacets
     ) {
         DefaultState current = (DefaultState) getCurrentState(context);
+        return compute(context, hash, current, type, generateFacets);
+    }
 
-        logger.debug("Create ComputeCallback for state: " + current.getID());
+    public Object compute(
+        CallContext context,
+        String      stateID,
+        String      hash,
+        ComputeType type, 
+        boolean     generateFacets
+    ) {
+        DefaultState current = stateID == null
+            ? (DefaultState)getCurrentState(context)
+            : (DefaultState)getState(context, stateID);
+
+        if (hash == null) {
+            hash = hash();
+        }
 
         return compute(context, hash, current, type, generateFacets);
     }
 
-
     public Object compute(
         CallContext   context,
         String        key,

http://dive4elements.wald.intevation.org