Mercurial > dive4elements > river
changeset 1205:5f1506fc7636
Made import of cross sections work.
flys-backend/trunk@2313 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 08 Jul 2011 09:45:48 +0000 |
parents | 22858e7cca79 |
children | c7370734b872 |
files | flys-backend/ChangeLog flys-backend/doc/schema/postgresql.sql flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSection.java flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSectionLine.java |
diffstat | 4 files changed, 30 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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 <sascha.teichmann@intevation.de> + + * 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 <sascha.teichmann@intevation.de> Parse all PRFs in all subfolders of a river and store them
--- 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,
--- 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; } }
--- 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<CrossSectionPoint, CrossSectionPoint>(INDEX_CMP); // build index for faster collision lookup - for (CrossSectionPoint point: csl.getPoints()) { - map.put(point, point); + List<CrossSectionPoint> ps = csl.getPoints(); + if (ps != null) { + for (CrossSectionPoint point: ps) { + map.put(point, point); + } } Session session =