comparison src/java/de/intevation/mxd/writer/MapScriptWriter.java @ 196:5350621a0294

Verify the SDE databse jointable attribute.
author raimund renkert <raimund.renkert@intevation.de>
date Wed, 20 Jul 2011 17:51:38 +0200
parents c640fb351f66
children cdbf2f2dca35
comparison
equal deleted inserted replaced
194:216105271856 196:5350621a0294
109 "/mxd/file", 109 "/mxd/file",
110 XPathConstants.NODE); 110 XPathConstants.NODE);
111 //Write the map attributes. 111 //Write the map attributes.
112 writeMap(); 112 writeMap();
113 //Write the layers. 113 //Write the layers.
114 writeLayer(); 114 boolean ret = writeLayer();
115 //Save the map. 115 //Save the map.
116 mapObj cloneMap = map.cloneMap(); 116 if (ret) {
117 117 mapObj cloneMap = map.cloneMap();
118 cloneMap.save(mapFilename); 118 cloneMap.save(mapFilename);
119 logger.info("Mapfile created: " + mapFilename); 119 logger.info("Mapfile created: " + mapFilename);
120 return true; 120 return true;
121 }
122 return false;
121 } 123 }
122 124
123 /** 125 /**
124 * Create the map object and set the attributes. 126 * Create the map object and set the attributes.
125 */ 127 */
178 } 180 }
179 181
180 /** 182 /**
181 * Create layer objects and set the attributes. 183 * Create layer objects and set the attributes.
182 */ 184 */
183 private void writeLayer() { 185 private boolean writeLayer() {
184 logger.debug("writeLayer()"); 186 logger.debug("writeLayer()");
185 Element mapNode = (Element)XMLUtils.xpath( 187 Element mapNode = (Element)XMLUtils.xpath(
186 root, 188 root,
187 "/mxd/map", 189 "/mxd/map",
188 XPathConstants.NODE); 190 XPathConstants.NODE);
276 ",SHAPE," + 278 ",SHAPE," +
277 layerElement.getAttribute("version")); 279 layerElement.getAttribute("version"));
278 layer.setProcessing("CLOSE_CONNECTION=defer"); 280 layer.setProcessing("CLOSE_CONNECTION=defer");
279 layer.setProcessing("ATTRIBUTE_QUALIFIED=TRUE"); 281 layer.setProcessing("ATTRIBUTE_QUALIFIED=TRUE");
280 if(layerElement.hasAttribute("join_table")) { 282 if(layerElement.hasAttribute("join_table")) {
283 String join = layerElement.getAttribute("join_table");
284 if (join.indexOf(".") <= 0) {
285 logger.warn ("Incomplete join table in layer " +
286 layerElement.getAttribute("name") +
287 ". Aborting.");
288 return false;
289 }
281 layer.setProcessing( 290 layer.setProcessing(
282 "JOINTABLE=" + 291 "JOINTABLE=" +
283 layerElement.getAttribute("join_table")); 292 layerElement.getAttribute("join_table"));
284 layer.setFilter( 293 layer.setFilter(
285 "where " + 294 "where " +
316 } 325 }
317 326
318 //Write classes. 327 //Write classes.
319 writeClass(layer, layerElement); 328 writeClass(layer, layerElement);
320 } 329 }
330 return true;
321 } 331 }
322 332
323 /** 333 /**
324 * Adds the classes to the layer. 334 * Adds the classes to the layer.
325 * @param layer Mapscript layer object. 335 * @param layer Mapscript layer object.
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)