Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FixingsOverviewService.java @ 4693:a91d3bde7255
Change parameters of updateCollectionName
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Mon, 17 Dec 2012 16:15:05 +0100 |
parents | 9c147bbffc36 |
children |
rev | line source |
---|---|
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.services; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 import de.intevation.artifacts.CallMeta; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 import de.intevation.artifacts.GlobalContext; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 import de.intevation.artifacts.common.utils.XMLUtils; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 |
2608
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2564
diff
changeset
|
8 import de.intevation.flys.artifacts.model.FixingsFilterBuilder; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2564
diff
changeset
|
9 |
2564
3f038d54bc87
FixingsOverviewService: Made the filter mechanisms available via the incoming XML document.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
10 import de.intevation.flys.artifacts.model.FixingsOverview.Fixing.Filter; |
3f038d54bc87
FixingsOverviewService: Made the filter mechanisms available via the incoming XML document.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
11 |
3138
9c147bbffc36
FixA: Move Range out of FixingsOverview
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2608
diff
changeset
|
12 import de.intevation.flys.artifacts.model.Range; |
2564
3f038d54bc87
FixingsOverviewService: Made the filter mechanisms available via the incoming XML document.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
13 |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.flys.artifacts.model.FixingsOverview; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.flys.artifacts.model.FixingsOverviewFactory; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 import org.apache.log4j.Logger; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 import org.w3c.dom.Document; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 import org.w3c.dom.Element; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 import org.w3c.dom.NodeList; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 public class FixingsOverviewService |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 extends FLYSService |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 private static Logger log = |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 Logger.getLogger(FixingsOverviewService.class); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 public FixingsOverviewService() { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 @Override |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 public Document doProcess( |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 Document data, |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 GlobalContext globalContext, |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 CallMeta callMeta |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 ) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 log.debug("FixingsOverviewService.doProcess"); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 Document document = XMLUtils.newDocument(); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 NodeList nodes = data.getElementsByTagName("river"); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 String river = nodes.getLength() > 0 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 ? ((Element)nodes.item(0)).getAttribute("name") |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 : ""; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 FixingsOverview overview = FixingsOverviewFactory.getOverview(river); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 if (overview != null) { |
2608
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2564
diff
changeset
|
51 FixingsFilterBuilder ffb = new FixingsFilterBuilder(data); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2564
diff
changeset
|
52 Range range = ffb.getRange(); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2564
diff
changeset
|
53 Filter filter = ffb.getFilter(); |
2564
3f038d54bc87
FixingsOverviewService: Made the filter mechanisms available via the incoming XML document.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
54 overview.generateOverview(document, range, filter); |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 else { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 log.warn("No overview for river '" + river + "' available."); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 return document; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |