Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/RiverService.java @ 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 |
parents | 888e3b1dcdd9 |
children | aeeb9054b7cf |
comparison
equal
deleted
inserted
replaced
132:8be4a837f20a | 133:d6197a05a87c |
---|---|
1 package de.intevation.flys.artifacts.services; | 1 package de.intevation.flys.artifacts.services; |
2 | |
3 import java.util.List; | |
2 | 4 |
3 import org.apache.log4j.Logger; | 5 import org.apache.log4j.Logger; |
4 | 6 |
5 import org.w3c.dom.Document; | 7 import org.w3c.dom.Document; |
6 import org.w3c.dom.Element; | 8 import org.w3c.dom.Element; |
9 | 11 |
10 import de.intevation.artifacts.common.ArtifactNamespaceContext; | 12 import de.intevation.artifacts.common.ArtifactNamespaceContext; |
11 import de.intevation.artifacts.common.utils.XMLUtils; | 13 import de.intevation.artifacts.common.utils.XMLUtils; |
12 | 14 |
13 import de.intevation.artifactdatabase.DefaultService; | 15 import de.intevation.artifactdatabase.DefaultService; |
16 | |
17 import de.intevation.flys.model.River; | |
18 | |
19 import de.intevation.flys.artifacts.model.RiverFactory; | |
14 | 20 |
15 | 21 |
16 /** | 22 /** |
17 * This service provides information about the supported rivers by this | 23 * This service provides information about the supported rivers by this |
18 * application. | 24 * application. |
44 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( | 50 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
45 result, | 51 result, |
46 ArtifactNamespaceContext.NAMESPACE_URI, | 52 ArtifactNamespaceContext.NAMESPACE_URI, |
47 ArtifactNamespaceContext.NAMESPACE_PREFIX); | 53 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
48 | 54 |
49 // TODO fetch the rivers from database | 55 List<River> allRivers = RiverFactory.getRivers(); |
56 | |
50 Element rivers = ec.create("rivers"); | 57 Element rivers = ec.create("rivers"); |
51 | 58 |
52 Element saar = ec.create("river"); | 59 for (River river: allRivers) { |
53 ec.addAttr(saar, "name", "Saar", true); | 60 Element r = ec.create("river"); |
61 ec.addAttr(r, "name", river.getName(), true); | |
54 | 62 |
55 Element mosel = ec.create("river"); | 63 rivers.appendChild(r); |
56 ec.addAttr(mosel, "name", "Mosel", true); | 64 } |
57 | 65 |
58 rivers.appendChild(saar); | |
59 rivers.appendChild(mosel); | |
60 result.appendChild(rivers); | 66 result.appendChild(rivers); |
61 | 67 |
62 return result; | 68 return result; |
63 } | 69 } |
64 } | 70 } |