comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java @ 1093:139e7df1787c

Cosmetics. flys-artifacts/trunk@2596 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 26 Aug 2011 12:45:32 +0000
parents e298c4d28927
children f465785ed1ae
comparison
equal deleted inserted replaced
1092:0eb585cd3882 1093:139e7df1787c
65 CallMeta callMeta, 65 CallMeta callMeta,
66 Document data) 66 Document data)
67 { 67 {
68 logger.debug("MainValuesArtifact.setup"); 68 logger.debug("MainValuesArtifact.setup");
69 super.setup(identifier, factory, context, callMeta, data); 69 super.setup(identifier, factory, context, callMeta, data);
70 // TODO in initialize(*), access master/winfo artifact,
71 // get locations and river.
72 } 70 }
73 71
74 72
75 @Override 73 @Override
76 protected void initialize(Artifact artifact, Object context, CallMeta meta) { 74 protected void initialize(Artifact artifact, Object context, CallMeta meta) {
77 logger.debug("MainValuesArtifact.initialize"); 75 logger.debug("MainValuesArtifact.initialize");
78 WINFOArtifact winfo = (WINFOArtifact) artifact; 76 WINFOArtifact winfo = (WINFOArtifact) artifact;
79 //River river = winfo.getRiver();
80 double location = winfo.getLocations()[0]; 77 double location = winfo.getLocations()[0];
81 logger.debug("MainValues.location: " + location);
82 addData("location", new DefaultStateData("location", null, null, 78 addData("location", new DefaultStateData("location", null, null,
83 String.valueOf(location))); 79 String.valueOf(location)));
84 addData("river", winfo.getData("river")); 80 addData("river", winfo.getData("river"));
85 } 81 }
86 82
153 state.getOutputs().add(mainValuesOutput2); 149 state.getOutputs().add(mainValuesOutput2);
154 } 150 }
155 return state; 151 return state;
156 } 152 }
157 153
154
158 /** 155 /**
159 * Get the river. 156 * Get the river.
160 * @todo resolve, this is a duplicate of WINFOArtifact. 157 * @todo resolve, this is a duplicate of WINFOArtifact.
161 */ 158 */
162 public River getRiver() { 159 public River getRiver() {
164 161
165 return dRiver != null 162 return dRiver != null
166 ? RiverFactory.getRiver((String) dRiver.getValue()) 163 ? RiverFactory.getRiver((String) dRiver.getValue())
167 : null; 164 : null;
168 } 165 }
166
169 167
170 /** 168 /**
171 * Access the Gauge that the mainvalues are taken from. 169 * Access the Gauge that the mainvalues are taken from.
172 * @return Gauge that main values are taken from or null in case of 170 * @return Gauge that main values are taken from or null in case of
173 * invalid parameterization. 171 * invalid parameterization.
225 */ 223 */
226 public List<NamedDouble> getMainValuesW() { 224 public List<NamedDouble> getMainValuesW() {
227 List<NamedDouble> filteredList = new ArrayList<NamedDouble>(); 225 List<NamedDouble> filteredList = new ArrayList<NamedDouble>();
228 Gauge gauge = getGauge(); 226 Gauge gauge = getGauge();
229 double datum = gauge.getDatum().doubleValue(); 227 double datum = gauge.getDatum().doubleValue();
230 logger.debug("DATUM:: " + datum);
231 if (gauge != null) { 228 if (gauge != null) {
232 List<MainValue> orig = gauge.getMainValues(); 229 List<MainValue> orig = gauge.getMainValues();
233 for (MainValue mv : orig) { 230 for (MainValue mv : orig) {
234 if (mv.getMainValue().getType().getName().equals("W")) { 231 if (mv.getMainValue().getType().getName().equals("W")) {
235 filteredList.add(new NamedDouble( 232 filteredList.add(new NamedDouble(

http://dive4elements.wald.intevation.org