Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java @ 5827:e308d4ecd35a
Fixed pom for etl process.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 11:48:36 +0200 |
parents | c79b98085096 |
children |
rev | line source |
---|---|
2709
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.states; |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
2712
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
3 import java.util.ArrayList; |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
4 import java.util.List; |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
5 |
2709
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import org.apache.log4j.Logger; |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.artifacts.Artifact; |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.artifacts.CallContext; |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.artifacts.common.model.KVP; |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
2712
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
13 import de.intevation.flys.model.BedHeightEpoch; |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
14 import de.intevation.flys.model.BedHeightSingle; |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
15 import de.intevation.flys.model.River; |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
16 |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
17 import de.intevation.flys.artifacts.FLYSArtifact; |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
18 import de.intevation.flys.utils.FLYSUtils; |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
19 |
2709
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 public class SoundingsSelect extends MultiStringArrayState { |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 |
3931
c79b98085096
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3875
diff
changeset
|
23 public static final String SOUNDINGS = "soundings"; |
2709
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 |
2712
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
25 public static final String PREFIX_SINGLE = "single-"; |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
26 |
3931
c79b98085096
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3875
diff
changeset
|
27 public static final String PREFIX_EPOCH = "epoch-"; |
2712
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
28 |
3931
c79b98085096
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3875
diff
changeset
|
29 /** Private logger. */ |
2709
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 private static final Logger logger = Logger.getLogger(SoundingsSelect.class); |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 @Override |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 public String getUIProvider() { |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 return "parameter-matrix"; |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 } |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 @Override |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 protected KVP<String, String>[] getOptions( |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 Artifact artifact, |
3722
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3452
diff
changeset
|
42 String parameterName, |
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3452
diff
changeset
|
43 CallContext context |
2709
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 ) |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 throws IllegalArgumentException |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 { |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 logger.debug("Get options for parameter: '" + parameterName + "'"); |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 if (!testParameterName(parameterName)) { |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 throw new IllegalArgumentException( |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 "Invalid parameter for state: '" + parameterName + "'"); |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 } |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 |
2712
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
54 River river = FLYSUtils.getRiver((FLYSArtifact) artifact); |
2716
150dcdefeb7d
Only offer soundings that fit to the current km range in MINFO bed height workflow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2712
diff
changeset
|
55 double lo = ((FLYSArtifact) artifact).getDataAsDouble("ld_from"); |
150dcdefeb7d
Only offer soundings that fit to the current km range in MINFO bed height workflow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2712
diff
changeset
|
56 double hi = ((FLYSArtifact) artifact).getDataAsDouble("ld_to"); |
150dcdefeb7d
Only offer soundings that fit to the current km range in MINFO bed height workflow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2712
diff
changeset
|
57 |
150dcdefeb7d
Only offer soundings that fit to the current km range in MINFO bed height workflow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2712
diff
changeset
|
58 double kmLo = Math.min(lo, hi); |
150dcdefeb7d
Only offer soundings that fit to the current km range in MINFO bed height workflow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2712
diff
changeset
|
59 double kmHi = Math.max(lo, hi); |
2709
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 |
2712
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
61 List<KVP<String, String>> kvp = new ArrayList<KVP<String, String>>(); |
2709
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 |
2716
150dcdefeb7d
Only offer soundings that fit to the current km range in MINFO bed height workflow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2712
diff
changeset
|
63 appendSingles(river, kmLo, kmHi, kvp); |
150dcdefeb7d
Only offer soundings that fit to the current km range in MINFO bed height workflow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2712
diff
changeset
|
64 appendEpochs(river, kmLo, kmHi, kvp); |
2712
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
65 |
3452
200e70f31f6f
Removed some superfluous casts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3087
diff
changeset
|
66 return kvp.toArray(new KVP[kvp.size()]); |
2712
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
67 } |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
68 |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
69 |
2716
150dcdefeb7d
Only offer soundings that fit to the current km range in MINFO bed height workflow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2712
diff
changeset
|
70 protected void appendSingles( |
150dcdefeb7d
Only offer soundings that fit to the current km range in MINFO bed height workflow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2712
diff
changeset
|
71 River river, |
150dcdefeb7d
Only offer soundings that fit to the current km range in MINFO bed height workflow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2712
diff
changeset
|
72 double kmLo, |
150dcdefeb7d
Only offer soundings that fit to the current km range in MINFO bed height workflow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2712
diff
changeset
|
73 double kmHi, |
150dcdefeb7d
Only offer soundings that fit to the current km range in MINFO bed height workflow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2712
diff
changeset
|
74 List<KVP<String, String>> kvp |
150dcdefeb7d
Only offer soundings that fit to the current km range in MINFO bed height workflow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2712
diff
changeset
|
75 ) { |
2712
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
76 List<BedHeightSingle> singles = |
2716
150dcdefeb7d
Only offer soundings that fit to the current km range in MINFO bed height workflow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2712
diff
changeset
|
77 BedHeightSingle.getBedHeightSingles(river, kmLo, kmHi); |
3875
d12f108ccc9c
The usual whitespace and import cleanups.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3782
diff
changeset
|
78 |
2712
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
79 if (singles != null) { |
3782
5d0419882382
Added missing translation of minfo state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3722
diff
changeset
|
80 int size = singles.size(); |
3875
d12f108ccc9c
The usual whitespace and import cleanups.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3782
diff
changeset
|
81 |
3782
5d0419882382
Added missing translation of minfo state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3722
diff
changeset
|
82 logger.debug("Found " + size + " singles."); |
3875
d12f108ccc9c
The usual whitespace and import cleanups.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3782
diff
changeset
|
83 |
3782
5d0419882382
Added missing translation of minfo state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3722
diff
changeset
|
84 for (int i = 0; i < size; i++) { |
2712
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
85 BedHeightSingle s = singles.get(i); |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
86 |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
87 String id = PREFIX_SINGLE + s.getId(); |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
88 String value = s.getDescription(); |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
89 |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
90 kvp.add(new KVP(id, value)); |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
91 } |
2709
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 } |
2712
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
93 } |
2709
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 |
2712
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
95 |
2716
150dcdefeb7d
Only offer soundings that fit to the current km range in MINFO bed height workflow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2712
diff
changeset
|
96 protected void appendEpochs( |
150dcdefeb7d
Only offer soundings that fit to the current km range in MINFO bed height workflow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2712
diff
changeset
|
97 River river, |
150dcdefeb7d
Only offer soundings that fit to the current km range in MINFO bed height workflow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2712
diff
changeset
|
98 double kmLo, |
150dcdefeb7d
Only offer soundings that fit to the current km range in MINFO bed height workflow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2712
diff
changeset
|
99 double kmHi, |
150dcdefeb7d
Only offer soundings that fit to the current km range in MINFO bed height workflow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2712
diff
changeset
|
100 List<KVP<String, String>> kvp |
150dcdefeb7d
Only offer soundings that fit to the current km range in MINFO bed height workflow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2712
diff
changeset
|
101 ) { |
2712
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
102 List<BedHeightEpoch> epochs = |
2716
150dcdefeb7d
Only offer soundings that fit to the current km range in MINFO bed height workflow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2712
diff
changeset
|
103 BedHeightEpoch.getBedHeightEpochs(river, kmLo, kmHi); |
2712
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
104 |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
105 if (epochs != null) { |
3782
5d0419882382
Added missing translation of minfo state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3722
diff
changeset
|
106 int size = epochs.size(); |
3875
d12f108ccc9c
The usual whitespace and import cleanups.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3782
diff
changeset
|
107 |
3782
5d0419882382
Added missing translation of minfo state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3722
diff
changeset
|
108 logger.debug("Found " + size + " epochs."); |
3875
d12f108ccc9c
The usual whitespace and import cleanups.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3782
diff
changeset
|
109 |
3782
5d0419882382
Added missing translation of minfo state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3722
diff
changeset
|
110 for (int i = 0; i < size; i++) { |
2712
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
111 BedHeightEpoch e = epochs.get(i); |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
112 |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
113 String id = PREFIX_EPOCH + e.getId(); |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
114 String value = e.getDescription(); |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
115 |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
116 kvp.add(new KVP(id, value)); |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
117 } |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
118 } |
2709
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 } |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 @Override |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 protected String getLabelFor( |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 CallContext cc, |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 String parameterName, |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 String value |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 ) throws IllegalArgumentException |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 { |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 if (!testParameterName(parameterName)) { |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 throw new IllegalArgumentException( |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 "Invalid parameter for state: '" + parameterName + "'"); |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 } |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 |
2712
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
134 if (value.indexOf(PREFIX_SINGLE) >= 0) { |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
135 return getLabelForSingle(cc, value); |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
136 } |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
137 else if (value.indexOf(PREFIX_EPOCH) >= 0) { |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
138 return getLabelForEpoch(cc, value); |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
139 } |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
140 |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
141 return value; |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
142 } |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
143 |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
144 |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
145 protected String getLabelForSingle(CallContext cc, String value) { |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
146 String id = value.replace(PREFIX_SINGLE, ""); |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
147 try { |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
148 BedHeightSingle s = BedHeightSingle.getBedHeightSingleById( |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
149 Integer.parseInt(id)); |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
150 |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
151 if (s != null) { |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
152 return s.getDescription(); |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
153 } |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
154 else { |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
155 return "no value for '" + id + "'"; |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
156 } |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
157 } |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
158 catch (NumberFormatException nfe) { |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
159 logger.warn("Could not parse id from string '" + id + "'", nfe); |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
160 } |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
161 |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
162 return "n.A."; |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
163 } |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
164 |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
165 |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
166 protected String getLabelForEpoch(CallContext cc, String value) { |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
167 String id = value.replace(PREFIX_EPOCH, ""); |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
168 try { |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
169 BedHeightEpoch e = BedHeightEpoch.getBedHeightEpochById( |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
170 Integer.parseInt(id)); |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
171 |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
172 if (e != null) { |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
173 return e.getDescription(); |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
174 } |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
175 else { |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
176 return "no value for '" + id + "'"; |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
177 } |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
178 } |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
179 catch (NumberFormatException nfe) { |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
180 logger.warn("Could not parse id from string '" + id + "'", nfe); |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
181 } |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
182 |
ed612b85fb6d
Implemented SoundingsSelect.getOptions() and SoundingsSelect.getLabelFor().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2709
diff
changeset
|
183 return "n.A."; |
2709
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
184 } |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
185 |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
186 |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
187 /** |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
188 * This method might be used to test, if a parameter name is handled by this |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
189 * state. |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
190 * |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
191 * @param parameterName The name of a parameter. |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
192 * |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
193 * @return true, if parameterName is one of <i>MAIN_CHANNEL</i> or |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
194 * <i>TOTAL_CHANNEL</i>. Otherwise false. |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
195 */ |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
196 protected boolean testParameterName(String parameterName) { |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
197 if (parameterName == null || parameterName.length() == 0) { |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
198 return false; |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
199 } |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
200 else if (parameterName.equals(SOUNDINGS)) { |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
201 return true; |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
202 } |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
203 else { |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
204 return false; |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
205 } |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
206 } |
cd6bcca17de6
Added states and improved transition model for MINFO middle bed height calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
207 } |
3083
4bd3d8bbb60c
Added missing vim lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2716
diff
changeset
|
208 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |