Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityModel.java @ 5689:a3f7da9bf0d1
Set description when importing flow velocity models
author | Tom Gottfried <tom.gottfried@intevation.de> |
---|---|
date | Fri, 12 Apr 2013 19:51:44 +0200 |
parents | 3bd786772798 |
children |
comparison
equal
deleted
inserted
replaced
5683:545a6ace9a19 | 5689:a3f7da9bf0d1 |
---|---|
26 | 26 |
27 private FlowVelocityModel peer; | 27 private FlowVelocityModel peer; |
28 | 28 |
29 public ImportFlowVelocityModel() { | 29 public ImportFlowVelocityModel() { |
30 values = new ArrayList<ImportFlowVelocityModelValue>(); | 30 values = new ArrayList<ImportFlowVelocityModelValue>(); |
31 } | |
32 | |
33 public ImportFlowVelocityModel(String description) { | |
34 this(); | |
35 | |
36 this.description = description; | |
31 } | 37 } |
32 | 38 |
33 public ImportFlowVelocityModel(ImportDischargeZone dischargeZone, | 39 public ImportFlowVelocityModel(ImportDischargeZone dischargeZone, |
34 String description) { | 40 String description) { |
35 this(); | 41 this(); |
82 DischargeZone zone = dischargeZone.getPeer(river); | 88 DischargeZone zone = dischargeZone.getPeer(river); |
83 | 89 |
84 Query query = session.createQuery("from FlowVelocityModel where " | 90 Query query = session.createQuery("from FlowVelocityModel where " |
85 + " dischargeZone=:dischargeZone"); | 91 + " dischargeZone=:dischargeZone"); |
86 | 92 |
87 //query.setParameter("river", river); | |
88 query.setParameter("dischargeZone", zone); | 93 query.setParameter("dischargeZone", zone); |
89 | 94 |
90 List<FlowVelocityModel> model = query.list(); | 95 List<FlowVelocityModel> model = query.list(); |
91 | 96 |
92 if (model.isEmpty()) { | 97 if (model.isEmpty()) { |
93 //peer = new FlowVelocityModel(river, zone); | 98 peer = new FlowVelocityModel(zone, description); |
94 peer = new FlowVelocityModel(zone); | |
95 session.save(peer); | 99 session.save(peer); |
96 } | 100 } |
97 else { | 101 else { |
98 peer = model.get(0); | 102 peer = model.get(0); |
99 } | 103 } |