diff gnv-artifacts/src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java @ 724:9ba6bb85d6dd

Integrate lookup for MapFileTemplate for the different Layer. gnv-artifacts/trunk@754 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 09 Mar 2010 12:54:05 +0000
parents 199982e8866e
children f6630d0203da
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java	Tue Mar 09 11:42:57 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java	Tue Mar 09 12:54:05 2010 +0000
@@ -80,6 +80,8 @@
     
     private String geometryType = null;
     
+    private String templateID = null;
+    
     public static final String SHAPEFILE_NAME   = "data.shp";
     
     /**
@@ -150,6 +152,7 @@
                 Result resultValue = it.next();
                 String table = resultValue.getString(0);
                 String where = resultValue.getString(1);
+                templateID = resultValue.getString(2);
                 if (this.geometryID != null){
                     InputData geometryInputData = 
                          this.inputData.get(this.geometryID);
@@ -365,6 +368,7 @@
             String path = shapeFilePath;
             shapeFilePath = null;
             geometryType = null;
+            templateID = null;
             return path;
         }
     }
@@ -389,8 +393,12 @@
             if (data != null &&
                 (path = writeToShapeFile(uuid, data, callContext)) != null) {
 
-                String paramType = LAYER_MODEL+"_"+this.geometryType.toLowerCase();
-               
+                String paramType = LAYER_MODEL+"_"+templateID;
+                
+                if (!MapfileGenerator.getInstance().templateExists(paramType)){
+                    // If the template doesn't exist the Defaulttemplates will be used.
+                    paramType = LAYER_MODEL+"_"+this.geometryType.toLowerCase();
+                }
                 Document meta = MetaWriter.writeLayerMeta(callContext, uuid, 
                                                           path, paramType, 
                                                           this.determineGeometryType());

http://dive4elements.wald.intevation.org