changeset 4705:3199dbc20e22

Documentation added.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 19 Dec 2012 11:37:59 +0100
parents 115afdaf3e85
children e7b238247c4e
files flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSection.java flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSectionLine.java
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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);
--- 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);

http://dive4elements.wald.intevation.org