Mercurial > mxd2map
changeset 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 | 216105271856 |
children | cdbf2f2dca35 |
files | ChangeLog src/java/de/intevation/mxd/writer/MapScriptWriter.java |
diffstat | 2 files changed, 24 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Jul 20 16:27:49 2011 +0200 +++ b/ChangeLog Wed Jul 20 17:51:38 2011 +0200 @@ -1,3 +1,10 @@ +2011-07-20 Raimund Renkert <raimund.renkert@intevation.de> + + * src/java/de/intevation/mxd/writer/MapScriptWriter.java: + If a SDE datasource and a join table is used, check if the join + table contains a "." to verify there could be a database schema. + If no "." is found, abort writing the mapfile. + 2011-07-20 Stephan Holl <stephan.holl@intevation.de> Modified and beautified the documentation:
--- a/src/java/de/intevation/mxd/writer/MapScriptWriter.java Wed Jul 20 16:27:49 2011 +0200 +++ b/src/java/de/intevation/mxd/writer/MapScriptWriter.java Wed Jul 20 17:51:38 2011 +0200 @@ -111,13 +111,15 @@ //Write the map attributes. writeMap(); //Write the layers. - writeLayer(); + boolean ret = writeLayer(); //Save the map. - mapObj cloneMap = map.cloneMap(); - - cloneMap.save(mapFilename); - logger.info("Mapfile created: " + mapFilename); - return true; + if (ret) { + mapObj cloneMap = map.cloneMap(); + cloneMap.save(mapFilename); + logger.info("Mapfile created: " + mapFilename); + return true; + } + return false; } /** @@ -180,7 +182,7 @@ /** * Create layer objects and set the attributes. */ - private void writeLayer() { + private boolean writeLayer() { logger.debug("writeLayer()"); Element mapNode = (Element)XMLUtils.xpath( root, @@ -278,6 +280,13 @@ layer.setProcessing("CLOSE_CONNECTION=defer"); layer.setProcessing("ATTRIBUTE_QUALIFIED=TRUE"); if(layerElement.hasAttribute("join_table")) { + String join = layerElement.getAttribute("join_table"); + if (join.indexOf(".") <= 0) { + logger.warn ("Incomplete join table in layer " + + layerElement.getAttribute("name") + + ". Aborting."); + return false; + } layer.setProcessing( "JOINTABLE=" + layerElement.getAttribute("join_table")); @@ -318,6 +327,7 @@ //Write classes. writeClass(layer, layerElement); } + return true; } /**