Mercurial > dive4elements > river
diff flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSectionLine.java @ 4705:3199dbc20e22
Documentation added.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 19 Dec 2012 11:37:59 +0100 |
parents | 2f874d14ac68 |
children | 52c3a9d14441 |
line wrap: on
line diff
--- 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<CrossSectionPoint> INDEX_CMP = @@ -55,13 +59,15 @@ storePoints(); } + + /** Write a line and its points. */ protected void storePoints() { CrossSectionLine csl = getPeer(); Map<CrossSectionPoint, CrossSectionPoint> map = new TreeMap<CrossSectionPoint, CrossSectionPoint>(INDEX_CMP); - // build index for faster collision lookup + // Build index for faster (index) collision lookup. List<CrossSectionPoint> 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);