Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/StaticState.java @ 2017:e384d78ff78b
Cosmetics.
flys-artifacts/trunk@3472 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 20 Dec 2011 06:26:25 +0000 |
parents | 94c4dd5aaf20 |
children | 6cdd994ee8a4 |
rev | line source |
---|---|
1072
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.states; |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
1968
18928f0f339b
Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
3 import java.util.List; |
18928f0f339b
Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
4 |
1072
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 import org.apache.log4j.Logger; |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 import de.intevation.flys.artifacts.model.FacetTypes; |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 |
1968
18928f0f339b
Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
9 import de.intevation.artifactdatabase.state.Facet; |
18928f0f339b
Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
10 import de.intevation.artifactdatabase.state.DefaultOutput; |
18928f0f339b
Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
11 |
1971
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
12 import de.intevation.flys.artifacts.FLYSArtifact; |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
13 |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
14 import de.intevation.artifacts.CallContext; |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
15 import de.intevation.artifacts.CallMeta; |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
16 |
1072
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 /** |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 * Yet, a non-abstract DefaultState. |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 */ |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 public class StaticState |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 extends DefaultState |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 implements FacetTypes |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 { |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 /** The logger that is used in this state. */ |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 private static final Logger logger = Logger.getLogger(StaticState.class); |
1112
aeae4d20f32f
Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1072
diff
changeset
|
26 |
1787
f3be8fa1ec62
Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1112
diff
changeset
|
27 |
f3be8fa1ec62
Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1112
diff
changeset
|
28 /** |
f3be8fa1ec62
Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1112
diff
changeset
|
29 * Trivial constructor, sets id and description. |
f3be8fa1ec62
Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1112
diff
changeset
|
30 * @param id String used for both id and description. |
f3be8fa1ec62
Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1112
diff
changeset
|
31 */ |
f3be8fa1ec62
Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1112
diff
changeset
|
32 public StaticState(String id) { |
f3be8fa1ec62
Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1112
diff
changeset
|
33 this(id, id); |
f3be8fa1ec62
Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1112
diff
changeset
|
34 } |
f3be8fa1ec62
Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1112
diff
changeset
|
35 |
f3be8fa1ec62
Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1112
diff
changeset
|
36 |
1112
aeae4d20f32f
Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1072
diff
changeset
|
37 public StaticState(String id, String description) { |
aeae4d20f32f
Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1072
diff
changeset
|
38 super(); |
aeae4d20f32f
Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1072
diff
changeset
|
39 setID(id); |
aeae4d20f32f
Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1072
diff
changeset
|
40 setDescription(description); |
aeae4d20f32f
Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1072
diff
changeset
|
41 } |
1968
18928f0f339b
Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
42 |
18928f0f339b
Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
43 public void addDefaultChartOutput(String nameDesc, List<Facet> facets) { |
18928f0f339b
Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
44 DefaultOutput output = new DefaultOutput(nameDesc, |
18928f0f339b
Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
45 nameDesc, "image/png", facets, "chart"); |
18928f0f339b
Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
46 getOutputs().add(output); |
18928f0f339b
Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
47 } |
1971
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
48 |
2004
94c4dd5aaf20
Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1971
diff
changeset
|
49 public static void addDefaultChartOutput( |
94c4dd5aaf20
Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1971
diff
changeset
|
50 DefaultState state, |
94c4dd5aaf20
Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1971
diff
changeset
|
51 String nameDesc, |
94c4dd5aaf20
Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1971
diff
changeset
|
52 List<Facet> facets |
94c4dd5aaf20
Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1971
diff
changeset
|
53 ) { |
94c4dd5aaf20
Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1971
diff
changeset
|
54 DefaultOutput output = new DefaultOutput(nameDesc, |
94c4dd5aaf20
Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1971
diff
changeset
|
55 nameDesc, "image/png", facets, "chart"); |
94c4dd5aaf20
Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1971
diff
changeset
|
56 state.getOutputs().add(output); |
94c4dd5aaf20
Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1971
diff
changeset
|
57 } |
94c4dd5aaf20
Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1971
diff
changeset
|
58 |
1971
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
59 |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
60 /** |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
61 * Do nothing (override to include your logic). |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
62 * @param facets List of facets (to add to). |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
63 */ |
2004
94c4dd5aaf20
Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1971
diff
changeset
|
64 public Object staticCompute(List<Facet> facets, FLYSArtifact artifact) { |
94c4dd5aaf20
Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1971
diff
changeset
|
65 return staticCompute(facets); |
94c4dd5aaf20
Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1971
diff
changeset
|
66 } |
94c4dd5aaf20
Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1971
diff
changeset
|
67 |
1971
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
68 public Object staticCompute(List<Facet> facets) { |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
69 return null; |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
70 } |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
71 |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
72 |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
73 /** Call staticCompute to allow easy adjustments. */ |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
74 @Override |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
75 public Object computeAdvance( |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
76 FLYSArtifact artifact, |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
77 String hash, |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
78 CallContext context, |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
79 List<Facet> facets, |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
80 Object old |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
81 ) { |
2004
94c4dd5aaf20
Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1971
diff
changeset
|
82 return staticCompute(facets, artifact); |
1971
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
83 } |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
84 |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
85 |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
86 /** Call staticCompute to allow easy adjustments. */ |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
87 @Override |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
88 public Object computeFeed( |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
89 FLYSArtifact artifact, |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
90 String hash, |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
91 CallContext context, |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
92 List<Facet> facets, |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
93 Object old |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
94 ) { |
2004
94c4dd5aaf20
Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1971
diff
changeset
|
95 return staticCompute(facets, artifact); |
1971
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
96 } |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
97 |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
98 |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
99 /** Call staticCompute to allow easy adjustments. */ |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
100 @Override |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
101 public Object computeInit( |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
102 FLYSArtifact artifact, |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
103 String hash, |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
104 Object context, |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
105 CallMeta meta, |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
106 List<Facet> facets |
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
107 ) { |
2004
94c4dd5aaf20
Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1971
diff
changeset
|
108 return staticCompute(facets, artifact); |
1971
741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1968
diff
changeset
|
109 } |
1072
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
110 } |
1968
18928f0f339b
Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
111 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |