comparison flys-backend/src/main/java/de/intevation/flys/importer/AnnotationsParser.java @ 759:9f2204ed79ed

Import edges to database. flys-backend/trunk@2107 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 14 Jun 2011 13:13:58 +0000
parents d37ccb04ab5d
children 8076f6a689d0
comparison
equal deleted inserted replaced
758:bf16268629d9 759:9f2204ed79ed
88 catch (NumberFormatException nfe) { 88 catch (NumberFormatException nfe) {
89 log.warn("invalid number in line " + in.getLineNumber()); 89 log.warn("invalid number in line " + in.getLineNumber());
90 continue; 90 continue;
91 } 91 }
92 92
93 ImportEdge edge = null;
94
95 if (parts.length == 4) { // Only 'Unterkante'
96 try {
97 edge = new ImportEdge(
98 null,
99 new BigDecimal(parts[3].trim().replace(',', '.')));
100 }
101 catch (NumberFormatException nfe) {
102 log.warn("cannot parse 'Unterkante' in line " +
103 in.getLineNumber());
104 }
105 }
106 else if (parts.length > 4) { // 'Unterkante' and 'Oberkante'
107 String bottom = parts[3].trim().replace(',', '.');
108 String top = parts[4].trim().replace(',', '.');
109 try {
110 BigDecimal b = bottom.length() == 0
111 ? null
112 : new BigDecimal(bottom);
113 BigDecimal t = top.length() == 0
114 ? null
115 : new BigDecimal(top);
116 edge = new ImportEdge(t, b);
117 }
118 catch (NumberFormatException nfe) {
119 log.warn(
120 "cannot parse 'Unterkante' or 'Oberkante' in line "
121 + in.getLineNumber());
122 }
123 }
124
93 ImportRange range = new ImportRange(from, to); 125 ImportRange range = new ImportRange(from, to);
94 126
95 ImportAnnotation annotation = new ImportAnnotation( 127 ImportAnnotation annotation = new ImportAnnotation(
96 attribute, position, range); 128 attribute, position, range, edge);
97 129
98 if (!annotations.add(annotation)) { 130 if (!annotations.add(annotation)) {
99 log.debug("duplicated annotation in line " 131 log.debug("duplicated annotation in line "
100 + in.getLineNumber()); 132 + in.getLineNumber());
101 } 133 }

http://dive4elements.wald.intevation.org