annotate flys-backend/src/main/java/de/intevation/flys/importer/ImportHYKFlowZoneType.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 8aef353e54fb
children
rev   line source
1215
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.importer;
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 import de.intevation.flys.model.HYKFlowZoneType;
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5 import org.hibernate.Session;
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6 import org.hibernate.Query;
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8 import java.util.List;
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10 public class ImportHYKFlowZoneType
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11 {
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12 private String name;
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13 private HYKFlowZoneType peer;
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15 public ImportHYKFlowZoneType() {
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16 }
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18 public ImportHYKFlowZoneType(String name) {
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 this.name = name;
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20 }
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
22 public HYKFlowZoneType getPeer() {
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
23 if (peer == null) {
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24 Session session = ImporterSession.getInstance()
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25 .getDatabaseSession();
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26 Query query = session.createQuery(
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27 "from HYKFlowZoneType where name=:name");
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
28 query.setParameter("name", name);
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29 List<HYKFlowZoneType> flowZoneTypes = query.list();
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 if (flowZoneTypes.isEmpty()) {
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 peer = new HYKFlowZoneType(name);
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32 session.save(peer);
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33 }
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34 else {
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35 peer = flowZoneTypes.get(0);
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36 }
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37 }
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
38 return peer;
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39 }
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40 }
8aef353e54fb Initial version of the HYK parser. Not ready, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org