# HG changeset patch # User Sascha L. Teichmann # Date 1310118348 0 # Node ID 5f1506fc763633918dcbdea0c4effcc874ed7f32 # Parent 22858e7cca7927da0bf800b3f4c6e2b48df2732d Made import of cross sections work. flys-backend/trunk@2313 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 22858e7cca79 -r 5f1506fc7636 flys-backend/ChangeLog --- a/flys-backend/ChangeLog Thu Jul 07 22:25:38 2011 +0000 +++ b/flys-backend/ChangeLog Fri Jul 08 09:45:48 2011 +0000 @@ -1,3 +1,17 @@ +2011-07-08 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Misspelled sequence. + To update existing databases: + + DROP SEQUENCE CROSS_SECTION_LINES_SEQ; + CREATE SEQUENCE CROSS_SECTION_LINES_ID_SEQ; + + * src/main/java/de/intevation/flys/importer/ImportCrossSection.java: + Added some logging because importing is slow. + + * src/main/java/de/intevation/flys/importer/ImportCrossSectionLine.java: + Prevent NPE if a cross section line from db has no points. + 2011-07-08 Sascha L. Teichmann Parse all PRFs in all subfolders of a river and store them diff -r 22858e7cca79 -r 5f1506fc7636 flys-backend/doc/schema/postgresql.sql --- a/flys-backend/doc/schema/postgresql.sql Thu Jul 07 22:25:38 2011 +0000 +++ b/flys-backend/doc/schema/postgresql.sql Fri Jul 08 09:45:48 2011 +0000 @@ -271,7 +271,7 @@ description VARCHAR(256) ); -CREATE SEQUENCE CROSS_SECTION_LINES_SEQ; +CREATE SEQUENCE CROSS_SECTION_LINES_ID_SEQ; CREATE TABLE cross_section_lines ( id int PRIMARY KEY NOT NULL, diff -r 22858e7cca79 -r 5f1506fc7636 flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSection.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSection.java Thu Jul 07 22:25:38 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSection.java Fri Jul 08 09:45:48 2011 +0000 @@ -9,8 +9,12 @@ import java.util.List; +import org.apache.log4j.Logger; + public class ImportCrossSection { + private static Logger log = Logger.getLogger(ImportRiver.class); + protected ImportRiver river; protected String description; protected ImportTimeInterval timeInterval; @@ -66,10 +70,16 @@ public void storeDependencies() { + log.info("store cross section '" + description + "'"); + getPeer(); + int i = 1, N = lines.size(); + for (ImportCrossSectionLine line: lines) { line.storeDependencies(); + log.info(" stored " + i + " lines. remaining: " + (N-i)); + ++i; } } diff -r 22858e7cca79 -r 5f1506fc7636 flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSectionLine.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSectionLine.java Thu Jul 07 22:25:38 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSectionLine.java Fri Jul 08 09:45:48 2011 +0000 @@ -64,8 +64,11 @@ new TreeMap(INDEX_CMP); // build index for faster collision lookup - for (CrossSectionPoint point: csl.getPoints()) { - map.put(point, point); + List ps = csl.getPoints(); + if (ps != null) { + for (CrossSectionPoint point: ps) { + map.put(point, point); + } } Session session =