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

Removed trailing whitespace gnv-artifacts/trunk@851 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 29 Mar 2010 07:58:51 +0000
parents 1614b27dcbfa
children b1f5f2a8840f
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java	Fri Mar 26 15:31:20 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java	Mon Mar 29 07:58:51 2010 +0000
@@ -46,43 +46,43 @@
      * the logger, used to log exceptions and additonaly information
      */
     private static Logger log = Logger.getLogger(LayerOutputState.class);
-    
+
     /**
      * The UID of this Class.
      */
     private static final long serialVersionUID = 9180957321704424049L;
-    
+
     // TODO: Replace
     public static final String LAYER_MODEL    = "layer";
 
     /**
      * The ID for the Query fetching the Layer from the DB
      */
-    private String dataQueryID = null; 
-    
+    private String dataQueryID = null;
+
     /**
      * The ID for the Query fetching the Geometry from the DB
      * which should be used to Clip the Layerdata
      */
     private String geometryQueryID = null;
-    
+
     private String columnQueryID = null;
-    
+
     /**
      * The ID for the Value which will hold the Geometrie-Value
      */
     private String geometryID = null;
-    
+
     private Boolean shapeFileLock = new Boolean(true);
-    
+
     private String shapeFilePath;
-    
+
     private String geometryType = null;
-    
+
     private String templateID = null;
-    
+
     public static final String SHAPEFILE_NAME   = "data.shp";
-    
+
     /**
      * Constructor
      */
@@ -91,14 +91,14 @@
     }
 
     /**
-     * @see de.intevation.gnv.state.OutputState#out(org.w3c.dom.Document, 
-     *      java.util.Collection, java.io.OutputStream, 
+     * @see de.intevation.gnv.state.OutputState#out(org.w3c.dom.Document,
+     *      java.util.Collection, java.io.OutputStream,
      *      java.lang.String, de.intevation.artifacts.CallContext)
      */
     public void out(Document format, Collection<InputData> inputData,
                     OutputStream outputStream, String uuid,
                     CallContext callContext) throws StateException {
-        
+
         log.debug("LayerOutputState.out");
         String outputMode = XMLUtils.xpathString(
                 format, XPATH_OUTPUT_MODE, ArtifactNamespaceContext.INSTANCE);
@@ -117,7 +117,7 @@
             }else{
                 this.writeExceptionReport2Stream(outputStream);
             }
-            
+
         }
     }
 
@@ -130,8 +130,8 @@
         createExceptionReport("No Data to Export", document);
         XMLUtils.toStream(document,outputStream);
     }
-    
-    
+
+
     /**
      * Fetches the Data from the Databasebackend
      * @return
@@ -152,13 +152,13 @@
                 String table = resultValue.getString(0);
                 String where = resultValue.getString(1);
                 String columns = this.fetchColumns(table);
-                
+
                 templateID = resultValue.getString(2);
                 if (this.geometryID != null){
-                    InputData geometryInputData = 
+                    InputData geometryInputData =
                          this.inputData.get(this.geometryID);
                     if (geometryInputData != null){
-                        
+
                         try {
                             Collection<Result> geometryData = queryExecutor
                                                       .executeQuery(this.geometryQueryID,
@@ -178,7 +178,7 @@
                                                   geometryWKT};
                     }else{
                         //Look into the presetting for an WKT
-                        InputData geometryWKTData = this.preSettings != null ? 
+                        InputData geometryWKTData = this.preSettings != null ?
                                                     this.preSettings.get("geometry") :
                                                     null ;
                         if (geometryWKTData != null){
@@ -192,7 +192,7 @@
                     }
                 }else{
                     //Look into the presetting for an WKT
-                    InputData geometryWKTData = this.preSettings != null ? 
+                    InputData geometryWKTData = this.preSettings != null ?
                                                 this.preSettings.get("geometry") :
                                                 null ;
                     if (geometryWKTData != null){
@@ -205,14 +205,14 @@
                     }
                 }
             }
-            
+
             try {
                 data  = queryExecutor.executeQuery(dataQueryID,
                                                    queryValues);
                 if (data != null && geometryWKT != null){
                     WKTReader wktReader = new WKTReader();
                     Geometry border = wktReader.read(geometryWKT);
-                    
+
                     Iterator<Result> dataIt = data.iterator();
                     while (dataIt.hasNext()){
                         // Trim the Geometries using the
@@ -226,7 +226,7 @@
                             log.error("Error parsing Geometry "+ currentWKT);
                             log.error(e,e);
                         }
-                        
+
                         if (currentGeometry != null){
                             Geometry newGeometry = currentGeometry.intersection(border);
                             current.addColumnValue(0, newGeometry.toText());
@@ -250,9 +250,9 @@
             // Only use the first Table the second one will be ignored.
             QueryExecutor queryExecutor = QueryExecutorFactory.getInstance()
             .getQueryExecutor();
-            
+
             Collection<Result> columnData = queryExecutor.
-                                                executeQuery(this.columnQueryID, 
+                                                executeQuery(this.columnQueryID,
                                                              filter);
             if (columnData != null && !columnData.isEmpty()){
                 StringBuffer sb = new StringBuffer();
@@ -268,7 +268,7 @@
                 }
                 returnValue = sb.toString();
             }
-            
+
         } catch (QueryException e) {
             log.error(e,e);
         }
@@ -284,18 +284,18 @@
                                                 "inputvalue-geometry");
         this.geometryQueryID =  Config.getStringXPath(configuration,
                                                 "queryID-geometry");
-        
+
         this.columnQueryID =   "layer_colums"; //Config.getStringXPath(configuration,
                                                // "queryID-columns");
     }
-    
+
     protected String writeToShapeFile(
                                       String             uuid,
                                       Collection<Result> data,
                                       CallContext        callContext
                                   ) {
         File baseDir = shapefileDirectory(callContext);
-        
+
         File shapeDir = new File(baseDir, uuid);
         boolean success    = false;
         boolean createdDir = false;
@@ -309,7 +309,7 @@
                 }
 
                 if (!shapeDir.mkdirs()) {
-                    log.error("cannot create directory '" 
+                    log.error("cannot create directory '"
                         + shapeDir.getAbsolutePath() + "'");
                     return null;
                 }
@@ -321,7 +321,7 @@
                 log.error("writing data into shapefile failed");
                 return null;
             }
-            
+
             shapeFilePath = shapeDir.getAbsolutePath();
             success = true;
 
@@ -335,13 +335,13 @@
             }
         }
     }
-    
+
     protected void writeZip(
             String       uuid,
             CallContext  callContext,
             OutputStream output,
             Collection<Result> data
-        ) 
+        )
         throws StateException
         {
             try {
@@ -353,7 +353,7 @@
                     }
                 }
                 else {
-                  
+
                     if ((p = writeToShapeFile(uuid, data, callContext)) != null) {
                         FileUtils.createZipArchive(new File(p), output);
                     }
@@ -363,13 +363,13 @@
                 log.error(ioe.getLocalizedMessage(), ioe);
             }
         }
-    
+
     public String getShapeFilePath() {
         synchronized (shapeFileLock) {
             return shapeFilePath;
         }
     }
-    
+
     private static File shapefileDirectory(CallContext callContext) {
         // TODO: Refactoring nessessary it should be used only one Shapefilepath
         //       for alle Modes. Code was taken from HorizontalCrossSectionMeshOutputState
@@ -381,7 +381,7 @@
             ? dir
             : GNVArtifactContext.DEFAULT_HORIZONTAL_CROSS_SECTION_PROFILE_SHAPEFILE_PATH;
     }
-    
+
     /**
      * @see de.intevation.gnv.state.StateBase#endOfLife(java.lang.Object)
      */
@@ -418,7 +418,7 @@
             } // run
         }.start();
     }
-    
+
     public String resetShapeFilePath() {
         synchronized (shapeFileLock) {
             String path = shapeFilePath;
@@ -428,9 +428,9 @@
             return path;
         }
     }
-    protected Document getWMS(String uuid, 
-                              CallContext callContext, 
-                              Collection<Result> data) 
+    protected Document getWMS(String uuid,
+                              CallContext callContext,
+                              Collection<Result> data)
     throws StateException
     {
         // TODO: Do the real WMS publishing here!
@@ -445,18 +445,18 @@
             pathElement.setTextContent(path);
         }
         else {
-            
+
             if (data != null &&
                 (path = writeToShapeFile(uuid, data, callContext)) != null) {
 
                 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, 
+                Document meta = MetaWriter.writeLayerMeta(callContext, uuid,
+                                                          path, paramType,
                                                           this.determineGeometryType());
                 if (meta != null) {
                     MapfileGenerator.getInstance().update();
@@ -469,11 +469,11 @@
 
         return document;
     }
-    
+
     private String determineGeometryType(){
-        
+
         String returnValue = this.geometryType.toLowerCase();
-        
+
         if (returnValue.equalsIgnoreCase("linestring")){
             returnValue = "Line";
         }

http://dive4elements.wald.intevation.org