comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/StaticHYKState.java @ 2131:e50a928187cd

Added stubby hyk infrastructure. flys-artifacts/trunk@3706 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 18 Jan 2012 13:39:16 +0000
parents
children 923256599afe
comparison
equal deleted inserted replaced
2130:3cbdf1b77ea5 2131:e50a928187cd
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.HYKArtifact;
14
15 import de.intevation.flys.artifacts.model.FacetTypes;
16 import de.intevation.flys.artifacts.model.HYKFacet;
17 import de.intevation.flys.artifacts.model.HYKFactory;
18
19 import de.intevation.flys.utils.FLYSUtils;
20
21
22 /**
23 * Only state of a HYKArtifact.
24 */
25 public class StaticHYKState
26 extends DefaultState
27 implements FacetTypes
28 {
29 /** The logger that is used in this state. */
30 private static Logger logger = Logger.getLogger(StaticHYKState.class);
31
32
33 /**
34 * From this state can not be continued.
35 */
36 @Override
37 protected String getUIProvider() {
38 return "noinput";
39 }
40
41
42 /**
43 * Compute, create Facets, do the same stuff as all the other states do.
44 */
45 protected Object compute(
46 HYKArtifact hyk,
47 CallMeta metaLocale,
48 String hash,
49 List<Facet> facets,
50 Object old
51 ) {
52 logger.debug("StaticHYKState.compute");
53 String id = getID();
54
55 // TODO caching!
56
57 /*
58 WQKms res = old instanceof WQKms
59 ? (WQKms)old
60 : winfo.getWQKms();
61
62 WQKms wqkms = res;
63 */
64
65 // List<Zone> res;
66 Object res = null;
67
68 // Compare against cached objects.
69
70 // Need river id and km.
71 List<HYKFactory.Zone> zones = (List<HYKFactory.Zone>)
72 HYKFactory.getHYKs(FLYSUtils.getRiver(hyk).getId(), hyk.getKm());
73
74 if (facets == null) {
75 logger.debug("StaticHYKState.compute no facets");
76 return zones;
77 }
78
79 Facet facet = new HYKFacet(0, "I am hyked.");
80
81 facets.add(facet);
82
83 return zones;
84 }
85
86
87 /**
88 * Get data, create the facets.
89 *
90 * @param context Ignored.
91 */
92 @Override
93 public Object computeFeed(
94 FLYSArtifact artifact,
95 String hash,
96 CallContext context,
97 List<Facet> facets,
98 Object old
99 ) {
100 return compute((HYKArtifact) artifact, context.getMeta(),
101 hash, facets, old);
102 }
103
104
105 /**
106 * Create the facets.
107 * @param context Ignored.
108 */
109 @Override
110 public Object computeInit(
111 FLYSArtifact artifact,
112 String hash,
113 Object context,
114 CallMeta meta,
115 List<Facet> facets
116 ) {
117 return compute((HYKArtifact) artifact, meta, hash, facets,
118 null);
119 }
120 }
121 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org