Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ManualPointsSingleState.java @ 2312:f911ddd93f58
Format multiple double values with a locale.
flys-artifacts/trunk@3992 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 09 Feb 2012 10:59:38 +0000 |
parents | e2124ca11adb |
children | 5642a83420f2 |
rev | line source |
---|---|
2172
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.states; |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 import java.util.List; |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 import org.apache.log4j.Logger; |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 import de.intevation.artifacts.CallMeta; |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.artifacts.CallContext; |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifactdatabase.state.Facet; |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.flys.artifacts.FLYSArtifact; |
2206
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2181
diff
changeset
|
13 import de.intevation.flys.artifacts.ManualPointsArtifact; |
2172
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.flys.artifacts.model.ManualPointsFacet; |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.flys.artifacts.model.FacetTypes; |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.flys.artifacts.resources.Resources; |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 /** |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 * The only state for an ManualPointArtifact. |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 */ |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 public class ManualPointsSingleState |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 extends DefaultState |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 implements FacetTypes |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 { |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 /** Developer-centric description of facet. */ |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 public static final String I18N_DESCRIPTION = "facet.longitudinal_section.manualpoint"; |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 /** The logger that is used in this state. */ |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 private static final Logger logger = Logger.getLogger(ManualPointsSingleState.class); |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 /** |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 * Add an ManualPointsFacet to list of Facets. |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 * |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 * @param artifact Ignored. |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 * @param hash Ignored. |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 * @param context Ignored. |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 * @param meta CallMeta to be used for internationalization. |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 * @param facets List to add ManualPointsFacet to. |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 * |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 * @return null. |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 */ |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 public Object compute( |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 FLYSArtifact artifact, |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 String hash, |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 CallMeta meta, |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 List<Facet> facets |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 ) { |
2206
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2181
diff
changeset
|
52 logger.debug("ManualPointsSingleState.compute()"); |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2181
diff
changeset
|
53 ManualPointsArtifact points = (ManualPointsArtifact) artifact; |
2172
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 |
2206
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2181
diff
changeset
|
55 // Add Facet per Diagram type if data given. |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2181
diff
changeset
|
56 for (ChartType ct: ChartType.values()) { |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2181
diff
changeset
|
57 String pointData = points.getDataAsString(ct + "." + MANUALPOINTS + ".data"); |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2181
diff
changeset
|
58 if (pointData != null && !pointData.equals("") && !pointData.equals("[]")) { |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2181
diff
changeset
|
59 String fName = ct + "." + MANUALPOINTS; |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2181
diff
changeset
|
60 ManualPointsFacet facet = new ManualPointsFacet( |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2181
diff
changeset
|
61 0, |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2181
diff
changeset
|
62 fName, |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2181
diff
changeset
|
63 Resources.getMsg(meta, "manualpoints", "Manual Points")); |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2181
diff
changeset
|
64 |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2181
diff
changeset
|
65 facets.add(facet); |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2181
diff
changeset
|
66 } |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2181
diff
changeset
|
67 else { |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2181
diff
changeset
|
68 //logger.debug("No points for " + ct); |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2181
diff
changeset
|
69 } |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2181
diff
changeset
|
70 } |
2172
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 return null; |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
73 } |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
74 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
75 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
76 @Override |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
77 public Object computeInit( |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
78 FLYSArtifact artifact, |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
79 String hash, |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
80 Object context, |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
81 CallMeta meta, |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
82 List<Facet> facets |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
83 ) { |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
84 return compute(artifact, hash, meta, facets); |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
85 } |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
86 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
87 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
88 @Override |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
89 public Object computeFeed( |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
90 FLYSArtifact artifact, |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
91 String hash, |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
92 CallContext context, |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
93 List<Facet> facets, |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
94 Object old |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
95 ) { |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
96 return compute(artifact, hash, context.getMeta(), facets); |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
97 } |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
98 } |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
99 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |