Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/SedimentDensityArtifact.java @ 7203:99c5e4148859
Cleaned imports.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 30 Sep 2013 17:30:06 +0200 |
parents | baf04164fcc6 |
children | 292330854722 |
rev | line source |
---|---|
7199
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 * |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 */ |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 package org.dive4elements.river.artifacts; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 import java.util.ArrayList; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 import java.util.List; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 import org.apache.log4j.Logger; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 import org.w3c.dom.Document; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 import org.dive4elements.artifactdatabase.state.DefaultOutput; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 import org.dive4elements.artifactdatabase.state.Facet; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 import org.dive4elements.artifactdatabase.state.FacetActivity; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 import org.dive4elements.artifactdatabase.state.State; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 import org.dive4elements.artifacts.Artifact; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 import org.dive4elements.artifacts.ArtifactFactory; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 import org.dive4elements.artifacts.CallMeta; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 import org.dive4elements.artifacts.common.utils.XMLUtils; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 import org.dive4elements.river.artifacts.model.minfo.SedimentDensityFacet; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 import org.dive4elements.river.artifacts.model.minfo.SedimentDensityFactory; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 import org.dive4elements.river.artifacts.states.StaticState; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 import org.dive4elements.river.artifacts.model.FacetTypes; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 /** Artifact to access sediment density measurements. */ |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 public class SedimentDensityArtifact |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 extends StaticD4EArtifact |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 implements FacetTypes |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 { |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 /** The logger for this class. */ |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 private static Logger logger = |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 Logger.getLogger(SedimentDensityArtifact.class); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 /** Artifact key name. */ |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 private static final String NAME = "sedimentdensity"; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 /** Spawn only inactive facets. */ |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 static { |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 // TODO: Move to configuration. |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 FacetActivity.Registry.getInstance() |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 .register(NAME, FacetActivity.INACTIVE); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 } |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 /** Need to give the state an id. */ |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 public static final String STATIC_STATE_NAME = |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 "state.sedimentdensity.static"; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
56 /** One and only state to be in. */ |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
57 protected transient State state = null; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
59 protected String DATA_ID = "ID"; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
60 protected String DATA_YEAR = "YEAR"; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 /** |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 * Trivial Constructor. |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
64 */ |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
65 public SedimentDensityArtifact() { |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
66 logger.debug("SedimentDensityArtifact.SedimentDensityArtifact"); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
67 } |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
68 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
69 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
70 /** Get artifact key name. */ |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 @Override |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 public String getName() { |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
73 return NAME; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
74 } |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
75 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
76 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
77 private Object getSedimentDensity() { |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
78 logger.debug("SedimentDensityArtifact.getSedimentDensity"); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
79 Integer id = getDataAsInteger(DATA_ID); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
80 Integer year = getDataAsInteger(DATA_YEAR); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
81 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
82 // TODO use cache if possible |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
83 return SedimentDensityFactory.getSedimentDensityUncached(id, year); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
84 } |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
85 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
86 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
87 private State newDensityState() { |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
88 return new StaticState(STATIC_STATE_NAME) { |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
89 public Object staticCompute(List<Facet> facets) { |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
90 return getSedimentDensity(); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
91 } |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
92 }; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
93 } |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
94 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
95 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
96 /** Create a new state with bogus output. */ |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
97 protected State spawnState() { |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
98 state = newDensityState(); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
99 List<Facet> fs = getFacets(STATIC_STATE_NAME); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
100 DefaultOutput output = new DefaultOutput( |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
101 "general", |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
102 "general", |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
103 "image/png", |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
104 fs, |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
105 "chart"); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
106 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
107 state.getOutputs().add(output); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
108 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
109 return state; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
110 } |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
111 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
112 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
113 /** |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
114 * Gets called from factory, to set things up. |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
115 */ |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
116 @Override |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
117 public void setup( |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
118 String identifier, |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
119 ArtifactFactory factory, |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
120 Object context, |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
121 CallMeta callMeta, |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
122 Document data) |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
123 { |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
124 logger.debug("SedimentDensityArtifact.setup"); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
125 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
126 // Store id, yield yields. |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
127 state = newDensityState(); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
128 if (logger.isDebugEnabled()) { |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
129 logger.debug(XMLUtils.toString(data)); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
130 } |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
131 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
132 List<Facet> fs = new ArrayList<Facet>(); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
133 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
134 String code = getDatacageIDValue(data); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
135 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
136 if (code != null) { |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
137 //String name = SedimentDensityFactory.getSedimentDensityDescription(Integer.valueOf(code)); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
138 //id: and year? |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
139 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
140 String name = "facet"; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
141 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
142 Facet facet = new SedimentDensityFacet( |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
143 0, |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
144 SEDIMENT_LOAD_COARSE, |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
145 name, |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
146 //???? |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
147 ComputeType.ADVANCE, state.getID(), "hash" |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
148 ); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
149 fs.add(facet); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
150 addFacets(state.getID(), fs); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
151 addStringData(DATA_ID, code); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
152 addStringData(DATA_YEAR, code); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
153 } |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
154 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
155 spawnState(); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
156 super.setup(identifier, factory, context, callMeta, data); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
157 } |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
158 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
159 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
160 /** |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
161 * Get a list containing the one and only State. |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
162 * @param context ignored. |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
163 * @return list with one and only state. |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
164 */ |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
165 @Override |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
166 protected List<State> getStates(Object context) { |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
167 ArrayList<State> states = new ArrayList<State>(); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
168 states.add(getState()); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
169 return states; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
170 } |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
171 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
172 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
173 /** |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
174 * Get the "current" state (there is but one). |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
175 * @param cc ignored. |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
176 * @return the "current" (only possible) state. |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
177 */ |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
178 @Override |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
179 public State getCurrentState(Object cc) { |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
180 return getState(); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
181 } |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
182 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
183 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
184 /** |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
185 * Get the only possible state. |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
186 * @return the state. |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
187 */ |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
188 protected State getState() { |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
189 return getState(null, null); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
190 } |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
191 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
192 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
193 /** |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
194 * Get the state. |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
195 * @param context ignored. |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
196 * @param stateID ignored. |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
197 * @return the state. |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
198 */ |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
199 @Override |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
200 protected State getState(Object context, String stateID) { |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
201 return (state != null) |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
202 ? state |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
203 : spawnState(); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
204 } |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
205 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
206 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
207 /** |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
208 * Called via setup. Overridden to avoid cloning all data. |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
209 * |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
210 * @param artifact The master-artifact. |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
211 */ |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
212 @Override |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
213 protected void initialize( |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
214 Artifact artifact, |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
215 Object context, |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
216 CallMeta meta) |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
217 { |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
218 logger.debug("SedimentDensityArtifact.initialize"); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
219 } |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
220 } |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
221 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |