[PATCH 39 of 45] Readd StaticWQKmsCacheKey and use it again

Wald Commits scm-commit at wald.intevation.org
Tue Mar 10 17:06:07 CET 2015


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1424962324 -3600
# Node ID 26c7aa469bfcd7cfec11a01ccceb78c90811bb40
# Parent  078b07a940239d3c9b818e5aec3f477c031cfcf5
Readd StaticWQKmsCacheKey and use it again.

    This class was removed under the assumption that it only
    wrapped the Cache Key but the WQKmsfactory also uses this.

diff -r 078b07a94023 -r 26c7aa469bfc artifacts/src/main/java/org/dive4elements/river/artifacts/model/StaticWQKmsCacheKey.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/StaticWQKmsCacheKey.java	Thu Feb 26 15:52:04 2015 +0100
@@ -0,0 +1,41 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts.model;
+
+import java.io.Serializable;
+
+/**
+ * Caching-Key object for 'static' wst- data.
+ */
+public final class StaticWQKmsCacheKey
+implements         Serializable
+{
+    public static final String CACHE_NAME = "wst-wq-value-table-static";
+
+    private int column;
+    private int wst_id;
+
+    public StaticWQKmsCacheKey(int column, int wst_id) {
+        this.wst_id  = wst_id;
+        this.column  = column;
+    }
+
+    public int hashCode() {
+        return (wst_id << 8) | column;
+    }
+
+    public boolean equals(Object other) {
+        if (!(other instanceof StaticWQKmsCacheKey)) {
+            return false;
+        }
+        StaticWQKmsCacheKey o = (StaticWQKmsCacheKey) other;
+        return this.wst_id == o.wst_id && this.column == o.column;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r 078b07a94023 -r 26c7aa469bfc artifacts/src/main/java/org/dive4elements/river/artifacts/model/WKmsFactory.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WKmsFactory.java	Thu Feb 26 15:37:03 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WKmsFactory.java	Thu Feb 26 15:52:04 2015 +0100
@@ -89,7 +89,7 @@
 
     public static WKms getWKms(int column, int wst_id, double from, double to) {
         log.debug("WKmsFactory.getWKms");
-        Cache cache = CacheFactory.getCache("wst-wq-value-table-static");
+        Cache cache = CacheFactory.getCache(StaticWQKmsCacheKey.CACHE_NAME);
 
         String cacheKey = Integer.toString(column) + ":" + Integer.toString(wst_id);
 


More information about the Dive4Elements-commits mailing list