Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/model/CrossSectionFactory.java @ 6538:de62db0f2035
issue1157: Let CrossSection be able to find out whether it should be active & master.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 04 Jul 2013 11:52:06 +0200 |
parents | af13ceeba52a |
children | 675fa2d16544 |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/CrossSectionFactory.java Thu Jul 04 11:48:33 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/CrossSectionFactory.java Thu Jul 04 11:52:06 2013 +0200 @@ -59,30 +59,6 @@ } - /** - * True if the given section is the "newest" for that river. - * @param section Given section - * @return true if the section has the most advanced end of its validity interval - * or the most advanced start of its validity interval. - */ - public static boolean isNewest(CrossSection section) { - Session session = SessionHolder.HOLDER.get(); - Query query = session.createQuery( - "from CrossSection where river.id = :riverid " - + " order by timeInterval.stopTime desc, timeInterval.startTime desc"); - query.setParameter("riverid", section.getRiver().getId()); - - List result = query.list(); - - if (result == null || result.isEmpty()) { - return true; - } - else { - CrossSection cs = (CrossSection) result.get(0); - return section.getId().equals(cs.getId()); - } - } - /** * Get a specific CrossSection from db.