Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ReferenceGaugeState.java @ 2203:1db66b88868f
Fixed a bug in the winfo transitions.
flys-artifacts/trunk@3823 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 30 Jan 2012 10:54:38 +0000 |
parents | f28844a57fed |
children | a38f43f626f5 |
rev | line source |
---|---|
2191
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.states; |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.util.List; |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import org.apache.log4j.Logger; |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import org.w3c.dom.Element; |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.artifacts.Artifact; |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifacts.CallContext; |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.artifacts.CallMeta; |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.artifacts.common.utils.XMLUtils; |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.flys.model.Gauge; |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.flys.model.River; |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.flys.artifacts.FLYSArtifact; |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.flys.utils.FLYSUtils; |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 /** |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 */ |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 public class ReferenceGaugeState extends DefaultState { |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 private static final Logger logger = |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 Logger.getLogger(ReferenceGaugeState.class); |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 @Override |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 protected Element[] createItems( |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 XMLUtils.ElementCreator cr, |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 Artifact artifact, |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 String name, |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 CallContext context) |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 { |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 CallMeta meta = context.getMeta(); |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 River river = FLYSUtils.getRiver((FLYSArtifact) artifact); |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 List<Gauge> gauges = river.getGauges(); |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 int num = gauges != null ? gauges.size() : 0; |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 Element[] opts = new Element[num]; |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 for (int i = 0; i < num; i++ ) { |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 Gauge g = gauges.get(i); |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 String gaugeName = g.getName(); |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 long officialNumber = g.getOfficialNumber(); |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 opts[i] = createItem( |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 cr, new String[] { gaugeName, String.valueOf(officialNumber) }); |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 } |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 return opts; |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 } |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 } |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |