Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/SedimentLoadInfoServiceImpl.java @ 5355:480d2f1f61cc
Fix import_rivers script for postgres
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 20 Mar 2013 19:02:10 +0100 |
parents | 1f98a3a89e13 |
children |
rev | line source |
---|---|
4298
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.server; |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
2 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
3 import java.util.ArrayList; |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
4 import java.util.List; |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
5 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
6 import org.apache.log4j.Logger; |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
7 import org.w3c.dom.Document; |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
8 import org.w3c.dom.Element; |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
9 import org.w3c.dom.NodeList; |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
10 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
11 import com.google.gwt.user.server.rpc.RemoteServiceServlet; |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
12 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.artifacts.common.ArtifactNamespaceContext; |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.artifacts.common.utils.XMLUtils; |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.artifacts.httpclient.exceptions.ConnectionException; |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.artifacts.httpclient.http.HttpClient; |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.artifacts.httpclient.http.HttpClientImpl; |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.flys.client.client.services.SedimentLoadInfoService; |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.flys.client.shared.exceptions.ServerException; |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.flys.client.shared.model.SedimentLoadInfoObject; |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.flys.client.shared.model.SedimentLoadInfoObjectImpl; |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
24 public class SedimentLoadInfoServiceImpl |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
25 extends RemoteServiceServlet |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
26 implements SedimentLoadInfoService |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
27 { |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
28 private static final Logger logger = |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
29 Logger.getLogger(SedimentLoadInfoServiceImpl.class); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
30 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
31 public static final String ERROR_NO_SEDIMENTLOADINFO_FOUND = |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
32 "error_no_sedimentloadinfo_found"; |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
33 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
34 @Override |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 public SedimentLoadInfoObject[] getSedimentLoadInfo( |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 String locale, |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 String river, |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
38 String type, |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
39 double startKm, |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
40 double endKm) |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
41 throws ServerException |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
42 { |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
43 logger.info("SedimentLoadInfoServiceImpl.getSedimentLoadInfo"); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
44 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
45 String url = getServletContext().getInitParameter("server-url"); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
46 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
47 Document doc = XMLUtils.newDocument(); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
48 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
49 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
50 doc, |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
51 ArtifactNamespaceContext.NAMESPACE_URI, |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
52 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
53 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
54 Element riverEl = ec.create("river"); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
55 Element location = ec.create("location"); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
56 Element from = ec.create("from"); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
57 Element to = ec.create("to"); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
58 Element typeEl = ec.create("type"); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
59 riverEl.setTextContent(river); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
60 from.setTextContent(String.valueOf(startKm)); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
61 to.setTextContent(String.valueOf(endKm)); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
62 typeEl.setTextContent(type); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
63 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
64 location.appendChild(from); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
65 location.appendChild(to); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
66 riverEl.appendChild(location); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
67 riverEl.appendChild(typeEl); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
68 doc.appendChild(riverEl); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
69 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
70 HttpClient client = new HttpClientImpl(url, locale); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
71 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
72 try { |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
73 Document result = client.callService(url, "sedimentloadinfo", doc); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
74 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
75 logger.debug("Extract sedimentload info objects now."); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
76 SedimentLoadInfoObject[] objects = |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
77 extractSedimentLoadInfoObjects(result); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
78 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
79 if (objects != null && objects.length > 0) { |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
80 return objects; |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
81 } |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
82 } |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
83 catch (ConnectionException ce) { |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
84 logger.error(ce, ce); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
85 } |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
86 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
87 throw new ServerException(ERROR_NO_SEDIMENTLOADINFO_FOUND); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
88 } |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
89 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
90 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
91 /** |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
92 * Extracts all distance info objects from <i>result</i> document. |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
93 * |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
94 * @param result The document retrieved by the server. |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
95 * |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
96 * @return a list of DistanceInfoObjects. |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
97 */ |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
98 protected SedimentLoadInfoObject[] extractSedimentLoadInfoObjects( |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
99 Document result) |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
100 throws ServerException |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
101 { |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
102 NodeList list = result.getElementsByTagName("sedimentload"); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
103 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
104 if (list == null || list.getLength() == 0) { |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
105 logger.warn("No sedimentload info found."); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
106 throw new ServerException(ERROR_NO_SEDIMENTLOADINFO_FOUND); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
107 } |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
108 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
109 int num = list.getLength(); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
110 logger.debug("Response contains " + num + " objects."); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
111 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
112 List<SedimentLoadInfoObject> objects = |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
113 new ArrayList<SedimentLoadInfoObject>(num); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
114 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
115 for (int i = 0; i < num; i++) { |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
116 SedimentLoadInfoObject obj = buildSedimentLoadInfoObject( |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
117 (Element)list.item(i)); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
118 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
119 if (obj != null) { |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
120 objects.add(obj); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
121 } |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
122 } |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
123 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
124 logger.debug("Retrieved " + objects.size() + " sediment loads."); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
125 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
126 return (SedimentLoadInfoObject[]) |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
127 objects.toArray(new SedimentLoadInfoObject[num]); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
128 } |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
129 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
130 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
131 /** |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
132 * Extracts information for a single distance info object and intializes an |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
133 * DistanceInfoObject with them. |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
134 * |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
135 * @param node The node that contains the information. |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
136 * |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
137 * @return a valid DistanceInfoObject. |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
138 */ |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
139 protected SedimentLoadInfoObject buildSedimentLoadInfoObject(Element node) { |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
140 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
141 String desc = node.getAttribute("description").trim(); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
142 String date = node.getAttribute("date").trim(); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
143 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
144 if (desc.length() > 0 && date.length() > 0) { |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
145 return new SedimentLoadInfoObjectImpl(desc, date); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
146 } |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
147 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
148 logger.warn("Invalid sediment load info object found."); |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
149 |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
150 return null; |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
151 } |
1f98a3a89e13
New client side service for sediment load infos.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
152 } |