Mercurial > dive4elements > river
changeset 8569:26c7aa469bfc
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.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 26 Feb 2015 15:52:04 +0100 |
parents | 078b07a94023 |
children | 1655588ed479 |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/model/StaticWQKmsCacheKey.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/WKmsFactory.java |
diffstat | 2 files changed, 42 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- /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 :
--- 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);