Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/RiverService.java @ 3318:dbe2f85bf160
merged flys-artifacts/2.8
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:35 +0200 |
parents | 614ffddb860e |
children |
comparison
equal
deleted
inserted
replaced
2987:98c7a46ec5ae | 3318:dbe2f85bf160 |
---|---|
1 package de.intevation.flys.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 de.intevation.artifacts.CallMeta; | |
11 import de.intevation.artifacts.GlobalContext; | |
12 | |
13 import de.intevation.artifacts.common.ArtifactNamespaceContext; | |
14 import de.intevation.artifacts.common.utils.XMLUtils; | |
15 | |
16 import de.intevation.flys.model.River; | |
17 | |
18 import de.intevation.flys.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 : |