# HG changeset patch # User Felix Wolfsteller # Date 1355913479 -3600 # Node ID 3199dbc20e227e2c73ed577b5e16958ab7ae15a2 # Parent 115afdaf3e852fc0337c1f9d23f1d0fb0c3ad7a3 Documentation added. diff -r 115afdaf3e85 -r 3199dbc20e22 flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSection.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSection.java Wed Dec 19 11:35:51 2012 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSection.java Wed Dec 19 11:37:59 2012 +0100 @@ -11,6 +11,7 @@ import org.apache.log4j.Logger; +/** CrossSection to be imported, holds list of ImportCrossSectionLines. */ public class ImportCrossSection { private static Logger log = Logger.getLogger(ImportRiver.class); diff -r 115afdaf3e85 -r 3199dbc20e22 flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSectionLine.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSectionLine.java Wed Dec 19 11:35:51 2012 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSectionLine.java Wed Dec 19 11:37:59 2012 +0100 @@ -12,6 +12,10 @@ import java.util.Map; import java.util.TreeMap; +/** + * A CrossSectionLine (containing points) ready to be transformed into a mapped + * object and written to db (used in importer). + */ public class ImportCrossSectionLine { public static final Comparator INDEX_CMP = @@ -55,13 +59,15 @@ storePoints(); } + + /** Write a line and its points. */ protected void storePoints() { CrossSectionLine csl = getPeer(); Map map = new TreeMap(INDEX_CMP); - // build index for faster collision lookup + // Build index for faster (index) collision lookup. List ps = csl.getPoints(); if (ps != null) { for (CrossSectionPoint point: ps) { @@ -74,6 +80,9 @@ CrossSectionPoint key = new CrossSectionPoint(); + // Somehow it looks as if even with the map it is still possible that + // multiple points with same id enter hibernate (and then violate a + // constraint). -> TODO for (XY xy: points) { key.setColPos(xy.getIndex()); CrossSectionPoint csp = map.get(key);