Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/AreaCreationState.java @ 3814:8083f6384023
merged flys-artifacts/pre2.6-2012-01-04
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:56 +0200 |
parents | 3c3693e9c538 |
children |
comparison
equal
deleted
inserted
replaced
1491:2a00f4849738 | 3814:8083f6384023 |
---|---|
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 | |
9 import de.intevation.flys.artifacts.model.AreaFacet; | |
10 | |
11 import de.intevation.artifactdatabase.state.Facet; | |
12 | |
13 import de.intevation.flys.artifacts.FLYSArtifact; | |
14 import de.intevation.flys.artifacts.AreaArtifact; | |
15 import de.intevation.flys.artifacts.model.FacetTypes; | |
16 | |
17 | |
18 /** Trivial state to create areafacets, no caching. */ | |
19 public class AreaCreationState | |
20 extends DefaultState | |
21 implements FacetTypes | |
22 { | |
23 /** The logger that is used in this state. */ | |
24 private static Logger logger = Logger.getLogger(AreaCreationState.class); | |
25 | |
26 | |
27 /** | |
28 * From this state can only be continued trivially. | |
29 */ | |
30 @Override | |
31 protected String getUIProvider() { | |
32 return "continue"; | |
33 } | |
34 | |
35 | |
36 /** Just reproduce the Facet. */ | |
37 protected Object compute( | |
38 FLYSArtifact areaArtifact, | |
39 CallContext cc, | |
40 String hash, | |
41 List<Facet> facets, | |
42 Object old | |
43 ) { | |
44 logger.debug("AreaCreationState.compute"); | |
45 | |
46 if (facets != null) { | |
47 AreaArtifact aArt = (AreaArtifact) areaArtifact; | |
48 | |
49 facets.add(new AreaFacet(0, aArt.getFacetName(), aArt.getAreaName())); | |
50 } | |
51 | |
52 // TODO use compute to exploit caching strategies. | |
53 | |
54 return null; | |
55 } | |
56 | |
57 | |
58 /** | |
59 */ | |
60 @Override | |
61 public Object computeFeed( | |
62 FLYSArtifact artifact, | |
63 String hash, | |
64 CallContext context, | |
65 List<Facet> facets, | |
66 Object old | |
67 ) { | |
68 return compute((FLYSArtifact) artifact, context, hash, facets, old); | |
69 } | |
70 | |
71 | |
72 /** | |
73 * | |
74 */ | |
75 @Override | |
76 public Object computeAdvance( | |
77 FLYSArtifact artifact, | |
78 String hash, | |
79 CallContext context, | |
80 List<Facet> facets, | |
81 Object old | |
82 ) { | |
83 return compute((FLYSArtifact) artifact, context, hash, facets, old); | |
84 } | |
85 } | |
86 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |