Mercurial > dive4elements > river
diff flys-backend/src/main/java/de/intevation/flys/backend/SpatialInfo.java @ 5379:61bf64b102bc mapgenfix
Merge with default branch
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Fri, 22 Mar 2013 11:25:54 +0100 |
parents | dba703edfff1 |
children |
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/backend/SpatialInfo.java Wed Mar 06 14:14:15 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/backend/SpatialInfo.java Fri Mar 22 11:25:54 2013 +0100 @@ -4,15 +4,16 @@ import org.apache.log4j.Logger; +import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; import de.intevation.flys.model.Building; import de.intevation.flys.model.CrossSectionTrack; import de.intevation.flys.model.Fixpoint; -import de.intevation.flys.model.Line; import de.intevation.flys.model.River; import de.intevation.flys.model.RiverAxis; +import de.intevation.flys.model.HWSLine; public class SpatialInfo { @@ -42,7 +43,6 @@ logger.info("Spatial information of River '" + RIVERNAME + "'"); spatial.doRiverAxisInfo(river); spatial.doCrossSectionTracksInfo(river); - spatial.doLinesInfo(river); spatial.doBuildingsInfo(river); spatial.doFixpointsInfo(river); } @@ -85,13 +85,20 @@ protected void doRiverAxisInfo(River river) { - List<RiverAxis> axis = RiverAxis.getRiverAxis(river.getName()); - if (axis != null && axis.size() > 0) { - logger.debug("TODO: Compute length and boundary."); + 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."); + } } - else { - logger.warn("River has no RiverAxis."); + catch(HibernateException iae) { + logger.warn("No vaild river axis found for " + river.getName()); + return; } + } @@ -112,23 +119,6 @@ } - protected void doLinesInfo(River river) { - Query query = session.createQuery( - "from Line where river =:river"); - query.setParameter("river", river); - - List<Line> 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."); - } - } - - protected void doBuildingsInfo(River river) { Query query = session.createQuery( "from Building where river =:river"); @@ -161,5 +151,26 @@ 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 :