Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FixingsOverviewService.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 | 9c147bbffc36 |
children |
comparison
equal
deleted
inserted
replaced
2987:98c7a46ec5ae | 3318:dbe2f85bf160 |
---|---|
1 package de.intevation.flys.artifacts.services; | |
2 | |
3 import de.intevation.artifacts.CallMeta; | |
4 import de.intevation.artifacts.GlobalContext; | |
5 | |
6 import de.intevation.artifacts.common.utils.XMLUtils; | |
7 | |
8 import de.intevation.flys.artifacts.model.FixingsFilterBuilder; | |
9 | |
10 import de.intevation.flys.artifacts.model.FixingsOverview.Fixing.Filter; | |
11 | |
12 import de.intevation.flys.artifacts.model.Range; | |
13 | |
14 import de.intevation.flys.artifacts.model.FixingsOverview; | |
15 import de.intevation.flys.artifacts.model.FixingsOverviewFactory; | |
16 | |
17 import org.apache.log4j.Logger; | |
18 | |
19 import org.w3c.dom.Document; | |
20 import org.w3c.dom.Element; | |
21 import org.w3c.dom.NodeList; | |
22 | |
23 public class FixingsOverviewService | |
24 extends FLYSService | |
25 { | |
26 private static Logger log = | |
27 Logger.getLogger(FixingsOverviewService.class); | |
28 | |
29 public FixingsOverviewService() { | |
30 } | |
31 | |
32 @Override | |
33 public Document doProcess( | |
34 Document data, | |
35 GlobalContext globalContext, | |
36 CallMeta callMeta | |
37 ) { | |
38 log.debug("FixingsOverviewService.doProcess"); | |
39 | |
40 Document document = XMLUtils.newDocument(); | |
41 | |
42 NodeList nodes = data.getElementsByTagName("river"); | |
43 | |
44 String river = nodes.getLength() > 0 | |
45 ? ((Element)nodes.item(0)).getAttribute("name") | |
46 : ""; | |
47 | |
48 FixingsOverview overview = FixingsOverviewFactory.getOverview(river); | |
49 | |
50 if (overview != null) { | |
51 FixingsFilterBuilder ffb = new FixingsFilterBuilder(data); | |
52 Range range = ffb.getRange(); | |
53 Filter filter = ffb.getFilter(); | |
54 overview.generateOverview(document, range, filter); | |
55 } | |
56 else { | |
57 log.warn("No overview for river '" + river + "' available."); | |
58 } | |
59 | |
60 return document; | |
61 } | |
62 } | |
63 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |