annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/AreaCreationState.java @ 2017:e384d78ff78b

Cosmetics. flys-artifacts/trunk@3472 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 20 Dec 2011 06:26:25 +0000
parents 7f99845e9499
children 3f1a63da2cf4
rev   line source
2001
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.states;
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
2
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
3 import java.util.List;
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
4
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
5 import org.apache.log4j.Logger;
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
6
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7 import de.intevation.artifacts.CallContext;
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
8
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
9 import de.intevation.flys.artifacts.model.AreaFacet;
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11 import de.intevation.artifactdatabase.state.Facet;
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13 import de.intevation.flys.artifacts.FLYSArtifact;
2010
7f99845e9499 Store and access area.name data item.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2001
diff changeset
14 import de.intevation.flys.artifacts.AreaArtifact;
2001
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15 import de.intevation.flys.artifacts.model.DataFacet;
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16 import de.intevation.flys.artifacts.model.CrossSectionWaterLineFacet;
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17 import de.intevation.flys.artifacts.model.CalculationResult;
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18 import de.intevation.flys.artifacts.model.FacetTypes;
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19 import de.intevation.flys.artifacts.model.ReportFacet;
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20 import de.intevation.flys.artifacts.model.WaterlevelFacet;
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21 import de.intevation.flys.artifacts.model.WQKms;
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22 import de.intevation.flys.utils.FLYSUtils;
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25 public class AreaCreationState
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26 extends DefaultState
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27 implements FacetTypes
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28 {
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29 /** The logger that is used in this state. */
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30 private static Logger logger = Logger.getLogger(AreaCreationState.class);
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33 /**
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34 * From this state can only be continued trivially.
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
35 */
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 @Override
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
37 protected String getUIProvider() {
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38 return "continue";
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39 }
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41
2010
7f99845e9499 Store and access area.name data item.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2001
diff changeset
42 /** Just reproduce the Facet. */
2001
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 protected Object compute(
2010
7f99845e9499 Store and access area.name data item.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2001
diff changeset
44 FLYSArtifact areaArtifact,
2001
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45 CallContext cc,
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46 String hash,
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 List<Facet> facets,
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48 Object old
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
49 ) {
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50 logger.debug("AreaCreationState.compute");
2010
7f99845e9499 Store and access area.name data item.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2001
diff changeset
51
2001
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52 if (facets != null) {
2010
7f99845e9499 Store and access area.name data item.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2001
diff changeset
53 facets.add(new AreaFacet(0,
7f99845e9499 Store and access area.name data item.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2001
diff changeset
54 ((AreaArtifact) areaArtifact).getAreaName()));
2001
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55 }
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57 // TODO use compute to exploit caching strategies.
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
59 return null;
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60 }
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
63 /**
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
64 */
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
65 @Override
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
66 public Object computeFeed(
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
67 FLYSArtifact artifact,
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
68 String hash,
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
69 CallContext context,
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70 List<Facet> facets,
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71 Object old
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 ) {
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 return compute((FLYSArtifact) artifact, context, hash, facets, old);
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 }
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77 /**
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
78 *
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
79 */
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
80 @Override
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81 public Object computeAdvance(
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
82 FLYSArtifact artifact,
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
83 String hash,
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
84 CallContext context,
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
85 List<Facet> facets,
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
86 Object old
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
87 ) {
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
88 return compute((FLYSArtifact) artifact, context, hash, facets, old);
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
89 }
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90 }
28a5c163f9cd Added partial area-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
91 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org