Mercurial > dive4elements > river
changeset 8184:143b24546b26
Remove dead class.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 04 Sep 2014 12:00:17 +0200 |
parents | baa7df019df3 |
children | 76e1e9d81ce2 |
files | backend/src/main/java/org/dive4elements/river/backend/SpatialInfo.java |
diffstat | 1 files changed, 0 insertions(+), 184 deletions(-) [+] |
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/backend/SpatialInfo.java Thu Sep 04 11:15:34 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +0,0 @@ -/* 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.backend; - -import java.util.List; - -import org.apache.log4j.Logger; - -import org.hibernate.HibernateException; -import org.hibernate.Query; -import org.hibernate.Session; - -import org.dive4elements.river.model.Building; -import org.dive4elements.river.model.CrossSectionTrack; -import org.dive4elements.river.model.Fixpoint; -import org.dive4elements.river.model.River; -import org.dive4elements.river.model.RiverAxis; -import org.dive4elements.river.model.HWSLine; - - -public class SpatialInfo { - - private static Logger logger = Logger.getLogger(SpatialInfo.class); - - protected static String RIVERNAME = System.getProperty( - "flys.backend.spatial.river", "Saar"); - - protected Session session; - - - public static void main(String[] args) { - logger.info("Start SpatialInfo application."); - - SpatialInfo spatial = null; - - try { - spatial = new SpatialInfo(); - - River river = spatial.getRiver(RIVERNAME); - if (river == null) { - logger.warn("Could not find river '" + RIVERNAME + "'!"); - return; - } - - logger.info("Spatial information of River '" + RIVERNAME + "'"); - spatial.doRiverAxisInfo(river); - spatial.doCrossSectionTracksInfo(river); - spatial.doBuildingsInfo(river); - spatial.doFixpointsInfo(river); - } - finally { - if (spatial != null) { - spatial.close(); - } - } - - logger.info("Finish SpatialInfo application."); - } - - - public SpatialInfo() { - session = SessionFactoryProvider - .createSessionFactory() - .openSession(); - } - - - public void close() { - session.close(); - } - - - protected River getRiver(String rivername) { - Query query = session.createQuery( - "from River where name =:name"); - query.setParameter("name", rivername); - - List<River> list = query.list(); - - if (list == null || list.size() == 0) { - logger.warn("No river '" + rivername + "' found!"); - return null; - } - - return list.get(0); - } - - - protected void doRiverAxisInfo(River river) { - try { - List<RiverAxis> axis = RiverAxis.getRiverAxis(river.getName()); - if (axis != null && axis.size() > 0) { - logger.debug("TODO: Compute length and boundary."); - } - else { - logger.warn("River has no RiverAxis."); - } - } - catch(HibernateException iae) { - logger.warn("No vaild river axis found for " + river.getName()); - return; - } - - } - - - protected void doCrossSectionTracksInfo(River river) { - Query query = session.createQuery( - "from CrossSectionTrack where river =:river"); - query.setParameter("river", river); - - List<CrossSectionTrack> list = query.list(); - - if (list == null || list.size() == 0) { - logger.warn("No CrossSectionTracks for '" + river.getName() + "' found!"); - return; - } - else { - logger.info("River contains " + list.size() + " CrossSectionTracks."); - } - } - - - protected void doBuildingsInfo(River river) { - Query query = session.createQuery( - "from Building where river =:river"); - query.setParameter("river", river); - - List<Building> list = query.list(); - - if (list == null || list.size() == 0) { - logger.warn("No Buildings for '" + river.getName() + "' found!"); - return; - } - else { - logger.info("River contains " + list.size() + " Buildings."); - } - } - - - protected void doFixpointsInfo(River river) { - Query query = session.createQuery( - "from Fixpoint where river =:river"); - query.setParameter("river", river); - - List<Fixpoint> list = query.list(); - - if (list == null || list.size() == 0) { - logger.warn("No Fixpoints for '" + river.getName() + "' found!"); - return; - } - else { - logger.info("River contains " + list.size() + " Fixpoints."); - } - } - - @Deprecated - protected void doLinesInfo(River river) { - doHWSLinesInfo(river); - } - - protected void doHWSLinesInfo(River river) { - Query query = session.createQuery( - "from hws_lines where river =:river"); - query.setParameter("river", river); - - List<HWSLine> list = query.list(); - - if (list == null || list.size() == 0) { - logger.warn("No Lines for '" + river.getName() + "' found!"); - return; - } - else { - logger.info("River contains " + list.size() + " Lines."); - } - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :