annotate backend/src/main/java/org/dive4elements/river/importer/ImportSedimentLoadLSValue.java @ 8025:c915e99d9e52

Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
author Sascha L. Teichmann <teichmann@intevation.de>
date Wed, 09 Jul 2014 18:13:13 +0200
parents
children fd3a24336e6a
rev   line source
8025
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
3 *
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
6 * documentation coming with Dive4Elements River for details.
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
7 */
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
8
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
9 package org.dive4elements.river.importer;
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
10
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
11 import java.util.List;
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
12
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
13 import org.hibernate.Session;
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
14 import org.hibernate.Query;
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
15
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
16 import org.dive4elements.river.model.SedimentLoadLS;
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
17 import org.dive4elements.river.model.SedimentLoadLSValue;
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
18
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
19
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
20 public class ImportSedimentLoadLSValue {
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
21
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
22 private Double station;
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
23 private Double value;
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
24
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
25 private SedimentLoadLSValue peer;
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
26
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
27
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
28 public ImportSedimentLoadLSValue(Double station, Double value) {
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
29 this.station = station;
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
30 this.value = value;
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
31 }
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
32
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
33
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
34 public void storeDependencies(SedimentLoadLS sedimentYield) {
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
35 getPeer(sedimentYield);
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
36 }
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
37
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
38
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
39 public SedimentLoadLSValue getPeer(SedimentLoadLS sedimentYield) {
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
40 if (peer == null) {
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
41 Session session = ImporterSession.getInstance().getDatabaseSession();
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
42 Query query = session.createQuery(
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
43 "from SedimentYieldValue where " +
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
44 " sedimentYield=:sedimentYield and " +
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
45 " station=:station and " +
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
46 " value=:value"
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
47 );
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
48
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
49 query.setParameter("sedimentYield", sedimentYield);
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
50 query.setParameter("station", station);
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
51 query.setParameter("value", value);
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
52
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
53 List<SedimentLoadLSValue> values = query.list();
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
54 if (values.isEmpty()) {
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
55 peer = new SedimentLoadLSValue(sedimentYield, station, value);
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
56 session.save(peer);
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
57 }
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
58 else {
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
59 peer = values.get(0);
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
60 }
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
61 }
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
62
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
63 return peer;
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
64 }
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
65 }
c915e99d9e52 Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
66 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org