Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/StaticState.java @ 3468:f37e7e8907cb
merged flys-artifacts/2.8.1
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:39 +0200 |
parents | 94c4dd5aaf20 |
children | 6cdd994ee8a4 |
comparison
equal
deleted
inserted
replaced
3387:5ffad8bde8ad | 3468:f37e7e8907cb |
---|---|
1 package de.intevation.flys.artifacts.states; | |
2 | |
3 import java.util.List; | |
4 | |
5 import org.apache.log4j.Logger; | |
6 | |
7 import de.intevation.flys.artifacts.model.FacetTypes; | |
8 | |
9 import de.intevation.artifactdatabase.state.Facet; | |
10 import de.intevation.artifactdatabase.state.DefaultOutput; | |
11 | |
12 import de.intevation.flys.artifacts.FLYSArtifact; | |
13 | |
14 import de.intevation.artifacts.CallContext; | |
15 import de.intevation.artifacts.CallMeta; | |
16 | |
17 /** | |
18 * Yet, a non-abstract DefaultState. | |
19 */ | |
20 public class StaticState | |
21 extends DefaultState | |
22 implements FacetTypes | |
23 { | |
24 /** The logger that is used in this state. */ | |
25 private static final Logger logger = Logger.getLogger(StaticState.class); | |
26 | |
27 | |
28 /** | |
29 * Trivial constructor, sets id and description. | |
30 * @param id String used for both id and description. | |
31 */ | |
32 public StaticState(String id) { | |
33 this(id, id); | |
34 } | |
35 | |
36 | |
37 public StaticState(String id, String description) { | |
38 super(); | |
39 setID(id); | |
40 setDescription(description); | |
41 } | |
42 | |
43 public void addDefaultChartOutput(String nameDesc, List<Facet> facets) { | |
44 DefaultOutput output = new DefaultOutput(nameDesc, | |
45 nameDesc, "image/png", facets, "chart"); | |
46 getOutputs().add(output); | |
47 } | |
48 | |
49 public static void addDefaultChartOutput( | |
50 DefaultState state, | |
51 String nameDesc, | |
52 List<Facet> facets | |
53 ) { | |
54 DefaultOutput output = new DefaultOutput(nameDesc, | |
55 nameDesc, "image/png", facets, "chart"); | |
56 state.getOutputs().add(output); | |
57 } | |
58 | |
59 | |
60 /** | |
61 * Do nothing (override to include your logic). | |
62 * @param facets List of facets (to add to). | |
63 */ | |
64 public Object staticCompute(List<Facet> facets, FLYSArtifact artifact) { | |
65 return staticCompute(facets); | |
66 } | |
67 | |
68 public Object staticCompute(List<Facet> facets) { | |
69 return null; | |
70 } | |
71 | |
72 | |
73 /** Call staticCompute to allow easy adjustments. */ | |
74 @Override | |
75 public Object computeAdvance( | |
76 FLYSArtifact artifact, | |
77 String hash, | |
78 CallContext context, | |
79 List<Facet> facets, | |
80 Object old | |
81 ) { | |
82 return staticCompute(facets, artifact); | |
83 } | |
84 | |
85 | |
86 /** Call staticCompute to allow easy adjustments. */ | |
87 @Override | |
88 public Object computeFeed( | |
89 FLYSArtifact artifact, | |
90 String hash, | |
91 CallContext context, | |
92 List<Facet> facets, | |
93 Object old | |
94 ) { | |
95 return staticCompute(facets, artifact); | |
96 } | |
97 | |
98 | |
99 /** Call staticCompute to allow easy adjustments. */ | |
100 @Override | |
101 public Object computeInit( | |
102 FLYSArtifact artifact, | |
103 String hash, | |
104 Object context, | |
105 CallMeta meta, | |
106 List<Facet> facets | |
107 ) { | |
108 return staticCompute(facets, artifact); | |
109 } | |
110 } | |
111 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |