Mercurial > dive4elements > river
view flys-backend/src/main/java/de/intevation/flys/importer/ImportHYKFlowZone.java @ 4198:1cdbd8a0c994
Added two new tables ClickableQDTable and ClickableWTable and made Ws and Qs clickable in historical discharge calculation.
The new tables define listener interfaces (clicked lower or upper icon) to listen to user clicks.
In addition to this, there is an enum ClickMode with NONE, SINGLE and RANGE options, which allows to
specifiy, which icons are displayed in the tables. NONE means no icon for user clicks, SINGLE has 1
icon, RANGE 2 icons for lower and upper.
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 22 Oct 2012 13:31:25 +0200 |
parents | 2ae732e2c65c |
children |
line wrap: on
line source
package de.intevation.flys.importer; import de.intevation.flys.model.HYKFormation; import de.intevation.flys.model.HYKFlowZone; import de.intevation.flys.model.HYKFlowZoneType; import org.hibernate.Session; import org.hibernate.Query; import java.util.List; import java.math.BigDecimal; public class ImportHYKFlowZone { protected ImportHYKFormation formation; protected ImportHYKFlowZoneType type; protected BigDecimal a; protected BigDecimal b; protected HYKFlowZone peer; public ImportHYKFlowZone() { } public ImportHYKFlowZone( ImportHYKFormation formation, ImportHYKFlowZoneType type, BigDecimal a, BigDecimal b ) { this.formation = formation; this.type = type; this.a = a; this.b = b; } public ImportHYKFormation getFormation() { return formation; } public void setFormation(ImportHYKFormation formation) { this.formation = formation; } public void storeDependencies() { getPeer(); } public HYKFlowZone getPeer() { if (peer == null) { HYKFormation f = formation.getPeer(); HYKFlowZoneType t = type.getPeer(); Session session = ImporterSession.getInstance() .getDatabaseSession(); Query query = session.createQuery( "from HYKFlowZone where formation=:formation " + "and type=:type and a=:a and b=:b"); query.setParameter("formation", f); query.setParameter("type", t); query.setParameter("a", a); query.setParameter("b", b); List<HYKFlowZone> zones = query.list(); if (zones.isEmpty()) { peer = new HYKFlowZone(f, t, a, b); session.save(peer); } else { peer = zones.get(0); } } return peer; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :