[PATCH] merged changes from default into double-precision branch

Wald Commits scm-commit at wald.intevation.org
Fri Jun 28 17:03:52 CEST 2013


# HG changeset patch
# User Tom Gottfried <tom.gottfried at intevation.de>
# Date 1372431828 -7200
# Branch double-precision
# Node ID 128ab9169db1f9cc0d4d8d75db1cd1360c09abb8
# Parent  9daf7c9cf663c6863b608ee0fd5c2b855b2fc222
# Parent  7664ab97b4c7f8aeaedcd2caeaf7445f72bf8111
merged changes from default into double-precision branch

diff -r 9daf7c9cf663 -r 128ab9169db1 backend/src/main/java/org/dive4elements/river/importer/ImportWstColumn.java
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportWstColumn.java	Fri Jun 28 16:59:07 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/ImportWstColumn.java	Fri Jun 28 17:03:48 2013 +0200
@@ -33,6 +33,7 @@
     protected String    name;
     protected String    description;
     protected Integer   position;
+    protected String    source;
 
     protected ImportTimeInterval timeInterval;
 
@@ -50,7 +51,8 @@
         ImportWst wst,
         String    name,
         String    description,
-        Integer   position
+        Integer   position,
+        String    source
     ) {
         this();
         this.wst         = wst;
@@ -59,6 +61,15 @@
         this.position    = position;
     }
 
+    public ImportWstColumn(
+        ImportWst wst,
+        String    name,
+        String    description,
+        Integer   position
+    ) {
+        this(wst, name, description, position, null);
+    }
+
     public ImportWst getWst() {
         return wst;
     }
@@ -91,6 +102,14 @@
         this.position = position;
     }
 
+    public String getSource() {
+        return source;
+    }
+
+    public void setSource(String source) {
+        this.source = source;
+    }
+
     public void addColumnValue(BigDecimal position, BigDecimal w) {
         columnValues.add(
             new ImportWstColumnValue(this, position, w));
@@ -135,12 +154,14 @@
             Wst w = wst.getPeer(river);
             Session session = ImporterSession.getInstance().getDatabaseSession();
             Query query = session.createQuery(
-                "from WstColumn where " +
-                "wst=:wst and name=:name " +
+                "from WstColumn where" +
+                " wst=:wst and name=:name" +
+                " and source=:source" + 
                 " and position=:position");
-            query.setParameter("wst",         w);
-            query.setParameter("name",        name);
-            query.setParameter("position",    position);
+            query.setParameter("wst",      w);
+            query.setParameter("name",     name);
+            query.setParameter("position", position);
+            query.setParameter("source",   source);
 
             TimeInterval ti = timeInterval != null
                 ? timeInterval.getPeer()
@@ -148,7 +169,8 @@
 
             List<WstColumn> columns = query.list();
             if (columns.isEmpty()) {
-                peer = new WstColumn(w, name, description, position, ti);
+                peer = new WstColumn(
+                    w, name, description, source, position, ti);
                 session.save(peer);
             }
             else {
diff -r 9daf7c9cf663 -r 128ab9169db1 backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java	Fri Jun 28 16:59:07 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java	Fri Jun 28 17:03:48 2013 +0200
@@ -116,7 +116,7 @@
             String [] lsBezeichner   = null;
             String [] langBezeichner = null;
             int    [] colNaWidths    = null;
-            // String [] quellen        = null;
+            String [] quellen        = null;
             String [] daten          = null;
 
             BigDecimal [] aktAbfluesse   = null;
@@ -220,7 +220,7 @@
                         if (spezial.length() == 0) {
                             continue;
                         }
-                        // quellen = StringUtil.splitQuoted(spezial, '"');
+                        quellen = StringUtil.splitQuoted(spezial, '"');
                     }
                     else if (spezial.startsWith(COLUMN_DATUM)) {
                         spezial = spezial.substring(COLUMN_DATUM.length()).trim();
@@ -283,6 +283,9 @@
                             }
                             ImportWstColumn iwc = wst.getColumn(i);
                             iwc.setName(candidate);
+                            if (quellen != null && i < quellen.length) {
+                                iwc.setSource(quellen[i]);
+                            }
                             String potentialDate = daten != null && i < daten.length
                                 ? daten[i]
                                 : candidate;
diff -r 9daf7c9cf663 -r 128ab9169db1 backend/src/main/java/org/dive4elements/river/model/WstColumn.java
--- a/backend/src/main/java/org/dive4elements/river/model/WstColumn.java	Fri Jun 28 16:59:07 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/model/WstColumn.java	Fri Jun 28 17:03:48 2013 +0200
@@ -32,6 +32,7 @@
     private Wst                   wst;
     private String                name;
     private String                description;
+    private String                source;
     private Integer               position;
     private TimeInterval          timeInterval;
 
@@ -45,12 +46,14 @@
         Wst          wst,
         String       name,
         String       description,
+        String       source,
         Integer      position,
         TimeInterval timeInterval
     ) {
         this.wst          = wst;
         this.name         = name;
         this.description  = description;
+        this.source       = source;
         this.position     = position;
         this.timeInterval = timeInterval;
     }
@@ -91,6 +94,15 @@
         this.name = name;
     }
 
+    @Column(name = "source")
+    public String getSource() {
+        return description;
+    }
+
+    public void setSource(String source) {
+        this.source = source;
+    }
+
     @Column(name = "description")
     public String getDescription() {
         return description;


More information about the Dive4elements-commits mailing list