Mercurial > dive4elements > gnv-client
diff gnv-artifacts/src/main/java/de/intevation/gnv/utils/MetaWriter.java @ 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 | a645bd23c1c8 |
children | 3fbabd4803d7 |
line wrap: on
line diff
--- 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);