Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/services/RiverService.java @ 5838:5aa05a7a34b7
Rename modules to more fitting names.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 15:23:37 +0200 |
parents | flys-artifacts/src/main/java/org/dive4elements/river/artifacts/services/RiverService.java@bd047b71ab37 |
children | 4897a58c8746 |
comparison
equal
deleted
inserted
replaced
5837:d9901a08d0a6 | 5838:5aa05a7a34b7 |
---|---|
1 package org.dive4elements.river.artifacts.services; | |
2 | |
3 import java.util.List; | |
4 | |
5 import org.apache.log4j.Logger; | |
6 | |
7 import org.w3c.dom.Document; | |
8 import org.w3c.dom.Element; | |
9 | |
10 import org.dive4elements.artifacts.CallMeta; | |
11 import org.dive4elements.artifacts.GlobalContext; | |
12 | |
13 import org.dive4elements.artifacts.common.ArtifactNamespaceContext; | |
14 import org.dive4elements.artifacts.common.utils.XMLUtils; | |
15 | |
16 import org.dive4elements.river.model.River; | |
17 | |
18 import org.dive4elements.river.artifacts.model.RiverFactory; | |
19 | |
20 | |
21 /** | |
22 * This service provides information about the supported rivers by this | |
23 * application. | |
24 * | |
25 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | |
26 */ | |
27 public class RiverService extends FLYSService { | |
28 | |
29 /** The logger used in this service.*/ | |
30 private static Logger logger = Logger.getLogger(RiverService.class); | |
31 | |
32 | |
33 protected Document doProcess( | |
34 Document data, | |
35 GlobalContext globalContext, | |
36 CallMeta callMeta | |
37 ) { | |
38 logger.debug("RiverService.process"); | |
39 | |
40 Document result = XMLUtils.newDocument(); | |
41 | |
42 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( | |
43 result, | |
44 ArtifactNamespaceContext.NAMESPACE_URI, | |
45 ArtifactNamespaceContext.NAMESPACE_PREFIX); | |
46 | |
47 List<River> allRivers = RiverFactory.getRivers(); | |
48 | |
49 Element rivers = ec.create("rivers"); | |
50 | |
51 for (River river: allRivers) { | |
52 Element r = ec.create("river"); | |
53 ec.addAttr(r, "name", river.getName(), true); | |
54 | |
55 rivers.appendChild(r); | |
56 } | |
57 | |
58 result.appendChild(rivers); | |
59 | |
60 return result; | |
61 } | |
62 } | |
63 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |