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