Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticMorphWidthArtifact.java @ 5772:c0d0b9fd1aa8
issue1276: Re-enable fixation autorecommend at discharge_curves.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 19 Apr 2013 09:22:44 +0200 |
parents | 7ac111db8a07 |
children | 4a1bd43e7aa6 |
rev | line source |
---|---|
5764
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
2 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
3 import java.util.ArrayList; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
4 import java.util.List; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
5 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
6 import org.apache.log4j.Logger; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
7 import org.w3c.dom.Document; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
8 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.artifactdatabase.state.DefaultOutput; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifactdatabase.state.Facet; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.artifactdatabase.state.FacetActivity; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.artifacts.ArtifactFactory; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.artifacts.Artifact; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.artifacts.CallMeta; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.artifacts.common.utils.XMLUtils; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.flys.artifacts.model.minfo.BedHeightFacet; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.flys.artifacts.model.minfo.BedHeightFactory; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.flys.artifacts.model.minfo.MorphologicWidthFacet; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.flys.artifacts.resources.Resources; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.flys.artifacts.states.StaticState; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 public class StaticMorphWidthArtifact |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 extends AbstractStaticStateArtifact |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
24 { |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
25 /** The logger for this class. */ |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
26 private static Logger logger = |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
27 Logger.getLogger(StaticMorphWidthArtifact.class); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
28 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
29 private static final String NAME = "morph-width"; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
30 private static final String STATIC_FACET_NAME = "morph-width"; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
31 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
32 static { |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
33 // TODO: Move to configuration. |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
34 FacetActivity.Registry.getInstance() |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 .register(NAME, FacetActivity.INACTIVE); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 } |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
38 public static final String STATIC_STATE_NAME = |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
39 "state.morph-width.static"; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
40 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
41 /** |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
42 * Trivial Constructor. |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
43 */ |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
44 public StaticMorphWidthArtifact() { |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
45 } |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
46 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
47 @Override |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
48 public String getName() { |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
49 return NAME; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
50 } |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
51 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
52 /** |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
53 * Gets called from factory, to set things up. |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
54 */ |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
55 @Override |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
56 public void setup( |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
57 String identifier, |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
58 ArtifactFactory factory, |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
59 Object context, |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
60 CallMeta callMeta, |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
61 Document data) |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
62 { |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
63 logger.debug("setup"); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
64 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
65 if (logger.isDebugEnabled()) { |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
66 logger.debug(XMLUtils.toString(data)); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
67 } |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
68 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
69 String code = getDatacageIDValue(data); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
70 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
71 if (code != null) { |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
72 Facet facet = new MorphologicWidthFacet( |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
73 STATIC_FACET_NAME, |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
74 Resources.getMsg( |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
75 callMeta, |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
76 "facet.morphologic.width", |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
77 "morphologische Breite")); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
78 addStringData("width_id", code); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
79 ArrayList<Facet> facets = new ArrayList<Facet>(1); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
80 facets.add(facet); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
81 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
82 addFacets(STATIC_STATE_NAME, facets); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
83 } |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
84 super.setup(identifier, factory, context, callMeta, data); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
85 } |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
86 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
87 @Override |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
88 protected void initStaticState() { |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
89 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
90 logger.debug("initStaticState " + getName() + " " + identifier()); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
91 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
92 StaticState state = new StaticState(STATIC_STATE_NAME); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
93 DefaultOutput output = new DefaultOutput( |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
94 "general", |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
95 "general", |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
96 "image/png", |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
97 "chart"); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
98 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
99 List<Facet> facets = getFacets(STATIC_STATE_NAME); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
100 output.addFacets(facets); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
101 state.addOutput(output); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
102 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
103 setStaticState(state); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
104 } |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
105 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
106 @Override |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
107 protected void initialize(Artifact artifact, Object context, CallMeta meta) { |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
108 } |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
109 } |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
110 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |