changeset 2916:1f63e2ef03d2

Added more debug output about the transmitted fix overview documents. flys-client/trunk@4738 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 21 Jun 2012 11:32:22 +0000
parents d20f16a430a9
children be99bf1aa59b
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/server/FixingsOverviewServiceImpl.java
diffstat 2 files changed, 35 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Thu Jun 21 11:04:46 2012 +0000
+++ b/flys-client/ChangeLog	Thu Jun 21 11:32:22 2012 +0000
@@ -1,3 +1,8 @@
+2012-06-21	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/server/FixingsOverviewServiceImpl.java:
+	  Added more debug ouput about the transmitted documents.
+
 2012-06-21	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/server/FixingsOverviewServiceImpl.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/server/FixingsOverviewServiceImpl.java	Thu Jun 21 11:04:46 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/FixingsOverviewServiceImpl.java	Thu Jun 21 11:32:22 2012 +0000
@@ -70,6 +70,13 @@
             return null;
         }
 
+        boolean debug = log.isDebugEnabled();
+
+        if (debug) {
+            log.debug("JSON filter: ------------------");
+            log.debug(filter);
+        }
+
         Document filterDoc = XMLUtils.jsonToXML(filter);
 
         if (filterDoc == null) {
@@ -77,20 +84,24 @@
             return null;
         }
 
-/*        filterDoc = XMLUtils.newDocument();
-        ElementCreator ec = new ElementCreator(filterDoc, null, null);
-        Element f = ec.create("fixings");
-        Element r = ec.create("river");
-        r.setAttribute("name", "Saar");
-        f.appendChild(r);
-        filterDoc.appendChild(f);
-*/
+        if (debug) {
+            log.debug("XML filter: ------------------");
+            log.debug(XMLUtils.toString(filterDoc));
+        }
+
         try {
             String url = getServletContext().getInitParameter("server-url");
             HttpClient client = new HttpClientImpl(url, locale);
-            Document resultDoc =
+            Document resultDoc = 
                 client.callService(url, SERVICE_NAME, filterDoc);
-            FixingsOverviewInfo i = getInfo(resultDoc, uuid, checkboxes, callback);
+
+            if (debug) {
+                log.debug("Result XML: -----------");
+                log.debug(XMLUtils.toString(resultDoc));
+            }
+
+            FixingsOverviewInfo i =
+                getInfo(resultDoc, uuid, checkboxes, callback);
             return i;
         }
         catch (ConnectionException ce) {
@@ -106,7 +117,6 @@
         boolean  checkboxes,
         String   callback
     ) {
-
         InputStream transform = getServletContext()
             .getResourceAsStream(XSL_TRANSFORM);
 
@@ -130,6 +140,12 @@
             catch (IOException ioe) {}
         }
 
+        if (log.isDebugEnabled()) {
+            log.debug("--------------------------------------");
+            log.debug(result);
+            log.debug("--------------------------------------");
+        }
+
         int    rid  = -1;
         double from = -1;
         double to   = -1;
@@ -160,6 +176,8 @@
 
 
     protected List<FixEvent> getFixEvents(Document doc) {
+        List<FixEvent> list = new ArrayList<FixEvent>();
+
         NodeList events = (NodeList) XMLUtils.xpath(
             doc,
             XPATH_EVENT,
@@ -168,10 +186,9 @@
 
         if (events == null || events.getLength() == 0) {
             log.warn("No events in Overview!");
-            return null;
+            return list;
         }
 
-        List<FixEvent> list = new ArrayList<FixEvent>();
         for (int i = 0, E = events.getLength(); i < E; i++) {
             Element n = (Element)events.item(i);
             List<Sector> sectors = getSectors(n);

http://dive4elements.wald.intevation.org