Mercurial > dive4elements > river
changeset 8406:6ae0c5116d58
Distinguish between types of measurement stations and filter appropriately (plus minor cleanup in related classes).
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Tue, 14 Oct 2014 12:41:37 +0200 |
parents | a779ee47aa79 |
children | f1f6e32156a6 |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/model/AnnotationFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/services/DistanceInfoService.java artifacts/src/main/java/org/dive4elements/river/artifacts/states/AnnotationRiverState.java artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeDischargeState.java backend/doc/annotation-types.xml backend/src/main/java/org/dive4elements/river/model/FastAnnotations.java |
diffstat | 6 files changed, 13 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/AnnotationFacet.java Mon Oct 13 17:22:52 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/AnnotationFacet.java Tue Oct 14 12:41:37 2014 +0200 @@ -12,8 +12,6 @@ import java.util.Iterator; import java.util.List; -import org.apache.log4j.Logger; - import org.dive4elements.artifacts.Artifact; import org.dive4elements.artifacts.CallContext; @@ -39,10 +37,6 @@ public class AnnotationFacet extends DefaultFacet { - /** Logger for this class. */ - private static final Logger log = Logger.getLogger(AnnotationFacet.class); - - /** * Trivial Constructor. */
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/services/DistanceInfoService.java Mon Oct 13 17:22:52 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/services/DistanceInfoService.java Tue Oct 14 12:41:37 2014 +0200 @@ -98,7 +98,7 @@ if ("locations".equals(name)) return FastAnnotations.IS_POINT; if ("distances".equals(name)) return FastAnnotations.IS_RANGE; if ("measuringpoint".equals(name)) - return new FastAnnotations.NameFilter("Messstelle"); + return new FastAnnotations.NameFilter(".*[Mm]essstelle"); } return FastAnnotations.ALL;
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/AnnotationRiverState.java Mon Oct 13 17:22:52 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/AnnotationRiverState.java Tue Oct 14 12:41:37 2014 +0200 @@ -64,7 +64,7 @@ String facetName = annotationArtifact.getFilterName(); if (facetName == null) { - facetName = Resources.getMsg(meta, I18N_DESCRIPTION, I18N_DESCRIPTION); + facetName = Resources.getMsg(meta, I18N_DESCRIPTION); } AnnotationFacet facet = new AnnotationFacet(
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeDischargeState.java Mon Oct 13 17:22:52 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeDischargeState.java Tue Oct 14 12:41:37 2014 +0200 @@ -99,7 +99,7 @@ * @param hash Ignored. * @param context Ignored. * @param meta CallMeta to be used for internationalization. - * @param facets List to add AnnotationFacet to. + * @param facets List to add Facet to. * * @return null. */
--- a/backend/doc/annotation-types.xml Mon Oct 13 17:22:52 2014 +0200 +++ b/backend/doc/annotation-types.xml Tue Oct 14 12:41:37 2014 +0200 @@ -15,6 +15,8 @@ <type name="Landkreis"/> <type name="Meldestelle"/> <type name="Messstelle"/> + <type name="Geschiebemessstelle"/> + <type name="Schwebstoffmessstelle"/> <type name="Pegel"/> <type name="Stauwehr"/> <type name="Staatsgrenze"/> @@ -54,8 +56,10 @@ <line pattern="^Landkreis[:\s].*$" type="Landkreis"/> <line pattern="^Meldestelle[:\s].*$" type="Meldestelle"/> <line pattern="^Messstelle[:\s].*$" type="Messstelle"/> - <line pattern="^Geschiebemessstelle[:\s].*$" type="Messstelle"/> - <line pattern="^Schwebstoffmessstelle[:\s].*$" type="Messstelle"/> + <line pattern="^Geschiebemessstelle[:\s].*$" + type="Geschiebemessstelle"/> + <line pattern="^Schwebstoffmessstelle[:\s].*$" + type="Schwebstoffmessstelle"/> <line pattern="^Pegel[:\s].*$" type="Pegel"/> <line pattern="^Staatsgrenze[:\s].*$" type="Staatsgrenze"/> <line pattern="^Staat[:\s].*$" type="Staat"/>
--- a/backend/src/main/java/org/dive4elements/river/model/FastAnnotations.java Mon Oct 13 17:22:52 2014 +0200 +++ b/backend/src/main/java/org/dive4elements/river/model/FastAnnotations.java Tue Oct 14 12:41:37 2014 +0200 @@ -15,6 +15,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.NoSuchElementException; +import java.util.regex.Pattern; import java.io.Serializable; @@ -160,15 +161,15 @@ public static class NameFilter implements Filter { - private String name; + private Pattern namePattern; public NameFilter(String name) { - this.name = name; + this.namePattern = Pattern.compile(name); } @Override public boolean accept(Annotation annotation) { - return annotation.getName().contains(name); + return namePattern.matcher(annotation.getName()).matches(); } } // class NameFilter