annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/StaticHYKState.java @ 4491:302f5da348bb

Fixed problem with mapserver fonts
author Sascha L. Teichmann <teichmann@intevation.de>
date Wed, 14 Nov 2012 10:51:21 +0100
parents eb1a676c0d6e
children
rev   line source
2131
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.states;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
2
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
3 import java.util.List;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
4
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
5 import org.apache.log4j.Logger;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
6
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7 import de.intevation.artifacts.CallContext;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
8 import de.intevation.artifacts.CallMeta;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
9
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10 import de.intevation.artifactdatabase.state.Facet;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12 import de.intevation.flys.artifacts.FLYSArtifact;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13 import de.intevation.flys.artifacts.HYKArtifact;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15 import de.intevation.flys.artifacts.model.FacetTypes;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16 import de.intevation.flys.artifacts.model.HYKFacet;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17 import de.intevation.flys.artifacts.model.HYKFactory;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19 /**
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20 * Only state of a HYKArtifact.
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21 */
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22 public class StaticHYKState
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23 extends DefaultState
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24 implements FacetTypes
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25 {
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26 /** The logger that is used in this state. */
2139
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2131
diff changeset
27 transient private static final Logger logger = Logger.getLogger(StaticHYKState.class);
2131
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30 /**
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31 * From this state can not be continued.
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32 */
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33 @Override
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34 protected String getUIProvider() {
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
35 return "noinput";
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 }
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
37
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39 /**
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40 * Compute, create Facets, do the same stuff as all the other states do.
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41 */
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42 protected Object compute(
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 HYKArtifact hyk,
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44 CallMeta metaLocale,
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45 String hash,
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46 List<Facet> facets,
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 Object old
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48 ) {
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
49 logger.debug("StaticHYKState.compute");
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50 String id = getID();
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51
2151
eb1a676c0d6e Cleanups.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2144
diff changeset
52 // Prepare comparison against cached result.
eb1a676c0d6e Cleanups.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2144
diff changeset
53 List<HYKFactory.Zone> resZones = old instanceof List
eb1a676c0d6e Cleanups.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2144
diff changeset
54 ? (List<HYKFactory.Zone>)old
eb1a676c0d6e Cleanups.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2144
diff changeset
55 : null;
2131
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56
2151
eb1a676c0d6e Cleanups.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2144
diff changeset
57 // TODO Compare against cached object.
2131
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58
2151
eb1a676c0d6e Cleanups.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2144
diff changeset
59 // Get Zones from HYKFactory
2131
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60 List<HYKFactory.Zone> zones = (List<HYKFactory.Zone>)
2139
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2131
diff changeset
61 HYKFactory.getHYKs(hyk.getHykId(), hyk.getKm());
2131
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
63 if (facets == null) {
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
64 logger.debug("StaticHYKState.compute no facets");
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
65 return zones;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
66 }
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
67
2151
eb1a676c0d6e Cleanups.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2144
diff changeset
68 // Spawn Facets.
2139
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2131
diff changeset
69 Facet facet = new HYKFacet(0, HYKFactory.getHykName(hyk.getHykId()));
2131
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70 facets.add(facet);
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 return zones;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 }
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76 /**
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77 * Get data, create the facets.
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
78 *
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
79 * @param context Ignored.
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
80 */
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81 @Override
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
82 public Object computeFeed(
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
83 FLYSArtifact artifact,
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
84 String hash,
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
85 CallContext context,
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
86 List<Facet> facets,
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
87 Object old
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
88 ) {
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
89 return compute((HYKArtifact) artifact, context.getMeta(),
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90 hash, facets, old);
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
91 }
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
92
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
93
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
94 /**
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
95 * Create the facets.
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
96 * @param context Ignored.
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
97 */
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
98 @Override
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
99 public Object computeInit(
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
100 FLYSArtifact artifact,
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
101 String hash,
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
102 Object context,
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
103 CallMeta meta,
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
104 List<Facet> facets
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
105 ) {
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
106 return compute((HYKArtifact) artifact, meta, hash, facets,
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
107 null);
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
108 }
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
109 }
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
110 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org