comparison flys-backend/src/main/java/de/intevation/flys/importer/ImportSedimentDensityValue.java @ 4524:be9e28cff0c4

Parse and store year in sediment densities. * Year is parsed ('guessed') from description column in .csv file.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 14 Nov 2012 17:24:55 +0100
parents 8979f2294af9
children db6c7268b08e
comparison
equal deleted inserted replaced
4523:504cd5801785 4524:be9e28cff0c4
23 23
24 protected BigDecimal station; 24 protected BigDecimal station;
25 25
26 protected BigDecimal density; 26 protected BigDecimal density;
27 27
28 private BigDecimal year;
29
28 protected String description; 30 protected String description;
29 31
30 32
31 public ImportSedimentDensityValue( 33 public ImportSedimentDensityValue(
32 BigDecimal station, 34 BigDecimal station,
33 BigDecimal density, 35 BigDecimal density,
36 BigDecimal year,
34 String description 37 String description
35 ) { 38 ) {
36 this.station = station; 39 this.station = station;
37 this.density = density; 40 this.density = density;
41 this.year = year;
38 this.description = description; 42 this.description = description;
39 } 43 }
40 44
41 45
42 public void storeDependencies(SedimentDensity sedimentDensity) { 46 public void storeDependencies(SedimentDensity sedimentDensity) {
55 Query query = session.createQuery( 59 Query query = session.createQuery(
56 "from SedimentDensityValue where " + 60 "from SedimentDensityValue where " +
57 " sedimentDensity=:sedimentDensity and " + 61 " sedimentDensity=:sedimentDensity and " +
58 " station=:station and " + 62 " station=:station and " +
59 " density=:density and " + 63 " density=:density and " +
64 " year=:year and " +
60 " description=:description"); 65 " description=:description");
61 66
62 query.setParameter("sedimentDensity", sedimentDensity); 67 query.setParameter("sedimentDensity", sedimentDensity);
63 query.setParameter("station", station); 68 query.setParameter("station", station);
64 query.setParameter("density", density); 69 query.setParameter("density", density);
70 query.setParameter("year", year);
65 query.setParameter("description", description); 71 query.setParameter("description", description);
66 72
67 List<SedimentDensityValue> values = query.list(); 73 List<SedimentDensityValue> values = query.list();
68 if (values.isEmpty()) { 74 if (values.isEmpty()) {
69 log.debug("Create new SedimentDensityValue DB instance."); 75 log.debug("Create new SedimentDensityValue DB instance.");
70 76
71 peer = new SedimentDensityValue( 77 peer = new SedimentDensityValue(
72 sedimentDensity, 78 sedimentDensity,
73 station, 79 station,
74 density, 80 density,
81 year,
75 description); 82 description);
76 83
77 session.save(peer); 84 session.save(peer);
78 } 85 }
79 else { 86 else {

http://dive4elements.wald.intevation.org