Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/StaticWQKmsState.java @ 3318:dbe2f85bf160
merged flys-artifacts/2.8
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:35 +0200 |
parents | d626ae185305 |
children | 5a2c7d24fd29 |
comparison
equal
deleted
inserted
replaced
2987:98c7a46ec5ae | 3318:dbe2f85bf160 |
---|---|
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.artifacts.CallContext; | |
8 import de.intevation.artifacts.CallMeta; | |
9 | |
10 import de.intevation.artifactdatabase.state.Facet; | |
11 | |
12 import de.intevation.flys.artifacts.FLYSArtifact; | |
13 import de.intevation.flys.artifacts.StaticWQKmsArtifact; | |
14 | |
15 import de.intevation.flys.artifacts.model.FacetTypes; | |
16 import de.intevation.flys.artifacts.model.WQKms; | |
17 import de.intevation.flys.artifacts.model.WQKmsFacet; | |
18 | |
19 /** | |
20 * Only state of WQKmsArtifact. | |
21 */ | |
22 public class StaticWQKmsState | |
23 extends DefaultState | |
24 implements FacetTypes | |
25 { | |
26 /** The logger that is used in this state. */ | |
27 private static Logger logger = Logger.getLogger(StaticWQKmsState.class); | |
28 | |
29 | |
30 /** | |
31 * From this state can not be continued. | |
32 */ | |
33 @Override | |
34 protected String getUIProvider() { | |
35 return "noinput"; | |
36 } | |
37 | |
38 | |
39 /** | |
40 * Compute, create Facets, do the same stuff as all the other states do. | |
41 */ | |
42 protected Object compute( | |
43 StaticWQKmsArtifact winfo, | |
44 CallMeta metaLocale, | |
45 String hash, | |
46 List<Facet> facets, | |
47 Object old | |
48 ) { | |
49 String id = getID(); | |
50 | |
51 WQKms res = old instanceof WQKms | |
52 ? (WQKms)old | |
53 : winfo.getWQKms(); | |
54 | |
55 WQKms wqkms = res; | |
56 | |
57 if (facets == null) { | |
58 return res; | |
59 } | |
60 | |
61 /* | |
62 * TODO: re-enable HEIGHTMARKS_POINTS-thing | |
63 | |
64 String name; | |
65 if (parts[0].equals(HEIGHTMARKS_POINTS)) { | |
66 name = HEIGHTMARKS_POINTS; | |
67 } | |
68 else { | |
69 name = STATIC_WQKMS; | |
70 } | |
71 */ | |
72 | |
73 String wkmsName = wqkms.getName(); | |
74 Facet qfacet = new WQKmsFacet( | |
75 STATIC_WQKMS_Q, | |
76 wkmsName | |
77 // TODO re-enable translations. | |
78 /* | |
79 Resources.getMsg( | |
80 metaLocale, | |
81 wkmsName, | |
82 wkmsName)*/); | |
83 facets.add(qfacet); | |
84 | |
85 wkmsName = "W (" + wkmsName + ")"; | |
86 | |
87 Facet wfacet = new WQKmsFacet( | |
88 STATIC_WQKMS_W, | |
89 wkmsName | |
90 /* | |
91 // TODO re-enable translations. | |
92 Resources.getMsg( | |
93 metaLocale, | |
94 wkmsName, | |
95 wkmsName)*/); | |
96 facets.add(wfacet); | |
97 | |
98 return res; | |
99 } | |
100 | |
101 | |
102 /** | |
103 * Get data, create the facets. | |
104 * | |
105 * @param context Ignored. | |
106 */ | |
107 @Override | |
108 public Object computeFeed( | |
109 FLYSArtifact artifact, | |
110 String hash, | |
111 CallContext context, | |
112 List<Facet> facets, | |
113 Object old | |
114 ) { | |
115 return compute((StaticWQKmsArtifact) artifact, context.getMeta(), | |
116 hash, facets, old); | |
117 } | |
118 | |
119 | |
120 /** | |
121 * Create the facets. | |
122 * @param context Ignored. | |
123 */ | |
124 @Override | |
125 public Object computeInit( | |
126 FLYSArtifact artifact, | |
127 String hash, | |
128 Object context, | |
129 CallMeta meta, | |
130 List<Facet> facets | |
131 ) { | |
132 return compute((StaticWQKmsArtifact) artifact, meta, hash, facets, | |
133 null); | |
134 } | |
135 } | |
136 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |