Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/ManualPointsArtifact.java @ 3082:9e03960b3ab8
FixA: Lowered log level in parameter interpolation.
flys-artifacts/trunk@4678 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 18 Jun 2012 08:10:44 +0000 |
parents | 5642a83420f2 |
children | d35f28655fa6 |
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; |
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.ArrayList; |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 import java.util.List; |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 import org.apache.log4j.Logger; |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 import org.w3c.dom.Document; |
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.artifacts.Artifact; |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.artifacts.ArtifactFactory; |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.artifacts.CallMeta; |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 |
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.states.DefaultState; |
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 /** |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 * Artifact to store user-added points. |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 */ |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 public class ManualPointsArtifact |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 extends StaticFLYSArtifact |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 implements FacetTypes |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 { |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 /** The logger for this class. */ |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 private static Logger logger = Logger.getLogger(ManualPointsArtifact.class); |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 /** The name of the artifact. */ |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 public static final String ARTIFACT_NAME = "manualpoints"; |
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 /** |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 * Trivial Constructor. |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 */ |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 public ManualPointsArtifact() { |
2206
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2173
diff
changeset
|
40 logger.debug("ManualPointsArtifact.ManualPointsArtifact()"); |
2172
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 } |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 |
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 /** |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 * Gets called from factory, to set things up. |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 */ |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 @Override |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 public void setup( |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 String identifier, |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 ArtifactFactory factory, |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 Object context, |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 CallMeta callMeta, |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 Document data) |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 { |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 logger.debug("ManualPointsArtifact.setup"); |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
56 super.setup(identifier, factory, context, callMeta, data); |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
57 initialize(null, context, callMeta); |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 } |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
59 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
60 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 /** Return the name of this artifact. */ |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 public String getName() { |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 return ARTIFACT_NAME; |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
64 } |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
65 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
66 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
67 /** Access state data storing the jsonstring with points. */ |
2206
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2173
diff
changeset
|
68 public String getPointsData(String facetName) { |
e2124ca11adb
Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2173
diff
changeset
|
69 return getDataAsString(facetName + ".data"); |
2172
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
70 } |
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 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
73 /** Setup state and facet. */ |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
74 @Override |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
75 protected void initialize(Artifact artifact, Object context, CallMeta meta) { |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
76 logger.debug("ManualPointsArtifact.initialize"); |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
77 List<Facet> fs = new ArrayList<Facet>(); |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
78 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
79 DefaultState state = (DefaultState) getCurrentState(context); |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
80 state.computeInit(this, hash(), context, meta, fs); |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2206
diff
changeset
|
81 if (!fs.isEmpty()) { |
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2206
diff
changeset
|
82 logger.debug("Facets to add in ManualPointsArtifact.initialize ."); |
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2206
diff
changeset
|
83 facets.put(getCurrentStateId(), fs); |
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2206
diff
changeset
|
84 } |
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2206
diff
changeset
|
85 else { |
2172
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
86 logger.debug("No facets to add in ManualPointsArtifact.initialize (" |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
87 + state.getID() + ")."); |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
88 } |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
89 } |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
90 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
91 |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
92 /** |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
93 * Determines Facets initial disposition regarding activity (think of |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
94 * selection in Client ThemeList GUI). This will be checked one time |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
95 * when the facet enters a collections describe document. |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
96 * |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
97 * @param facetName name of the facet. |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
98 * @param index index of the facet. |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
99 * @return 0 if not active |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
100 */ |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
101 @Override |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
102 public int getInitialFacetActivity( |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
103 String outputName, |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
104 String facetName, |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
105 int index) |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
106 { |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
107 return 1; |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
108 } |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
109 } |
3ecc76ef25a9
New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
110 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |