comparison backend/src/main/java/org/dive4elements/river/importer/parsers/InfoGewParser.java @ 7751:24408bce2fdb

Parse and import model_uuid for rivers.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 27 Feb 2014 14:46:30 +0100
parents 4c3ccf2b0304
children b44c76b6800c
comparison
equal deleted inserted replaced
7750:6ff574778491 7751:24408bce2fdb
42 Pattern.compile("^\\s*WSTDatei\\s*:\\s*(.+)"); 42 Pattern.compile("^\\s*WSTDatei\\s*:\\s*(.+)");
43 43
44 public static final Pattern BB_INFO = 44 public static final Pattern BB_INFO =
45 Pattern.compile("^\\s*B\\+B-Info\\s*:\\s*(.+)"); 45 Pattern.compile("^\\s*B\\+B-Info\\s*:\\s*(.+)");
46 46
47 public static final Pattern GEW_UUID =
48 Pattern.compile("^\\s*uuid\\s*:\\s*(.+)");
49
47 protected ArrayList<ImportRiver> rivers; 50 protected ArrayList<ImportRiver> rivers;
48 51
49 protected AnnotationClassifier annotationClassifier; 52 protected AnnotationClassifier annotationClassifier;
50 53
51 public InfoGewParser() { 54 public InfoGewParser() {
79 new FileInputStream(file), ENCODING)); 82 new FileInputStream(file), ENCODING));
80 83
81 String line = null; 84 String line = null;
82 85
83 String riverName = null; 86 String riverName = null;
87 String modelUuid = null;
84 File wstFile = null; 88 File wstFile = null;
85 File bbInfoFile = null; 89 File bbInfoFile = null;
86 90
87 while ((line = in.readLine()) != null) { 91 while ((line = in.readLine()) != null) {
88 if ((line = line.trim()).length() == 0) { 92 if ((line = line.trim()).length() == 0) {
94 String river = m.group(1); 98 String river = m.group(1);
95 log.info("Found river '" + river + "'"); 99 log.info("Found river '" + river + "'");
96 if (riverName != null) { 100 if (riverName != null) {
97 rivers.add(new ImportRiver( 101 rivers.add(new ImportRiver(
98 riverName, 102 riverName,
103 modelUuid,
99 wstFile, 104 wstFile,
100 bbInfoFile, 105 bbInfoFile,
101 annotationClassifier)); 106 annotationClassifier));
102 } 107 }
103 riverName = river; 108 riverName = river;
109 modelUuid = null;
104 wstFile = null; 110 wstFile = null;
105 bbInfoFile = null; 111 bbInfoFile = null;
106 } 112 }
107 else if ((m = WST_DATEI.matcher(line)).matches()) { 113 else if ((m = WST_DATEI.matcher(line)).matches()) {
108 String wstFilename = m.group(1); 114 String wstFilename = m.group(1);
116 log.error("cannot access WST file '" + wstFilename + "'"); 122 log.error("cannot access WST file '" + wstFilename + "'");
117 continue; 123 continue;
118 } 124 }
119 wstFile = wst; 125 wstFile = wst;
120 } 126 }
127 else if ((m = GEW_UUID.matcher(line)).matches()) {
128 modelUuid = m.group(1);
129 log.debug("Found model uuid " + modelUuid +
130 " for river " + riverName);
131 }
121 else if ((m = BB_INFO.matcher(line)).matches()) { 132 else if ((m = BB_INFO.matcher(line)).matches()) {
122 //TODO: Make it relative to the wst file. 133 //TODO: Make it relative to the wst file.
123 String bbInfo = m.group(1); 134 String bbInfo = m.group(1);
124 bbInfoFile = new File(normalize(bbInfo)); 135 bbInfoFile = new File(normalize(bbInfo));
125 } 136 }
126 } 137 }
127 if (riverName != null) { 138 if (riverName != null) {
128 rivers.add(new ImportRiver( 139 rivers.add(new ImportRiver(
129 riverName, 140 riverName,
141 modelUuid,
130 wstFile, 142 wstFile,
131 bbInfoFile, 143 bbInfoFile,
132 annotationClassifier)); 144 annotationClassifier));
133 } 145 }
134 } 146 }

http://dive4elements.wald.intevation.org