# HG changeset patch # User Tom Gottfried # Date 1376475044 -7200 # Node ID 827da1952ce2b283eadac4296b992d303ce88ff0 # Parent 1d60614c1059460898abfb14b9363e47e4e96a1f Importer: force import of waterlevel WST-file in first run. diff -r 1d60614c1059 -r 827da1952ce2 backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java --- a/backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java Tue Aug 13 09:51:15 2013 +0200 +++ b/backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java Wed Aug 14 12:10:44 2013 +0200 @@ -1153,6 +1153,18 @@ } public void storeDependencies() { + /* test whether river is already in database. + * Otherwise it makes no sense to skip waterlevel model WST-file + * because the altitude reference is taken from there. */ + Session session = ImporterSession.getInstance().getDatabaseSession(); + Query query = session.createQuery("from River where name=:name"); + query.setString("name", name); + List rivers = query.list(); + if (rivers.isEmpty() && Config.INSTANCE.skipWst()){ + log.error("River not yet in database. You cannot skip importing waterlevel model."); + return; + } + storeWstUnit(); storeAnnotations(); storeHYKs(); @@ -1178,7 +1190,7 @@ public void storeWstUnit() { if (wst == null) { - wstUnit = new ImportUnit("NN + m"); + log.warn("No unit given. Waterlevel-model WST-file has to be imported already."); } else { wstUnit = wst.getUnit();