Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/AnnotationArtifact.java @ 2144:a4bdf7d8527e
Use FastAnnotations for LocationProvider.
flys-artifacts/trunk@3723 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 19 Jan 2012 13:43:58 +0000 |
parents | 2d0b22602fc2 |
children | 5642a83420f2 |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/AnnotationArtifact.java Thu Jan 19 13:09:00 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/AnnotationArtifact.java Thu Jan 19 13:43:58 2012 +0000 @@ -8,8 +8,6 @@ import org.apache.log4j.Logger; -import net.sf.ehcache.Cache; - import de.intevation.artifacts.Artifact; import de.intevation.artifacts.ArtifactNamespaceContext; import de.intevation.artifacts.CallContext; @@ -24,11 +22,7 @@ import de.intevation.artifacts.common.utils.XMLUtils; import de.intevation.flys.artifacts.states.DefaultState; -import de.intevation.flys.artifacts.cache.CacheFactory; import de.intevation.flys.artifacts.context.FLYSContext; -import de.intevation.flys.artifacts.model.AnnotationsFactory; - -import de.intevation.flys.model.Annotation; import de.intevation.flys.utils.FLYSUtils; @@ -43,9 +37,6 @@ /** The name of the artifact. */ public static final String ARTIFACT_NAME = "annotation"; - /** Name of cache. */ - public static final String CACHE_NAME = "annotations"; - /** Get river, setup Facets. */ @Override protected void initialize(Artifact artifact, Object context, @@ -218,58 +209,5 @@ // state is not valid, so we do not append its outputs. } } - - - /** - * Get Annotations for Points (opposed to segments) in river in range. - * - * @return list of Annotations. - */ - public List<Annotation> getAnnotations() { - String river = FLYSUtils.getRiver(this).getName(); - logger.debug("Search annotations for river: " + river); - - Cache cache = CacheFactory.getCache(CACHE_NAME); - String key = river; - Object old = null; - - if (cache != null) { - logger.debug("We are using a cache for annotations."); - - net.sf.ehcache.Element element = cache.get(key); - if (element != null) { - logger.info("Fetched annotations from cache."); - old = element.getValue(); - } - } - - if (old == null) { - old = getAnnotationsUncached(river); - } - - if (cache != null && old != null) { - cache.put(new net.sf.ehcache.Element(key, old)); - } - - return old != null - ? (List<Annotation>) old - : new ArrayList<Annotation>(); - } - - - /** - * Gets Annotations from Session/Database. - * - * @return List of Annotations fetched fresh from session/database. - * @see DistanceInfoService to access cached documents. - */ - protected List<Annotation> getAnnotationsUncached(String river) { - logger.info("Fetch annotations from database."); - - List<Annotation> annotations = new ArrayList<Annotation>(); - annotations = AnnotationsFactory.getPointAnnotations(river); - - return annotations; - } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :