Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticMorphWidthArtifact.java @ 5798:febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 24 Apr 2013 08:21:52 +0200 |
parents | 4a1bd43e7aa6 |
children |
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.MorphologicWidthFacet; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
17 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
|
18 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
|
19 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 public class StaticMorphWidthArtifact |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 extends AbstractStaticStateArtifact |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 { |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 /** The logger for this class. */ |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
24 private static Logger logger = |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
25 Logger.getLogger(StaticMorphWidthArtifact.class); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
26 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
27 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
|
28 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
|
29 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
30 static { |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
31 // TODO: Move to configuration. |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
32 FacetActivity.Registry.getInstance() |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
33 .register(NAME, FacetActivity.INACTIVE); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
34 } |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 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
|
37 "state.morph-width.static"; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
38 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
39 /** |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
40 * Trivial Constructor. |
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 public StaticMorphWidthArtifact() { |
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 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
45 @Override |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
46 public String getName() { |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
47 return NAME; |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
48 } |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
49 |
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 * 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
|
52 */ |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
53 @Override |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
54 public void setup( |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
55 String identifier, |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
56 ArtifactFactory factory, |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
57 Object context, |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
58 CallMeta callMeta, |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
59 Document data) |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
60 { |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
61 logger.debug("setup"); |
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 if (logger.isDebugEnabled()) { |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
64 logger.debug(XMLUtils.toString(data)); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
65 } |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
66 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
67 String code = getDatacageIDValue(data); |
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 if (code != null) { |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
70 Facet facet = new MorphologicWidthFacet( |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
71 STATIC_FACET_NAME, |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
72 Resources.getMsg( |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
73 callMeta, |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
74 "facet.morphologic.width", |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
75 "morphologische Breite")); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
76 addStringData("width_id", code); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
77 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
|
78 facets.add(facet); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
79 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
80 addFacets(STATIC_STATE_NAME, facets); |
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 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
|
83 } |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
84 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
85 @Override |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
86 protected void initStaticState() { |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
87 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
88 logger.debug("initStaticState " + getName() + " " + identifier()); |
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 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
|
91 DefaultOutput output = new DefaultOutput( |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
92 "general", |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
93 "general", |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
94 "image/png", |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
95 "chart"); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
96 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
97 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
|
98 output.addFacets(facets); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
99 state.addOutput(output); |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
100 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
101 setStaticState(state); |
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 |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
104 @Override |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
105 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
|
106 } |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
107 } |
7ac111db8a07
Model, factory, facet and static artifact for morphologic width.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
108 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |