Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/SedimentYieldArtifact.java @ 7471:fff862f4ef76
Experimental caching of datacage recommendations. The respective hook is called a lot and running the datacage over and over again when loading data can be expensive. So the generated recommendations are cached for some time.
Hopefully this improves the overall speed of loading data from the datacage.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Wed, 30 Oct 2013 15:26:21 +0100 |
parents | 6bc884bab32e |
children | ab17c76611f9 |
rev | line source |
---|---|
7182
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 * |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 */ |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 package org.dive4elements.river.artifacts; |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 import java.util.ArrayList; |
7306
d7b2c14a9693
issue1345: Adjust name of sediment yield/load facets to include fraction name and times.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7202
diff
changeset
|
12 import java.util.Calendar; |
d7b2c14a9693
issue1345: Adjust name of sediment yield/load facets to include fraction name and times.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7202
diff
changeset
|
13 import java.util.Date; |
7182
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 import java.util.List; |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 import org.apache.log4j.Logger; |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 import org.w3c.dom.Document; |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 import org.dive4elements.artifactdatabase.state.DefaultOutput; |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 import org.dive4elements.artifactdatabase.state.Facet; |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 import org.dive4elements.artifactdatabase.state.FacetActivity; |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 import org.dive4elements.artifactdatabase.state.State; |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 import org.dive4elements.artifacts.Artifact; |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 import org.dive4elements.artifacts.ArtifactFactory; |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 import org.dive4elements.artifacts.CallMeta; |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 import org.dive4elements.artifacts.common.utils.XMLUtils; |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; |
7186
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
28 import org.dive4elements.river.artifacts.model.Calculation; |
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
29 import org.dive4elements.river.artifacts.model.CalculationResult; |
7182
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 import org.dive4elements.river.artifacts.model.minfo.SedimentLoad; |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadFacet; |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadFactory; |
7186
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
33 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadResult; |
7306
d7b2c14a9693
issue1345: Adjust name of sediment yield/load facets to include fraction name and times.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7202
diff
changeset
|
34 import org.dive4elements.river.artifacts.resources.Resources; |
7182
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 import org.dive4elements.river.artifacts.states.StaticState; |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 import org.dive4elements.river.artifacts.model.FacetTypes; |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 |
7196
e6f9c831a75f
SedimentYieldArtifact: Removed unneeded documentation, removed but added one TODO.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7186
diff
changeset
|
40 /** Artifact to access sediment yield measurements. */ |
7202
63fd11f57379
Cleaned imports, added todo about naming.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7196
diff
changeset
|
41 // TODO Naming: would SedimentLoadArtifact be more precise? |
7182
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 public class SedimentYieldArtifact |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 extends StaticD4EArtifact |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 implements FacetTypes |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 { |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 /** The logger for this class. */ |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 private static Logger logger = |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 Logger.getLogger(SedimentYieldArtifact.class); |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 /** Artifact key name. */ |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 private static final String NAME = "sedimentyield"; |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 /** Spawn only inactive facets. */ |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 static { |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 // TODO: Move to configuration. |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
56 FacetActivity.Registry.getInstance() |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
57 .register(NAME, FacetActivity.INACTIVE); |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 } |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
59 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
60 /** Need to give the state an id. */ |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 public static final String STATIC_STATE_NAME = |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 "state.sedimentyield.static"; |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
64 /** One and only state to be in. */ |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
65 protected transient State state = null; |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
66 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
67 protected String DATA_NAME = "ID"; |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
68 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
69 /** |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
70 * Trivial Constructor. |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 */ |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 public SedimentYieldArtifact() { |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
73 logger.debug("SedimentYieldArtifact.SedimentYieldArtifact"); |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
74 } |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
75 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
76 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
77 /** Get artifact key name. */ |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
78 @Override |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
79 public String getName() { |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
80 return NAME; |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
81 } |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
82 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
83 |
7186
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
84 private Object getSedimentLoad() { |
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
85 logger.debug("SedimentYieldArtifact.getSedimentLoad"); |
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
86 String id = getDataAsString(DATA_NAME); |
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
87 String river = getDataAsString("river"); |
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
88 |
7196
e6f9c831a75f
SedimentYieldArtifact: Removed unneeded documentation, removed but added one TODO.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7186
diff
changeset
|
89 // TODO use cache if possible |
7186
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
90 SedimentLoad myLoad = SedimentLoadFactory.getSedimentLoadWithDataUncached(id, river); |
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
91 return new CalculationResult( |
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
92 new SedimentLoadResult[] { |
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
93 new SedimentLoadResult(1983,2042,myLoad) |
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
94 }, new Calculation()); |
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
95 } |
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
96 |
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
97 |
7182
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
98 /** Create a new state with bogus output. */ |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
99 protected State spawnState() { |
7186
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
100 state = new StaticState(STATIC_STATE_NAME) { |
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
101 |
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
102 public Object staticCompute(List<Facet> facets) { |
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
103 return getSedimentLoad(); |
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
104 } |
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
105 }; |
7182
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
106 List<Facet> fs = getFacets(STATIC_STATE_NAME); |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
107 DefaultOutput output = new DefaultOutput( |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
108 "general", |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
109 "general", |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
110 "image/png", |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
111 fs, |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
112 "chart"); |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
113 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
114 state.getOutputs().add(output); |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
115 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
116 return state; |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
117 } |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
118 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
119 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
120 /** |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
121 * Gets called from factory, to set things up. |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
122 */ |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
123 @Override |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
124 public void setup( |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
125 String identifier, |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
126 ArtifactFactory factory, |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
127 Object context, |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
128 CallMeta callMeta, |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
129 Document data) |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
130 { |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
131 logger.debug("SedimentYieldArtifact.setup"); |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
132 |
7186
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
133 // Refactor? this happens at another place, too |
7182
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
134 // Store id, yield yields. |
7186
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
135 state = new StaticState(STATIC_STATE_NAME) { |
7182
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
136 |
7186
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
137 public Object staticCompute(List<Facet> facets) { |
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
138 return getSedimentLoad(); |
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
139 } |
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
140 }; |
7182
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
141 if (logger.isDebugEnabled()) { |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
142 logger.debug(XMLUtils.toString(data)); |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
143 } |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
144 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
145 List<Facet> fs = new ArrayList<Facet>(); |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
146 String code = getDatacageIDValue(data); |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
147 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
148 if (code != null) { |
7306
d7b2c14a9693
issue1345: Adjust name of sediment yield/load facets to include fraction name and times.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7202
diff
changeset
|
149 String fraction = SedimentLoadFactory.getSedimentYieldFractionName(Integer.valueOf(code)); |
d7b2c14a9693
issue1345: Adjust name of sediment yield/load facets to include fraction name and times.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7202
diff
changeset
|
150 String fractionName = Resources.getMsg(callMeta, fraction, "-"); |
d7b2c14a9693
issue1345: Adjust name of sediment yield/load facets to include fraction name and times.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7202
diff
changeset
|
151 Date[] dates = SedimentLoadFactory.getSedimentYieldTimes(Integer.valueOf(code)); |
d7b2c14a9693
issue1345: Adjust name of sediment yield/load facets to include fraction name and times.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7202
diff
changeset
|
152 Calendar date = Calendar.getInstance(); |
d7b2c14a9693
issue1345: Adjust name of sediment yield/load facets to include fraction name and times.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7202
diff
changeset
|
153 date.setTime(dates[0]); |
7324
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
154 String name = fractionName + " - " + date.get(Calendar.YEAR); |
7306
d7b2c14a9693
issue1345: Adjust name of sediment yield/load facets to include fraction name and times.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7202
diff
changeset
|
155 if (dates[1] != null) { |
d7b2c14a9693
issue1345: Adjust name of sediment yield/load facets to include fraction name and times.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7202
diff
changeset
|
156 date.setTime(dates[1]); |
d7b2c14a9693
issue1345: Adjust name of sediment yield/load facets to include fraction name and times.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7202
diff
changeset
|
157 name += " - " + date.get(Calendar.YEAR); |
d7b2c14a9693
issue1345: Adjust name of sediment yield/load facets to include fraction name and times.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7202
diff
changeset
|
158 } |
7182
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
159 |
7324
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
160 String facetType = ""; |
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
161 if (fraction.equals("coarse")) { |
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
162 facetType = SEDIMENT_LOAD_COARSE; |
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
163 } |
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
164 else if (fraction.equals("sand")) { |
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
165 facetType = SEDIMENT_LOAD_SAND; |
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
166 } |
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
167 else if (fraction.equals("fine_middle")) { |
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
168 facetType = SEDIMENT_LOAD_FINEMIDDLE; |
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
169 } |
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
170 else if (fraction.equals("susp_sand")) { |
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
171 facetType = SEDIMENT_LOAD_SUSP_SAND; |
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
172 } |
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
173 else if (fraction.equals("susp_sand_bed")) { |
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
174 facetType = SEDIMENT_LOAD_SUSP_SAND_BED; |
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
175 } |
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
176 else if (fraction.equals("suspended_sediment")) { |
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
177 facetType = SEDIMENT_LOAD_SUSP_SEDIMENT; |
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
178 } |
7369
6bc884bab32e
SedimentYieldArtifact: Accept 'total' load, genreate facet for it.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7324
diff
changeset
|
179 else if (fraction.equals("total")) { |
6bc884bab32e
SedimentYieldArtifact: Accept 'total' load, genreate facet for it.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7324
diff
changeset
|
180 facetType = SEDIMENT_LOAD_TOTAL_LOAD; |
6bc884bab32e
SedimentYieldArtifact: Accept 'total' load, genreate facet for it.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7324
diff
changeset
|
181 } |
7324
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
182 else { |
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
183 logger.error("Do not know fraction type " + fraction); |
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
184 } |
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
185 |
7182
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
186 Facet facet = new SedimentLoadFacet( |
7186
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
187 0, |
7324
24023630f693
issue1345: Fix sediment load facet type, adjust theme name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7306
diff
changeset
|
188 facetType, |
7186
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
189 name, |
7182
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
190 //???? |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
191 ComputeType.ADVANCE, state.getID(), "hash" |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
192 ); |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
193 fs.add(facet); |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
194 addFacets(state.getID(), fs); |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
195 addStringData(DATA_NAME, code); |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
196 } |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
197 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
198 spawnState(); |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
199 super.setup(identifier, factory, context, callMeta, data); |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
200 } |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
201 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
202 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
203 /** |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
204 * Get a list containing the one and only State. |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
205 * @param context ignored. |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
206 * @return list with one and only state. |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
207 */ |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
208 @Override |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
209 protected List<State> getStates(Object context) { |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
210 ArrayList<State> states = new ArrayList<State>(); |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
211 states.add(getState()); |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
212 return states; |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
213 } |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
214 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
215 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
216 /** |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
217 * Get the "current" state (there is but one). |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
218 * @param cc ignored. |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
219 * @return the "current" (only possible) state. |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
220 */ |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
221 @Override |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
222 public State getCurrentState(Object cc) { |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
223 return getState(); |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
224 } |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
225 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
226 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
227 /** |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
228 * Get the only possible state. |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
229 * @return the state. |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
230 */ |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
231 protected State getState() { |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
232 return getState(null, null); |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
233 } |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
234 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
235 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
236 /** |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
237 * Get the state. |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
238 * @param context ignored. |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
239 * @param stateID ignored. |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
240 * @return the state. |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
241 */ |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
242 @Override |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
243 protected State getState(Object context, String stateID) { |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
244 return (state != null) |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
245 ? state |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
246 : spawnState(); |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
247 } |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
248 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
249 |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
250 /** |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
251 * Called via setup. Overridden to avoid cloning all data. |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
252 * |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
253 * @param artifact The master-artifact. |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
254 */ |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
255 @Override |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
256 protected void initialize( |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
257 Artifact artifact, |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
258 Object context, |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
259 CallMeta meta) |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
260 { |
7186
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
261 logger.debug("SedimentYieldArtifact.initialize"); |
644b2f461272
issue1435: SedimentYieldArtifact: Add functionality.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7182
diff
changeset
|
262 importData((D4EArtifact) artifact, "river"); |
7182
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
263 } |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
264 } |
87c32adb7088
Initial commit for untested standalone sediment yield artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
265 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |