Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightEpoch.java @ 3949:145b87bcb10a
Some minor bugfixes for MINFO import.
flys-backend/trunk@5586 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 24 Sep 2012 09:14:48 +0000 |
parents | a5b003595d6c |
children | 3825aad9fb41 |
comparison
equal
deleted
inserted
replaced
3948:883dd49d5e74 | 3949:145b87bcb10a |
---|---|
1 package de.intevation.flys.importer; | 1 package de.intevation.flys.importer; |
2 | 2 |
3 import java.sql.SQLException; | |
3 import java.util.ArrayList; | 4 import java.util.ArrayList; |
4 import java.util.List; | 5 import java.util.List; |
5 | 6 |
6 import java.sql.SQLException; | |
7 | |
8 import org.apache.log4j.Logger; | 7 import org.apache.log4j.Logger; |
9 | 8 import org.hibernate.Query; |
10 import org.hibernate.Session; | 9 import org.hibernate.Session; |
11 import org.hibernate.Query; | |
12 import org.hibernate.exception.ConstraintViolationException; | 10 import org.hibernate.exception.ConstraintViolationException; |
13 | 11 |
14 import de.intevation.flys.model.BedHeightEpoch; | 12 import de.intevation.flys.model.BedHeightEpoch; |
15 import de.intevation.flys.model.ElevationModel; | 13 import de.intevation.flys.model.ElevationModel; |
16 import de.intevation.flys.model.Range; | 14 import de.intevation.flys.model.Range; |
95 @Override | 93 @Override |
96 public void storeDependencies(River river) throws SQLException, | 94 public void storeDependencies(River river) throws SQLException, |
97 ConstraintViolationException { | 95 ConstraintViolationException { |
98 log.info("Store dependencies for epoch: '" + getDescription() + "'"); | 96 log.info("Store dependencies for epoch: '" + getDescription() + "'"); |
99 | 97 |
98 BedHeightEpoch peer = getPeer(river); | |
99 | |
100 if (curElevationModel != null) { | 100 if (curElevationModel != null) { |
101 curElevationModel.storeDependencies(); | 101 curElevationModel.storeDependencies(); |
102 } | 102 } |
103 | 103 |
104 if (oldElevationModel != null) { | 104 if (oldElevationModel != null) { |
105 oldElevationModel.storeDependencies(); | 105 oldElevationModel.storeDependencies(); |
106 } | 106 } |
107 | |
108 BedHeightEpoch peer = getPeer(river); | |
109 | 107 |
110 if (peer != null) { | 108 if (peer != null) { |
111 log.debug("store values now..."); | 109 log.debug("store values now..."); |
112 | 110 |
113 for (ImportBedHeightEpochValue value : values) { | 111 for (ImportBedHeightEpochValue value : values) { |
120 } | 118 } |
121 | 119 |
122 @Override | 120 @Override |
123 public BedHeightEpoch getPeer(River river) { | 121 public BedHeightEpoch getPeer(River river) { |
124 if (peer == null) { | 122 if (peer == null) { |
125 ElevationModel theCurModel = curElevationModel != null ? curElevationModel | 123 ElevationModel theCurModel = null; |
126 .getPeer() : null; | 124 if (curElevationModel != null) { |
125 curElevationModel.storeDependencies(); | |
126 theCurModel = curElevationModel.getPeer(); | |
127 } | |
127 | 128 |
128 if (theCurModel == null) { | 129 if (theCurModel == null) { |
129 log.warn("BHE: Skip file - invalid current elevation model."); | 130 log.warn("BHE: Skip file - invalid current elevation model."); |
130 return null; | 131 return null; |
131 } | 132 } |
132 | 133 |
133 TimeInterval theTime = timeInterval != null ? timeInterval | 134 TimeInterval theTime = null; |
134 .getPeer() : null; | 135 if (timeInterval != null) { |
136 theTime = timeInterval.getPeer(); | |
137 } | |
135 | 138 |
136 if (theTime == null) { | 139 if (theTime == null) { |
137 log.warn("BHE: Skip file - invalid time range."); | 140 log.warn("BHE: Skip file - invalid time range."); |
138 return null; | 141 return null; |
139 } | 142 } |