Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FixingsKMChartService.java @ 2615:b0597a63fe70
More code for the fixings km chart service.
flys-artifacts/trunk@4199 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 04 Apr 2012 18:30:44 +0000 |
parents | 036e234c2385 |
children | cc0fa1798a3c |
rev | line source |
---|---|
2614
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.services; |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
2615
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
3 import java.util.List; |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
4 |
2614
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 import de.intevation.artifactdatabase.DefaultService; |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 import de.intevation.artifacts.CallMeta; |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.artifacts.GlobalContext; |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.artifacts.Service; |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
2615
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
11 import de.intevation.flys.artifacts.model.FixingsFilterBuilder; |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
12 import de.intevation.flys.artifacts.model.FixingsOverview; |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
13 import de.intevation.flys.artifacts.model.FixingsColumn; |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
14 import de.intevation.flys.artifacts.model.FixingsColumnFactory; |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
15 import de.intevation.flys.artifacts.model.FixingsOverviewFactory; |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
16 |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
17 import de.intevation.flys.artifacts.model.FixingsOverview.Fixing; |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
18 |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
19 import de.intevation.flys.backend.SessionHolder; |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
20 |
2614
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 import org.apache.log4j.Logger; |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 import org.w3c.dom.Document; |
2615
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
24 import org.w3c.dom.Element; |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
25 import org.w3c.dom.NodeList; |
2614
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 public class FixingsKMChartService |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 extends DefaultService |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 { |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 private static final Logger log = |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 Logger.getLogger(FixingsKMChartService.class); |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 |
2615
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
33 public static final byte [] EMPTY = { |
2614
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 (byte)0x89, (byte)0x50, (byte)0x4e, (byte)0x47, |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 (byte)0x0d, (byte)0x0a, (byte)0x1a, (byte)0x0a, |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x0d, |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 (byte)0x49, (byte)0x48, (byte)0x44, (byte)0x52, |
2615
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
38 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01, |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
39 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01, |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
40 (byte)0x08, (byte)0x00, (byte)0x00, (byte)0x00, |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
41 (byte)0x00, (byte)0x3a, (byte)0x7e, (byte)0x9b, |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
42 (byte)0x55, (byte)0x00, (byte)0x00, (byte)0x00, |
2614
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 (byte)0x01, (byte)0x73, (byte)0x52, (byte)0x47, |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 (byte)0x42, (byte)0x00, (byte)0xae, (byte)0xce, |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 (byte)0x1c, (byte)0xe9, (byte)0x00, (byte)0x00, |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 (byte)0x00, (byte)0x09, (byte)0x70, (byte)0x48, |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 (byte)0x59, (byte)0x73, (byte)0x00, (byte)0x00, |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 (byte)0x0b, (byte)0x13, (byte)0x00, (byte)0x00, |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 (byte)0x0b, (byte)0x13, (byte)0x01, (byte)0x00, |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 (byte)0x9a, (byte)0x9c, (byte)0x18, (byte)0x00, |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 (byte)0x00, (byte)0x00, (byte)0x07, (byte)0x74, |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 (byte)0x49, (byte)0x4d, (byte)0x45, (byte)0x07, |
2615
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
53 (byte)0xdc, (byte)0x04, (byte)0x04, (byte)0x10, |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
54 (byte)0x30, (byte)0x15, (byte)0x7d, (byte)0x77, |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
55 (byte)0x36, (byte)0x0b, (byte)0x00, (byte)0x00, |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
56 (byte)0x00, (byte)0x08, (byte)0x74, (byte)0x45, |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
57 (byte)0x58, (byte)0x74, (byte)0x43, (byte)0x6f, |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
58 (byte)0x6d, (byte)0x6d, (byte)0x65, (byte)0x6e, |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
59 (byte)0x74, (byte)0x00, (byte)0xf6, (byte)0xcc, |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
60 (byte)0x96, (byte)0xbf, (byte)0x00, (byte)0x00, |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
61 (byte)0x00, (byte)0x0a, (byte)0x49, (byte)0x44, |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
62 (byte)0x41, (byte)0x54, (byte)0x08, (byte)0xd7, |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
63 (byte)0x63, (byte)0xf8, (byte)0x0f, (byte)0x00, |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
64 (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x00, |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
65 (byte)0x1b, (byte)0xb6, (byte)0xee, (byte)0x56, |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
66 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
67 (byte)0x49, (byte)0x45, (byte)0x4e, (byte)0x44, |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
68 (byte)0xae, (byte)0x42, (byte)0x60, (byte)0x82 |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
69 }; |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
70 |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
71 private static final Output empty() { |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
72 return new Output(EMPTY, "image/png"); |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
73 } |
2614
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
74 |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 @Override |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 public Service.Output process( |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
77 Document data, |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
78 GlobalContext globalContext, |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
79 CallMeta callMeta |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
80 ) { |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
81 log.debug("FixingsKMChartService.process"); |
2615
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
82 |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
83 SessionHolder.acquire(); |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
84 try { |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
85 return doProcess(data, globalContext, callMeta); |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
86 } |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
87 finally { |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
88 SessionHolder.HOLDER.get().close(); |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
89 SessionHolder.release(); |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
90 } |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
91 } |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
92 |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
93 protected Service.Output doProcess( |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
94 Document data, |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
95 GlobalContext globalContext, |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
96 CallMeta callMeta |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
97 ) { |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
98 NodeList rivers = data.getElementsByTagName("river"); |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
99 NodeList kms = data.getElementsByTagName("km"); |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
100 |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
101 if (rivers.getLength() == 0 || kms.getLength() == 0) { |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
102 log.warn("Missing river and/or km."); |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
103 return empty(); |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
104 } |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
105 |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
106 String river = ((Element)rivers.item(0)).getAttribute("name"); |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
107 String kmS = ((Element)kms .item(0)).getAttribute("value"); |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
108 |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
109 if (river.length() == 0 || kmS.length() == 0) { |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
110 log.warn("River and/or km empty string."); |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
111 return empty(); |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
112 } |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
113 |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
114 double km; |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
115 try { |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
116 km = Double.parseDouble(kmS); |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
117 } |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
118 catch (NumberFormatException nfe) { |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
119 log.warn("Km '" + kmS + " is not a valid number."); |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
120 return empty(); |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
121 } |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
122 |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
123 FixingsOverview overview = FixingsOverviewFactory.getOverview(river); |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
124 |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
125 if (overview == null) { |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
126 log.warn("No overview found for river '" + river + "'"); |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
127 return empty(); |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
128 } |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
129 |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
130 FixingsFilterBuilder ffb = new FixingsFilterBuilder(data); |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
131 |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
132 List<Fixing.Column> columns = overview.filter( |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
133 ffb.getRange(), |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
134 ffb.getFilter()); |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
135 |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
136 for (Fixing.Column column: columns) { |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
137 FixingsColumn columnData = |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
138 FixingsColumnFactory.INSTANCE.getColumnData(column); |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
139 if (columnData == null) { |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
140 continue; |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
141 } |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
142 } |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
143 // TODO: Implement chart generation! |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
144 |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2614
diff
changeset
|
145 return empty(); |
2614
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
146 } |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
147 } |
036e234c2385
Added service to generate a chart of fixings for given river and km applied
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
148 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |