annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ReferenceCurveState.java @ 2298:177921b9e8bb

Partial fix issue474, i18n. flys-artifacts/trunk@3964 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 08 Feb 2012 11:16:39 +0000
parents d4330439be3a
children 51f530476e36
rev   line source
2170
90dfc25007f1 Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.states;
90dfc25007f1 Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
3 import de.intevation.artifactdatabase.state.Facet;
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
4
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
5 import de.intevation.artifacts.CallContext;
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
6
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
7 import de.intevation.flys.artifacts.FLYSArtifact;
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
8 import de.intevation.flys.artifacts.WINFOArtifact;
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
9
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
10 import de.intevation.flys.artifacts.model.CalculationResult;
2259
0dcb8326be08 Add a not-yet-looked-at CSV facet for Reference Curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2251
diff changeset
11 import de.intevation.flys.artifacts.model.DataFacet;
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
12 import de.intevation.flys.artifacts.model.FacetTypes;
2222
606f4fd7f815 Add more-or-less dummy Facet in ReferenceCurveState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2195
diff changeset
13 import de.intevation.flys.artifacts.model.ReferenceCurveFacet;
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
14 import de.intevation.flys.artifacts.model.ReportFacet;
2283
d4330439be3a Let reference curve calculation result in wwqq.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2277
diff changeset
15 import de.intevation.flys.artifacts.model.WWQQ;
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
16
2251
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2222
diff changeset
17 import de.intevation.flys.artifacts.resources.Resources;
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2222
diff changeset
18
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
19 import java.util.List;
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
20
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
21 import org.apache.log4j.Logger;
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
22
2251
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2222
diff changeset
23
2170
90dfc25007f1 Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24 public class ReferenceCurveState
90dfc25007f1 Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25 extends DefaultState
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
26 implements FacetTypes
2170
90dfc25007f1 Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27 {
2259
0dcb8326be08 Add a not-yet-looked-at CSV facet for Reference Curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2251
diff changeset
28 private static Logger logger = Logger.getLogger(ReferenceCurveState.class);
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
29
2170
90dfc25007f1 Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 public ReferenceCurveState() {
90dfc25007f1 Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 }
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
32
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
33 @Override
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
34 public Object computeAdvance(
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
35 FLYSArtifact artifact,
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
36 String hash,
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
37 CallContext context,
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
38 List<Facet> facets,
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
39 Object old
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
40 ) {
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
41 if (!(artifact instanceof WINFOArtifact)) {
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
42 return null;
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
43 }
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
44
2259
0dcb8326be08 Add a not-yet-looked-at CSV facet for Reference Curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2251
diff changeset
45 String id = getID();
0dcb8326be08 Add a not-yet-looked-at CSV facet for Reference Curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2251
diff changeset
46
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
47 WINFOArtifact winfo = (WINFOArtifact)artifact;
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
48
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
49 CalculationResult res = old instanceof CalculationResult
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
50 ? (CalculationResult)old
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
51 : winfo.getReferenceCurveData();
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
52
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
53 if (facets == null) {
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
54 return res;
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
55 }
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
56
2283
d4330439be3a Let reference curve calculation result in wwqq.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2277
diff changeset
57 WWQQ [] wws = (WWQQ [])res.getData();
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
58
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
59 for (int i = 0; i < wws.length; ++i) {
2251
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2222
diff changeset
60 facets.add(new ReferenceCurveFacet(i,
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2222
diff changeset
61 REFERENCE_CURVE,
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2222
diff changeset
62 Resources.getMsg(context.getMeta(), REFERENCE_CURVE, REFERENCE_CURVE)));
2277
3f3e4f94171b Added generator for "Reduzierte Bezugslinie".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2259
diff changeset
63 facets.add(new ReferenceCurveFacet(i,
3f3e4f94171b Added generator for "Reduzierte Bezugslinie".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2259
diff changeset
64 REFERENCE_CURVE_NORMALIZED,
3f3e4f94171b Added generator for "Reduzierte Bezugslinie".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2259
diff changeset
65 Resources.getMsg(
3f3e4f94171b Added generator for "Reduzierte Bezugslinie".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2259
diff changeset
66 context.getMeta(),
3f3e4f94171b Added generator for "Reduzierte Bezugslinie".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2259
diff changeset
67 REFERENCE_CURVE_NORMALIZED, REFERENCE_CURVE_NORMALIZED)));
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
68 }
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
69
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
70 if (wws.length > 0) {
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
71 // TODO: Add CSV/PDF facets.
2259
0dcb8326be08 Add a not-yet-looked-at CSV facet for Reference Curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2251
diff changeset
72 logger.debug("Adding CSV data facet.");
0dcb8326be08 Add a not-yet-looked-at CSV facet for Reference Curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2251
diff changeset
73 Facet csv = new DataFacet (CSV, "CSV data", ComputeType.ADVANCE, hash, id);
0dcb8326be08 Add a not-yet-looked-at CSV facet for Reference Curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2251
diff changeset
74 facets.add(csv);
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
75 }
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
76
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
77 if (res.getReport().hasProblems()) {
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
78 facets.add(new ReportFacet(ComputeType.ADVANCE, hash, id));
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
79 }
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
80
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
81 return res;
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
82 }
2170
90dfc25007f1 Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
83 }
90dfc25007f1 Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
84 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org