# HG changeset patch # User Sascha L. Teichmann # Date 1310942700 0 # Node ID 3c860d3e79d9a8bfb2bc8d50678c5a7948aecd55 # Parent d80997bd94ce43b8a7efe3176f49ff6e4f70bc87 Importer: Parse HYKs from importer. flys-backend/trunk@2346 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r d80997bd94ce -r 3c860d3e79d9 flys-backend/ChangeLog --- a/flys-backend/ChangeLog Sun Jul 17 22:30:09 2011 +0000 +++ b/flys-backend/ChangeLog Sun Jul 17 22:45:00 2011 +0000 @@ -1,3 +1,8 @@ +2011-07-18 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: + Parse the HYKs from the importer. TODO: Store them in database. + 2011-07-18 Sascha L. Teichmann * src/main/java/de/intevation/flys/importer/parsers/HYKParser.java: diff -r d80997bd94ce -r 3c860d3e79d9 flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java Sun Jul 17 22:30:09 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java Sun Jul 17 22:45:00 2011 +0000 @@ -21,6 +21,7 @@ import de.intevation.flys.utils.FileTools.HashedFile; import de.intevation.flys.importer.parsers.PRFParser; +import de.intevation.flys.importer.parsers.HYKParser; import de.intevation.flys.importer.parsers.AnnotationsParser; import de.intevation.flys.importer.parsers.AnnotationClassifier; import de.intevation.flys.importer.parsers.PegelGltParser; @@ -62,6 +63,8 @@ protected List annotations; + protected List hyks; + protected List crossSections; protected List extraWsts; @@ -81,6 +84,7 @@ protected River peer; public ImportRiver() { + hyks = new ArrayList(); crossSections = new ArrayList(); extraWsts = new ArrayList(); fixations = new ArrayList(); @@ -138,6 +142,7 @@ parseGauges(); parseAnnotations(); parsePRFs(); + parseHYKs(); parseWst(); parseExtraWsts(); parseFixations(); @@ -363,6 +368,38 @@ annotations = aparser.getAnnotations(); } + public void parseHYKs() { + log.info("looking for HYK files"); + HYKParser parser = new HYKParser(); + File riverDir = wstFile + .getParentFile() // Basisdaten + .getParentFile() // Hydrologie + .getParentFile(); // + + parser.parseHYKs(riverDir, new HYKParser.Callback() { + + Set hfs = new HashSet(); + + @Override + public boolean hykAccept(File file) { + HashedFile hf = new HashedFile(file); + boolean success = hfs.add(hf); + if (!success) { + log.warn("HYK file '" + file + "' seems to be a duplicate."); + } + return success; + } + + @Override + public void hykParsed(HYKParser parser) { + log.debug("callback from HYK parser"); + ImportHYK hyk = parser.getHYK(); + hyk.setRiver(ImportRiver.this); + hyks.add(hyk); + } + }); + } + public void parsePRFs() { log.info("looking for PRF files"); PRFParser parser = new PRFParser();