changeset 853:164d102b0af5

Fixed Bug in renaming a Layer in Product Layer. gnv-artifacts/trunk@971 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 23 Apr 2010 10:12:43 +0000
parents b5f4b6073cde
children bb2175726c8a
files gnv-artifacts/doc/conf/maptemplates/layer_linestring.vm gnv-artifacts/doc/conf/maptemplates/layer_point.vm gnv-artifacts/doc/conf/maptemplates/layer_polygon.vm gnv-artifacts/src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java gnv-artifacts/src/main/java/de/intevation/gnv/utils/MetaWriter.java
diffstat 5 files changed, 30 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/doc/conf/maptemplates/layer_linestring.vm	Thu Apr 22 08:54:36 2010 +0000
+++ b/gnv-artifacts/doc/conf/maptemplates/layer_linestring.vm	Fri Apr 23 10:12:43 2010 +0000
@@ -1,5 +1,5 @@
 LAYER
-    NAME "$info.getName()"
+    NAME "$info.getTitle()"
     TYPE $info.getType()
     DATA "${info.getName()}/${info.getData()}"
     STATUS $info.getStatus()
--- a/gnv-artifacts/doc/conf/maptemplates/layer_point.vm	Thu Apr 22 08:54:36 2010 +0000
+++ b/gnv-artifacts/doc/conf/maptemplates/layer_point.vm	Fri Apr 23 10:12:43 2010 +0000
@@ -1,5 +1,5 @@
 LAYER
-    NAME "$info.getName()"
+    NAME "$info.getTitle()"
     TYPE $info.getType()
     DATA "${info.getName()}/${info.getData()}"
     STATUS $info.getStatus()
--- a/gnv-artifacts/doc/conf/maptemplates/layer_polygon.vm	Thu Apr 22 08:54:36 2010 +0000
+++ b/gnv-artifacts/doc/conf/maptemplates/layer_polygon.vm	Fri Apr 23 10:12:43 2010 +0000
@@ -1,5 +1,5 @@
 LAYER
-    NAME "$info.getName()"
+    NAME "$info.getTitle()"
     TYPE $info.getType()
     DATA "${info.getName()}/${info.getData()}"
     STATUS $info.getStatus()
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java	Thu Apr 22 08:54:36 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java	Fri Apr 23 10:12:43 2010 +0000
@@ -590,8 +590,11 @@
                 log.debug("Layer type: " + paramType);
             }
 
-            Document meta = MetaWriter.writeHorizontalcrosssectionMeta(
-                callContext, uuid, path, paramType);
+            Document meta = MetaWriter.writeLayerMeta(callContext, uuid,
+                                                        path, paramType,
+                                                        this.determineGeometryType(geometryType),
+                                                        SHAPEFILE_NAME,
+                                                        title);
             if (meta != null) {
                 MapfileGenerator.getInstance().update();
                 return meta;
@@ -611,7 +614,9 @@
                     }
                     Document meta = MetaWriter.writeLayerMeta(callContext, uuid,
                                                               path, paramType,
-                                                              this.determineGeometryType(geometryType));
+                                                              this.determineGeometryType(geometryType),
+                                                              SHAPEFILE_NAME,
+                                                              title);
                     if (meta != null) {
                         MapfileGenerator.getInstance().update();
                         return meta;
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/MetaWriter.java	Thu Apr 22 08:54:36 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/MetaWriter.java	Fri Apr 23 10:12:43 2010 +0000
@@ -1,27 +1,22 @@
 package de.intevation.gnv.utils;
 
-import de.intevation.artifactdatabase.XMLUtils;
-
-import de.intevation.artifacts.ArtifactNamespaceContext;
-import de.intevation.artifacts.CallContext;
-
-import de.intevation.gnv.artifacts.context.GNVArtifactContext;
-
-import de.intevation.gnv.wms.LayerInfo;
-
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
-
 import java.util.Date;
 
 import org.apache.log4j.Logger;
-
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
+import de.intevation.artifactdatabase.XMLUtils;
+import de.intevation.artifacts.ArtifactNamespaceContext;
+import de.intevation.artifacts.CallContext;
+import de.intevation.gnv.artifacts.context.GNVArtifactContext;
+import de.intevation.gnv.wms.LayerInfo;
+
 /**
  * This class provides some methods to create files storing meta information
  * about wms layers and a map service which serves these layers.
@@ -40,7 +35,7 @@
     public static final String META_FILE_NAME = "meta.xml";
     public static final String ISOLINES_NAME  = "isolines.shp";
     public static final String POLYGON_NAME   = "polygons.shp";
-    public static final String LAYER_DATA_NAME   = "data.shp";
+
 
     public static final String CONTEXT_LAYER_TITLE = "wms.title";
 
@@ -64,7 +59,9 @@
                                           String      uuid,
                                           String      path,
                                           String      paramType,
-                                          String      layerType){
+                                          String      layerType,
+                                          String      shapefileName,
+                                          String      title){
         Document meta = XMLUtils.newDocument();
         XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
             meta,
@@ -74,7 +71,7 @@
         meta.appendChild(root);
 
         writeAbstractMeta(context, meta, root);
-        writeLayerMeta(context, meta, root, uuid, paramType,layerType);
+        writeLayerMeta(context, meta, root, uuid, paramType,layerType,shapefileName,title);
         boolean success = writeMetaFile(path, meta);
 
         if (success){
@@ -231,7 +228,9 @@
         Element     meta,
         String      uuid,
         String      paramType,
-        String      layerType
+        String      layerType,
+        String      shapefileName,
+        String      layerTitle
     ) {
         XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
             document,
@@ -247,6 +246,7 @@
         Element layer      = creator.create(LayerInfo.LAYER);
         Element model      = creator.create(LayerInfo.LAYER_MODEL);
         Element name       = creator.create(LayerInfo.LAYER_NAME);
+        Element title  = creator.create(LayerInfo.LAYER_TITLE);
         Element type       = creator.create(LayerInfo.LAYER_TYPE);
         Element status     = creator.create(LayerInfo.LAYER_STATUS);
         Element data       = creator.create(LayerInfo.LAYER_DATA);
@@ -256,11 +256,14 @@
         name.setTextContent(uuid);
         type.setTextContent(layerType);
         status.setTextContent("OFF");
-        data.setTextContent(LAYER_DATA_NAME);
+        data.setTextContent(shapefileName);
         timeToLive.setTextContent(ttl);
+        
+        title.setTextContent(layerTitle);
 
         layer.appendChild(model);
         layer.appendChild(name);
+        layer.appendChild(title);
         layer.appendChild(type);
         layer.appendChild(status);
         layer.appendChild(data);

http://dive4elements.wald.intevation.org