changeset 133:d6197a05a87c

The 'rivers' service retrieves the rivers from backend now. flys-artifacts/trunk@1500 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 17 Mar 2011 12:17:37 +0000 (2011-03-17)
parents 8be4a837f20a
children f3dfa188d8b2
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/RiverService.java
diffstat 2 files changed, 19 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Mar 17 11:46:43 2011 +0000
+++ b/flys-artifacts/ChangeLog	Thu Mar 17 12:17:37 2011 +0000
@@ -1,3 +1,9 @@
+2011-03-17  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/services/RiverService.java:
+	  Removed TODO: the document contains the rivers provided by the backend
+	  now.
+
 2011-03-17	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* pom.xml: Added dependency to flys backend.
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/RiverService.java	Thu Mar 17 11:46:43 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/RiverService.java	Thu Mar 17 12:17:37 2011 +0000
@@ -1,5 +1,7 @@
 package de.intevation.flys.artifacts.services;
 
+import java.util.List;
+
 import org.apache.log4j.Logger;
 
 import org.w3c.dom.Document;
@@ -12,6 +14,10 @@
 
 import de.intevation.artifactdatabase.DefaultService;
 
+import de.intevation.flys.model.River;
+
+import de.intevation.flys.artifacts.model.RiverFactory;
+
 
 /**
  * This service provides information about the supported rivers by this
@@ -46,17 +52,17 @@
             ArtifactNamespaceContext.NAMESPACE_URI,
             ArtifactNamespaceContext.NAMESPACE_PREFIX);
 
-        // TODO fetch the rivers from database
+        List<River> allRivers = RiverFactory.getRivers();
+
         Element rivers = ec.create("rivers");
 
-        Element saar = ec.create("river");
-        ec.addAttr(saar, "name", "Saar", true);
+        for (River river: allRivers) {
+            Element r = ec.create("river");
+            ec.addAttr(r, "name", river.getName(), true);
 
-        Element mosel = ec.create("river");
-        ec.addAttr(mosel, "name", "Mosel", true);
+            rivers.appendChild(r);
+        }
 
-        rivers.appendChild(saar);
-        rivers.appendChild(mosel);
         result.appendChild(rivers);
 
         return result;

http://dive4elements.wald.intevation.org