changeset 5690:b85df73edef0

merge
author Tom Gottfried <tom.gottfried@intevation.de>
date Fri, 12 Apr 2013 19:52:15 +0200
parents a3f7da9bf0d1 (diff) 7b6cca32f940 (current diff)
children dc2daadbdd0c
files
diffstat 2 files changed, 22 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityModel.java	Fri Apr 12 19:18:02 2013 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityModel.java	Fri Apr 12 19:52:15 2013 +0200
@@ -30,6 +30,12 @@
         values = new ArrayList<ImportFlowVelocityModelValue>();
     }
 
+    public ImportFlowVelocityModel(String description) {
+        this();
+
+        this.description = description;
+    }
+
     public ImportFlowVelocityModel(ImportDischargeZone dischargeZone,
         String description) {
         this();
@@ -84,14 +90,12 @@
             Query query = session.createQuery("from FlowVelocityModel where "
                 + "   dischargeZone=:dischargeZone");
 
-            //query.setParameter("river", river);
             query.setParameter("dischargeZone", zone);
 
             List<FlowVelocityModel> model = query.list();
 
             if (model.isEmpty()) {
-                //peer = new FlowVelocityModel(river, zone);
-                peer = new FlowVelocityModel(zone);
+                peer = new FlowVelocityModel(zone, description);
                 session.save(peer);
             }
             else {
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/FlowVelocityModelParser.java	Fri Apr 12 19:18:02 2013 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/FlowVelocityModelParser.java	Fri Apr 12 19:52:15 2013 +0200
@@ -1,5 +1,8 @@
 package de.intevation.flys.importer.parsers;
 
+import java.io.File;
+import java.io.IOException;
+
 import java.math.BigDecimal;
 import java.text.NumberFormat;
 import java.text.ParseException;
@@ -49,6 +52,8 @@
 
     private ImportFlowVelocityModel current;
 
+    protected String description;
+
 
     public FlowVelocityModelParser() {
         models = new ArrayList<ImportFlowVelocityModel>();
@@ -60,14 +65,23 @@
     }
 
     @Override
+    public void parse(File file) throws IOException {
+        description = file.getName();
+
+        super.parse(file);
+    }
+
+    @Override
     protected void reset() {
-        current = new ImportFlowVelocityModel();
+        current = new ImportFlowVelocityModel(description);
     }
 
 
     @Override
     protected void finish() {
         models.add(current);
+
+	//	description = null;
     }
 
 

http://dive4elements.wald.intevation.org