comparison flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java @ 5232:11b2a0c55318

ImportRiver: Import WaterlevelDifferences as Wst.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 11 Mar 2013 15:10:11 +0100
parents a981222b6260
children 93d4145d5740
comparison
equal deleted inserted replaced
5231:fb5771196c82 5232:11b2a0c55318
145 145
146 protected List<ImportFlowVelocityMeasurement> flowVelocityMeasurements; 146 protected List<ImportFlowVelocityMeasurement> flowVelocityMeasurements;
147 147
148 protected List<ImportSedimentYield> sedimentYields; 148 protected List<ImportSedimentYield> sedimentYields;
149 149
150 protected List<ImportWaterlevel> waterlevels;
151
152 protected List<ImportWaterlevelDifference> waterlevelDiffs;
153
154 protected List<ImportMeasurementStation> measurementStations; 150 protected List<ImportMeasurementStation> measurementStations;
155 151
156 protected List<ImportSQRelation> sqRelations; 152 protected List<ImportSQRelation> sqRelations;
157 153
158 protected ImportWst wst; 154 protected ImportWst wst;
212 sedimentDensities = new ArrayList<ImportSedimentDensity>(); 208 sedimentDensities = new ArrayList<ImportSedimentDensity>();
213 morphologicalWidths = new ArrayList<ImportMorphWidth>(); 209 morphologicalWidths = new ArrayList<ImportMorphWidth>();
214 flowVelocityModels = new ArrayList<ImportFlowVelocityModel>(); 210 flowVelocityModels = new ArrayList<ImportFlowVelocityModel>();
215 flowVelocityMeasurements = new ArrayList<ImportFlowVelocityMeasurement>(); 211 flowVelocityMeasurements = new ArrayList<ImportFlowVelocityMeasurement>();
216 sedimentYields = new ArrayList<ImportSedimentYield>(); 212 sedimentYields = new ArrayList<ImportSedimentYield>();
217 waterlevels = new ArrayList<ImportWaterlevel>();
218 waterlevelDiffs = new ArrayList<ImportWaterlevelDifference>();
219 measurementStations = new ArrayList<ImportMeasurementStation>(); 213 measurementStations = new ArrayList<ImportMeasurementStation>();
220 sqRelations = new ArrayList<ImportSQRelation>(); 214 sqRelations = new ArrayList<ImportSQRelation>();
221 } 215 }
222 216
223 public ImportRiver( 217 public ImportRiver(
627 621
628 for (File file: files) { 622 for (File file: files) {
629 parser.parse(file); 623 parser.parse(file);
630 } 624 }
631 625
632 waterlevelDiffs = parser.getDifferences(); 626 // WaterlevelDifferences become Wsts now.
627 for(ImportWst iw: parser.exportWsts()) {
628 iw.setDescription("CSV/" + iw.getDescription());
629 waterlevelDifferences.add(iw);
630 }
633 } 631 }
634 632
635 633
636 protected void parseSQRelation() throws IOException { 634 protected void parseSQRelation() throws IOException {
637 if (Config.INSTANCE.skipSQRelation()) { 635 if (Config.INSTANCE.skipSQRelation()) {
1081 storeBedHeight(); 1079 storeBedHeight();
1082 storeSedimentDensity(); 1080 storeSedimentDensity();
1083 storeMorphologicalWidth(); 1081 storeMorphologicalWidth();
1084 storeFlowVelocity(); 1082 storeFlowVelocity();
1085 storeSedimentYield(); 1083 storeSedimentYield();
1086 storeWaterlevels();
1087 storeWaterlevelDifferences(); 1084 storeWaterlevelDifferences();
1088 storeMeasurementStations(); 1085 storeMeasurementStations();
1089 storeSQRelations(); 1086 storeSQRelations();
1090 storeOfficialNumber(); 1087 storeOfficialNumber();
1091 } 1088 }
1128 1125
1129 public void storeFixations() { 1126 public void storeFixations() {
1130 if (!Config.INSTANCE.skipFixations() || !Config.INSTANCE.skipWaterlevels()) { 1127 if (!Config.INSTANCE.skipFixations() || !Config.INSTANCE.skipWaterlevels()) {
1131 log.info("store fixation wsts and/or csvs"); 1128 log.info("store fixation wsts and/or csvs");
1132 River river = getPeer(); 1129 River river = getPeer();
1133 for (ImportWst wst: fixations) { 1130 for (ImportWst fwst: fixations) {
1134 log.debug("name: " + wst.getDescription()); 1131 log.debug("name: " + fwst.getDescription());
1135 wst.storeDependencies(river); 1132 fwst.storeDependencies(river);
1136 } 1133 }
1137 } 1134 }
1138 } 1135 }
1136
1137
1138 /** Store wsts from waterleveldifference-csv files. */
1139 public void storeWaterlevelDifferences() {
1140 if (!Config.INSTANCE.skipWaterlevelDifferences())
1141
1142 log.info("store waterleveldifferences wsts from csv");
1143 River river = getPeer();
1144 for (ImportWst dWst: waterlevelDifferences) {
1145 log.debug("water.diff.: name " + dWst.getDescription());
1146 dWst.storeDependencies(river);
1147 }
1148 }
1149
1139 1150
1140 public void storeExtraWsts() { 1151 public void storeExtraWsts() {
1141 if (!Config.INSTANCE.skipExtraWsts()) { 1152 if (!Config.INSTANCE.skipExtraWsts()) {
1142 log.info("store extra wsts"); 1153 log.info("store extra wsts");
1143 River river = getPeer(); 1154 River river = getPeer();
1340 catch (SQLException sqle) { 1351 catch (SQLException sqle) {
1341 log.error("Error while storing sediment yield.", sqle); 1352 log.error("Error while storing sediment yield.", sqle);
1342 } 1353 }
1343 catch (ConstraintViolationException cve) { 1354 catch (ConstraintViolationException cve) {
1344 log.error("Error while storing sediment yield.", cve); 1355 log.error("Error while storing sediment yield.", cve);
1345 }
1346 }
1347 }
1348 }
1349
1350
1351 public void storeWaterlevels() {
1352 if (!Config.INSTANCE.skipWaterlevels()) {
1353 log.info("store waterlevels");
1354
1355 River river = getPeer();
1356
1357 for (ImportWaterlevel waterlevel: waterlevels) {
1358 waterlevel.storeDependencies(river);
1359 }
1360 }
1361 }
1362
1363
1364 public void storeWaterlevelDifferences() {
1365 if (!Config.INSTANCE.skipWaterlevelDifferences()) {
1366 log.info("store waterlevel differences");
1367
1368 River river = getPeer();
1369
1370 for (ImportWaterlevelDifference diff: waterlevelDiffs) {
1371 try {
1372 diff.storeDependencies(river);
1373 }
1374 catch (SQLException sqle) {
1375 log.error("Error while storing waterlevel diff.", sqle);
1376 }
1377 catch (ConstraintViolationException cve) {
1378 log.error("Error while storing waterlevel diff.", cve);
1379 } 1356 }
1380 } 1357 }
1381 } 1358 }
1382 } 1359 }
1383 1360

http://dive4elements.wald.intevation.org