Mercurial > dive4elements > river
diff backend/src/main/java/org/dive4elements/river/model/sinfo/Infrastructure.java @ 9624:02ca823ec9c6
zu Pos 20 Nachtrag; infrastructureChoice
author | dnt_bjoernsen <d.tironi@bjoernsen.de> |
---|---|
date | Fri, 11 Oct 2019 18:30:36 +0200 |
parents | 26e113e8224f |
children | 07f02019065e |
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/model/sinfo/Infrastructure.java Thu Oct 10 17:33:56 2019 +0200 +++ b/backend/src/main/java/org/dive4elements/river/model/sinfo/Infrastructure.java Fri Oct 11 18:30:36 2019 +0200 @@ -71,13 +71,11 @@ private List<InfrastructureValue> values; - /***** CONSTRUCTORS *****/ public Infrastructure() { } - public Infrastructure(final River river, final String filename, final String kmrange_info, final String notes, final AnnotationType type, final AnnotationType group, final Integer year, final String dataprovider, final String evaluation_by) { this.river = river; @@ -92,7 +90,6 @@ this.values = new ArrayList<>(); } - /***** METHODS *****/ @Id @@ -233,8 +230,8 @@ * Fetches from the database the infrastructure groups and types of a river's km range and river side(s) * as tab-separated strings ordered by the infrastructure group, then the type */ - public static Set<String> fetchInfrastructureTypes(final River river, final double kmLo, final double kmHi, - final AttributeKey riverside) { + @Deprecated + public static Set<String> fetchInfrastructureTypes(final River river, final double kmLo, final double kmHi, final AttributeKey riverside) { final Set<String> groupTypes = new HashSet<>(); for (final Infrastructure ifs : fetchInfrastructureTypeList(river, kmLo, kmHi, riverside)) groupTypes.add(ifs.getGroup().getName() + "\t" + ifs.getType().getName()); @@ -245,18 +242,13 @@ * Fetches from the database the list of infrastructure types of a river's km range and river side(s) * ordered by type group */ - private static List<Infrastructure> fetchInfrastructureTypeList(final River river, final double kmLo, final double kmHi, - final AttributeKey riverside) { + private static List<Infrastructure> fetchInfrastructureTypeList(final River river, final double kmLo, final double kmHi, final AttributeKey riverside) { final Session session = SessionHolder.HOLDER.get(); - final Query query = session.createQuery("FROM Infrastructure" - + " WHERE (river=:river)" - + " AND (id IN (SELECT v.infrastructure.id FROM InfrastructureValue v" - + " WHERE (v.station BETWEEN (:kmLo - 0.0001) AND (:kmHi + 0.0001))" - + InfrastructureValue.getRiversideClause(riverside, "v.", "attr_id") - + "))" - + " ORDER BY group, type"); + final Query query = session.createQuery("FROM Infrastructure" + " WHERE (river=:river)" + + " AND (id IN (SELECT v.infrastructure.id FROM InfrastructureValue v" + " WHERE (v.station BETWEEN (:kmLo - 0.0001) AND (:kmHi + 0.0001))" + + InfrastructureValue.getRiversideClause(riverside, "v.", "attr_id") + "))" + " ORDER BY group, type"); query.setParameter("river", river); query.setParameter("kmLo", new Double(kmLo)); query.setParameter("kmHi", new Double(kmHi));