Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/server/FixingsOverviewServiceImpl.java @ 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 | 96d02c6f44a2 |
comparison
equal
deleted
inserted
replaced
2915:d20f16a430a9 | 2916:1f63e2ef03d2 |
---|---|
68 if (filter == null || filter.length() == 0) { | 68 if (filter == null || filter.length() == 0) { |
69 log.warn("Missing 'filter' parameter."); | 69 log.warn("Missing 'filter' parameter."); |
70 return null; | 70 return null; |
71 } | 71 } |
72 | 72 |
73 boolean debug = log.isDebugEnabled(); | |
74 | |
75 if (debug) { | |
76 log.debug("JSON filter: ------------------"); | |
77 log.debug(filter); | |
78 } | |
79 | |
73 Document filterDoc = XMLUtils.jsonToXML(filter); | 80 Document filterDoc = XMLUtils.jsonToXML(filter); |
74 | 81 |
75 if (filterDoc == null) { | 82 if (filterDoc == null) { |
76 log.warn("Creating filter document failed."); | 83 log.warn("Creating filter document failed."); |
77 return null; | 84 return null; |
78 } | 85 } |
79 | 86 |
80 /* filterDoc = XMLUtils.newDocument(); | 87 if (debug) { |
81 ElementCreator ec = new ElementCreator(filterDoc, null, null); | 88 log.debug("XML filter: ------------------"); |
82 Element f = ec.create("fixings"); | 89 log.debug(XMLUtils.toString(filterDoc)); |
83 Element r = ec.create("river"); | 90 } |
84 r.setAttribute("name", "Saar"); | 91 |
85 f.appendChild(r); | |
86 filterDoc.appendChild(f); | |
87 */ | |
88 try { | 92 try { |
89 String url = getServletContext().getInitParameter("server-url"); | 93 String url = getServletContext().getInitParameter("server-url"); |
90 HttpClient client = new HttpClientImpl(url, locale); | 94 HttpClient client = new HttpClientImpl(url, locale); |
91 Document resultDoc = | 95 Document resultDoc = |
92 client.callService(url, SERVICE_NAME, filterDoc); | 96 client.callService(url, SERVICE_NAME, filterDoc); |
93 FixingsOverviewInfo i = getInfo(resultDoc, uuid, checkboxes, callback); | 97 |
98 if (debug) { | |
99 log.debug("Result XML: -----------"); | |
100 log.debug(XMLUtils.toString(resultDoc)); | |
101 } | |
102 | |
103 FixingsOverviewInfo i = | |
104 getInfo(resultDoc, uuid, checkboxes, callback); | |
94 return i; | 105 return i; |
95 } | 106 } |
96 catch (ConnectionException ce) { | 107 catch (ConnectionException ce) { |
97 log.error(ce); | 108 log.error(ce); |
98 } | 109 } |
104 Document doc, | 115 Document doc, |
105 String uuid, | 116 String uuid, |
106 boolean checkboxes, | 117 boolean checkboxes, |
107 String callback | 118 String callback |
108 ) { | 119 ) { |
109 | |
110 InputStream transform = getServletContext() | 120 InputStream transform = getServletContext() |
111 .getResourceAsStream(XSL_TRANSFORM); | 121 .getResourceAsStream(XSL_TRANSFORM); |
112 | 122 |
113 if (transform == null) { | 123 if (transform == null) { |
114 log.warn("transform not found"); | 124 log.warn("transform not found"); |
128 finally { | 138 finally { |
129 try { transform.close(); } | 139 try { transform.close(); } |
130 catch (IOException ioe) {} | 140 catch (IOException ioe) {} |
131 } | 141 } |
132 | 142 |
143 if (log.isDebugEnabled()) { | |
144 log.debug("--------------------------------------"); | |
145 log.debug(result); | |
146 log.debug("--------------------------------------"); | |
147 } | |
148 | |
133 int rid = -1; | 149 int rid = -1; |
134 double from = -1; | 150 double from = -1; |
135 double to = -1; | 151 double to = -1; |
136 | 152 |
137 String rid_str = XMLUtils.xpathString(doc, XPATH_RID, null); | 153 String rid_str = XMLUtils.xpathString(doc, XPATH_RID, null); |
158 result); | 174 result); |
159 } | 175 } |
160 | 176 |
161 | 177 |
162 protected List<FixEvent> getFixEvents(Document doc) { | 178 protected List<FixEvent> getFixEvents(Document doc) { |
179 List<FixEvent> list = new ArrayList<FixEvent>(); | |
180 | |
163 NodeList events = (NodeList) XMLUtils.xpath( | 181 NodeList events = (NodeList) XMLUtils.xpath( |
164 doc, | 182 doc, |
165 XPATH_EVENT, | 183 XPATH_EVENT, |
166 XPathConstants.NODESET, | 184 XPathConstants.NODESET, |
167 null); | 185 null); |
168 | 186 |
169 if (events == null || events.getLength() == 0) { | 187 if (events == null || events.getLength() == 0) { |
170 log.warn("No events in Overview!"); | 188 log.warn("No events in Overview!"); |
171 return null; | 189 return list; |
172 } | 190 } |
173 | 191 |
174 List<FixEvent> list = new ArrayList<FixEvent>(); | |
175 for (int i = 0, E = events.getLength(); i < E; i++) { | 192 for (int i = 0, E = events.getLength(); i < E; i++) { |
176 Element n = (Element)events.item(i); | 193 Element n = (Element)events.item(i); |
177 List<Sector> sectors = getSectors(n); | 194 List<Sector> sectors = getSectors(n); |
178 String cid = n.getAttribute("cid"); | 195 String cid = n.getAttribute("cid"); |
179 String date = n.getAttribute("date");; | 196 String date = n.getAttribute("date");; |