changeset 1510:f7b3d5833f3b

Updated the MapOutputService to be able to request the new output type 'map'. flys-client/trunk@3652 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 11 Jan 2012 14:28:46 +0000
parents 8c911c935b58
children 9119bf1f9e5e
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties flys-client/src/main/java/de/intevation/flys/client/server/MapOutputServiceImpl.java
diffstat 6 files changed, 34 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Wed Jan 11 11:20:36 2012 +0000
+++ b/flys-client/ChangeLog	Wed Jan 11 14:28:46 2012 +0000
@@ -1,3 +1,14 @@
+2012-01-11  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/server/MapOutputServiceImpl.java:
+	  Find the output mode in collection to request the correct map.
+
+	* src/main/java/de/intevation/flys/client/client/FLYSConstants.java,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties:
+	  Added i18n string for error message.
+
 2012-01-11  Raimund Renkert <raimund.renkert@intevation.de>
 
 	Issue 435.
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Wed Jan 11 11:20:36 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Wed Jan 11 14:28:46 2012 +0000
@@ -476,6 +476,8 @@
 
     String error_no_map_config();
 
+    String error_no_map_output_type();
+
     String warning_use_first_feature();
 
     String error_no_valid_gfi_url();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Wed Jan 11 11:20:36 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Wed Jan 11 14:28:46 2012 +0000
@@ -248,6 +248,7 @@
 error_no_theme_styles_found=No style for the selected theme found.
 error_no_feature_selected = No object selected.
 error_no_map_config = No Map configuration found.
+error_no_map_output_type = No Map output found.
 warning_use_first_feature = You have more that one object selected. The first one is used.
 error_no_valid_gfi_url = No valid GetFeatureInfo response found.
 error_gfi_req_failed = GetFeatureInfo request failed.
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Wed Jan 11 11:20:36 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Wed Jan 11 14:28:46 2012 +0000
@@ -248,6 +248,7 @@
 error_no_theme_styles_found=Es konnten keine Stile f\u00fcr das gew\u00e4hlte Thema gefunden werden.
 error_no_feature_selected = Kein Objekt ausgew\u00e4hlt.
 error_no_map_config = Es konnte keine Kartenkonfiguration gefunden werden.
+error_no_map_output_type = Es konnte kein Ausgabemodus f\u00fcr Karten gefunden werden.
 warning_use_first_feature = Sie haben mehr als ein Objekt ausgew\u00e4hlt. Das erste Objekt wird benutzt.
 error_no_valid_gfi_url = Ung\u00fcltige GetFeatureInfo URL.
 error_gfi_req_failed = Die GetFeatureInfo Anfrage ist fehlgeschlagen.
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Wed Jan 11 11:20:36 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Wed Jan 11 14:28:46 2012 +0000
@@ -248,6 +248,7 @@
 error_no_theme_styles_found=No style for the selected theme found.
 error_no_feature_selected = No object selected.
 error_no_map_config = No Map configuration found.
+error_no_map_output_type = No Map output found.
 warning_use_first_feature = You have more that one object selected. The first one is used.
 error_no_valid_gfi_url = No valid GetFeatureInfo response found.
 error_gfi_req_failed = GetFeatureInfo request failed.
--- a/flys-client/src/main/java/de/intevation/flys/client/server/MapOutputServiceImpl.java	Wed Jan 11 11:20:36 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/MapOutputServiceImpl.java	Wed Jan 11 14:28:46 2012 +0000
@@ -3,6 +3,8 @@
 import java.io.InputStream;
 import java.io.IOException;
 
+import java.util.Map;
+
 import org.w3c.dom.Document;
 
 import org.apache.log4j.Logger;
@@ -19,7 +21,7 @@
 import de.intevation.flys.client.shared.exceptions.ServerException;
 import de.intevation.flys.client.shared.model.Collection;
 import de.intevation.flys.client.shared.model.MapConfig;
-
+import de.intevation.flys.client.shared.model.OutputMode;
 import de.intevation.flys.client.client.services.MapOutputService;
 
 
@@ -34,6 +36,7 @@
 
     public static final String ERROR_NO_MAP_CONFIG = "error_no_map_config";
 
+    public static final String ERROR_NO_MAP_OUTPUT_TYPE = "error_no_map_output_type";
 
     public MapConfig doOut(Collection collection)
     throws ServerException
@@ -43,12 +46,24 @@
         String url  = getServletContext().getInitParameter("server-url");
         String uuid = collection.identifier();
 
+        Map<String, OutputMode> modes = collection.getOutputModes();
+        String requestMode = "";
+        if (modes.containsKey("floodmap")) {
+            requestMode = "floodmap";
+        }
+        else if (modes.containsKey("map")) {
+            requestMode = "map";
+        }
+        else {
+           throw new ServerException(ERROR_NO_MAP_OUTPUT_TYPE);
+        }
+
         try {
             Document request = ClientProtocolUtils.newOutCollectionDocument(
-                uuid, "floodmap", "floodmap");
+                uuid, requestMode, requestMode);
 
             HttpClient client = new HttpClientImpl(url);
-            InputStream    is = client.collectionOut(request, uuid, "floodmap");
+            InputStream    is = client.collectionOut(request, uuid, requestMode);
 
             Document response = XMLUtils.parseDocument(is);
 

http://dive4elements.wald.intevation.org