diff artifacts/src/main/java/org/dive4elements/river/artifacts/states/FloodMapState.java @ 8856:5e38e2924c07 3.2.x

Fix code style.
author Tom Gottfried <tom@intevation.de>
date Thu, 18 Jan 2018 20:12:01 +0100
parents e9d912c97fa8
children 3f49835a00c3 0a5239a1e46e
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/FloodMapState.java	Thu Jan 18 20:10:59 2018 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/FloodMapState.java	Thu Jan 18 20:12:01 2018 +0100
@@ -104,19 +104,22 @@
 
     private static final String HWS_LINES_SHAPE = "hws-lines.shp";
 
-    private static final String I18N_HWS_POINTS_OFFICIAL = "floodmap.hws.points.official";
-    private static final String I18N_HWS_LINES_OFFICIAL = "floodmap.hws.lines.official";
+    private static final String I18N_HWS_POINTS_OFFICIAL =
+        "floodmap.hws.points.official";
+    private static final String I18N_HWS_LINES_OFFICIAL =
+        "floodmap.hws.lines.official";
     private static final String HWS_LINES = "hws-lines";
     private static final String HWS_POINT_SHAPE = "hws-points.shp";
     private static final String HWS_POINTS = "hws-points";
 
 
     /* List of possible map files this state handles . */
-    private static final String[] POSSIBLE_ADDITIONAL_MAPFILES = {HWS_LINES,
-                                                                  HWS_POINTS,
-                                                                  WSPLGEN_USER_RGD,
-                                                                  "barriers-lines",
-                                                                  "barriers-poly"};
+    private static final String[] POSSIBLE_ADDITIONAL_MAPFILES = {
+        HWS_LINES,
+        HWS_POINTS,
+        WSPLGEN_USER_RGD,
+        "barriers-lines",
+        "barriers-poly"};
 
 
 
@@ -158,15 +161,18 @@
         FileTools.copyDirectory(origDir, thisDir);
 
         for (String candidate: POSSIBLE_ADDITIONAL_MAPFILES) {
-            File f = new File(thisDir, MapfileGenerator.MS_LAYER_PREFIX + candidate);
+            File f = new File(
+                thisDir, MapfileGenerator.MS_LAYER_PREFIX + candidate);
             if (f.exists()) {
                 log.debug("Fixing artifiact id's in: " + f);
                 try {
                     String content = FileUtils.readFileToString(f);
                     FileUtils.writeStringToFile(f,
-                            content.replaceAll(orig.identifier(), owner.identifier()));
+                        content.replaceAll(
+                            orig.identifier(), owner.identifier()));
                 } catch (IOException e) {
-                    log.error("Failed to rewrite file: " + f + " Error: " + e.getMessage());
+                    log.error("Failed to rewrite file: " + f
+                        + " Error: " + e.getMessage());
                 }
             }
         }
@@ -197,7 +203,8 @@
                     if (layer.contains(orig.identifier())) {
                         wms.removeLayer(layer);
 
-                        String newLayer = layer.replace(orig.identifier(), owner.identifier());
+                        String newLayer = layer.replace(
+                            orig.identifier(), owner.identifier());
 
                         wms.addLayer(newLayer);
 
@@ -298,7 +305,7 @@
 
 
     /**
-     * Removes the directory and all its content where the required data and the
+     * Removes directory and all its content where the required data and the
      * results of WSPLGEN are stored. Should be called in endOfLife().
      */
     protected void removeDirectory(D4EArtifact artifact) {
@@ -443,7 +450,7 @@
                 MapfileGenerator.MS_LAYER_PREFIX + HWS_LINES,
                 HWS_LINES_SHAPE,
                 "LINE",
-                "31467", // XXX: This should be dynamically fetched from database.
+                "31467", // XXX: should be dynamically fetched from database.
                 "hws");
             job.addLin(artifactDir + "/" + HWS_LINES_SHAPE);
             facetCreator.createShapeFacet(I18N_HWS_LINES_OFFICIAL,
@@ -473,7 +480,8 @@
         info.setGroupTitle(group);
         info.setGroup(group + artifact.identifier());
         MapfileGenerator generator = new ArtifactMapfileGenerator();
-        Template tpl = generator.getTemplateByName(MapfileGenerator.SHP_LAYER_TEMPLATE);
+        Template tpl = generator.getTemplateByName(
+            MapfileGenerator.SHP_LAYER_TEMPLATE);
         try {
             File layer = new File(artifactDir.getCanonicalPath() + "/" + name);
             generator.writeLayer(info, layer, tpl);
@@ -602,7 +610,8 @@
 
         boolean l = GeometryUtils.writeShapefile(
             shapeLines,
-            GeometryUtils.buildFeatureType("lines", srs, LineString.class, obj),
+            GeometryUtils.buildFeatureType(
+                "lines", srs, LineString.class, obj),
             fcs[0]);
 
         if (l) {
@@ -628,7 +637,8 @@
 
         boolean p = GeometryUtils.writeShapefile(
             shapePolys,
-            GeometryUtils.buildFeatureType("polygons", srs, Polygon.class, obj),
+            GeometryUtils.buildFeatureType(
+                "polygons", srs, Polygon.class, obj),
             fcs[1]);
 
 
@@ -691,7 +701,9 @@
     }
 
 
-    protected FeatureCollection[] splitLinesAndPolygons(List<SimpleFeature> f) {
+    protected FeatureCollection[] splitLinesAndPolygons(
+        List<SimpleFeature> f
+    ) {
         FeatureCollection lines    = FeatureCollections.newCollection();
         FeatureCollection polygons = FeatureCollections.newCollection();
 
@@ -857,7 +869,8 @@
 
         boolean q = GeometryUtils.writeShapefile(
             qpsShape,
-            GeometryUtils.buildFeatureType("qps", srs, LineString.class, attrs),
+            GeometryUtils.buildFeatureType(
+                "qps", srs, LineString.class, attrs),
             collection);
 
         if (q) {
@@ -966,7 +979,8 @@
 
         log.debug("Use waterlevel provided by Artifact: " + src.identifier());
 
-        // The state actually depends on the kind of artifact. E.g. StaticWQKmsArtifact needs other state
+        // The state actually depends on the kind of artifact.
+        // E.g. StaticWQKmsArtifact needs other state
         Object computed = src.compute(
             cc,
             //null,
@@ -983,7 +997,8 @@
             CalculationResult rawData = (CalculationResult) computed;
             WQKms[] wqkms;
             if (rawData.getData() instanceof FixRealizingResult) {
-                wqkms = (WQKms[]) ((FixRealizingResult) rawData.getData()).getWQKms();
+                wqkms = (WQKms[])((FixRealizingResult)rawData.getData())
+                    .getWQKms();
             }
             else {
                 wqkms = (WQKms[]) rawData.getData();
@@ -999,11 +1014,13 @@
         }
         else if (computed == null && src instanceof StaticWKmsArtifact) {
             // Floodmarks and protection.
-            WQKms wqkms = WQKms.fromWKms(((StaticWKmsArtifact) src).getWKms(0), 1d);
+            WQKms wqkms = WQKms.fromWKms(
+                ((StaticWKmsArtifact)src).getWKms(0), 1d);
             return wqkms;
         }
 
-        log.warn("getWQKms cannot handle " + computed.getClass() + " " + src.getClass());
+        log.warn("getWQKms cannot handle " + computed.getClass()
+            + " " + src.getClass());
         return null;
     }
 

http://dive4elements.wald.intevation.org