Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ReferenceCurveState.java @ 2220:f31d92060f21
Added reference curve facet type.
flys-artifacts/trunk@3860 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 01 Feb 2012 13:56:38 +0000 |
parents | e14beb93a854 |
children | 606f4fd7f815 |
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; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
11 import de.intevation.flys.artifacts.model.FacetTypes; |
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.ReportFacet; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
13 import de.intevation.flys.artifacts.model.WW; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
14 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
15 import java.util.List; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
16 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
17 import org.apache.log4j.Logger; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
18 |
2170
90dfc25007f1
Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 public class ReferenceCurveState |
90dfc25007f1
Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 extends DefaultState |
2195
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
21 implements FacetTypes |
2170
90dfc25007f1
Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 { |
2195
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
23 private static Logger log = Logger.getLogger(ReferenceCurveState.class); |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
24 |
2170
90dfc25007f1
Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 public ReferenceCurveState() { |
90dfc25007f1
Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 } |
2195
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
27 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
28 @Override |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
29 public Object computeAdvance( |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
30 FLYSArtifact artifact, |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
31 String hash, |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
32 CallContext context, |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
33 List<Facet> facets, |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
34 Object old |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
35 ) { |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
36 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
37 if (!(artifact instanceof WINFOArtifact)) { |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
38 return null; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
39 } |
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 WINFOArtifact winfo = (WINFOArtifact)artifact; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
42 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
43 CalculationResult res = old instanceof CalculationResult |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
44 ? (CalculationResult)old |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
45 : winfo.getReferenceCurveData(); |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
46 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
47 if (facets == null) { |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
48 return res; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
49 } |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
50 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
51 WW [] wws = (WW [])res.getData(); |
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 for (int i = 0; i < wws.length; ++i) { |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
54 // TODO: Add data facets. |
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 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
57 if (wws.length > 0) { |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
58 // TODO: Add CSV/PDF facets. |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
59 } |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
60 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
61 if (res.getReport().hasProblems()) { |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
62 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
|
63 } |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
64 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
65 return res; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
66 } |
2170
90dfc25007f1
Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 } |
90dfc25007f1
Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |