1 | package com.ether; |
---|
2 | |
---|
3 | import com.ether.annotation.ControllerMethod; |
---|
4 | import com.ether.annotation.ParamName; |
---|
5 | import com.ether.instrument.Instrument; |
---|
6 | import com.ether.station.Station; |
---|
7 | import org.apache.commons.logging.Log; |
---|
8 | import org.apache.commons.logging.LogFactory; |
---|
9 | import org.springframework.beans.factory.annotation.Required; |
---|
10 | import org.springframework.web.servlet.ModelAndView; |
---|
11 | |
---|
12 | import javax.servlet.http.HttpServletRequest; |
---|
13 | import javax.servlet.http.HttpServletResponse; |
---|
14 | import java.util.HashMap; |
---|
15 | import java.util.List; |
---|
16 | import java.util.Map; |
---|
17 | |
---|
18 | /** |
---|
19 | * @author vmipsl |
---|
20 | * @date 17 feb 2011 |
---|
21 | */ |
---|
22 | public class Controller |
---|
23 | extends ControllerEther |
---|
24 | { |
---|
25 | /** *********************************************************** **/ |
---|
26 | /** *********************** VIEWS ***************************** **/ |
---|
27 | /** *********************************************************** **/ |
---|
28 | |
---|
29 | /** |
---|
30 | * Default view if url's methodName is unknown |
---|
31 | * |
---|
32 | * @return |
---|
33 | * @throws WebException |
---|
34 | */ |
---|
35 | @ControllerMethod(view = VIEW_INIT) |
---|
36 | public Map<String, Object> home() |
---|
37 | throws WebException |
---|
38 | { |
---|
39 | return new HashMap<String, Object>(); |
---|
40 | } |
---|
41 | |
---|
42 | @ControllerMethod(view = VIEW_DATA_OHP) |
---|
43 | public Map<String, Object> viewDataOhp() |
---|
44 | throws WebException |
---|
45 | { |
---|
46 | return new HashMap<String, Object>(); |
---|
47 | } |
---|
48 | |
---|
49 | @ControllerMethod(view = VIEW_DATA_OPAR) |
---|
50 | public Map<String, Object> viewDataOpar() |
---|
51 | throws WebException |
---|
52 | { |
---|
53 | return new HashMap<String, Object>(); |
---|
54 | } |
---|
55 | |
---|
56 | @ControllerMethod(view = VIEW_DATA_DDU) |
---|
57 | public Map<String, Object> viewDataDdu() |
---|
58 | throws WebException |
---|
59 | { |
---|
60 | return new HashMap<String, Object>(); |
---|
61 | } |
---|
62 | |
---|
63 | @ControllerMethod(view = VIEW_DATA_OMP) |
---|
64 | public Map<String, Object> viewDataOmp() |
---|
65 | throws WebException |
---|
66 | { |
---|
67 | return new HashMap<String, Object>(); |
---|
68 | } |
---|
69 | |
---|
70 | @ControllerMethod(view = VIEW_DATA_VDA) |
---|
71 | public Map<String, Object> viewDataVda() |
---|
72 | throws WebException |
---|
73 | { |
---|
74 | return new HashMap<String, Object>(); |
---|
75 | } |
---|
76 | |
---|
77 | @ControllerMethod(view = VIEW_DATA_BRI) |
---|
78 | public Map<String, Object> viewDataBri() |
---|
79 | throws WebException |
---|
80 | { |
---|
81 | return new HashMap<String, Object>(); |
---|
82 | } |
---|
83 | |
---|
84 | @ControllerMethod(view = VIEW_DATA_SCO) |
---|
85 | public Map<String, Object> viewDataSco() |
---|
86 | throws WebException |
---|
87 | { |
---|
88 | return new HashMap<String, Object>(); |
---|
89 | } |
---|
90 | |
---|
91 | @ControllerMethod(view = VIEW_DATA_AND) |
---|
92 | public Map<String, Object> viewDataAnd() |
---|
93 | throws WebException |
---|
94 | { |
---|
95 | return new HashMap<String, Object>(); |
---|
96 | } |
---|
97 | |
---|
98 | @ControllerMethod(view = VIEW_DATA_SOD) |
---|
99 | public Map<String, Object> viewDataSod() |
---|
100 | throws WebException |
---|
101 | { |
---|
102 | return new HashMap<String, Object>(); |
---|
103 | } |
---|
104 | |
---|
105 | @ControllerMethod(view = VIEW_DATA_ZHI) |
---|
106 | public Map<String, Object> viewDataZhi() |
---|
107 | throws WebException |
---|
108 | { |
---|
109 | return new HashMap<String, Object>(); |
---|
110 | } |
---|
111 | |
---|
112 | @ControllerMethod(view = VIEW_DATA_SAL) |
---|
113 | public Map<String, Object> viewDataSal() |
---|
114 | throws WebException |
---|
115 | { |
---|
116 | return new HashMap<String, Object>(); |
---|
117 | } |
---|
118 | |
---|
119 | @ControllerMethod(view = VIEW_DATA_BOR) |
---|
120 | public Map<String, Object> viewDataBor() |
---|
121 | throws WebException |
---|
122 | { |
---|
123 | return new HashMap<String, Object>(); |
---|
124 | } |
---|
125 | |
---|
126 | @ControllerMethod(view = VIEW_DATA_TAR) |
---|
127 | public Map<String, Object> viewDataTar() |
---|
128 | throws WebException |
---|
129 | { |
---|
130 | return new HashMap<String, Object>(); |
---|
131 | } |
---|
132 | |
---|
133 | @ControllerMethod(view = VIEW_DATA_BAU) |
---|
134 | public Map<String, Object> viewDataBau() |
---|
135 | throws WebException |
---|
136 | { |
---|
137 | return new HashMap<String, Object>(); |
---|
138 | } |
---|
139 | |
---|
140 | @ControllerMethod(view = VIEW_DATA_KER) |
---|
141 | public Map<String, Object> viewDataKer() |
---|
142 | throws WebException |
---|
143 | { |
---|
144 | return new HashMap<String, Object>(); |
---|
145 | } |
---|
146 | |
---|
147 | @ControllerMethod(view = VIEW_DATA_RIO) |
---|
148 | public Map<String, Object> viewDataRio() |
---|
149 | throws WebException |
---|
150 | { |
---|
151 | return new HashMap<String, Object>(); |
---|
152 | } |
---|
153 | |
---|
154 | @ControllerMethod(view = VIEW_DATA_CON) |
---|
155 | public Map<String, Object> viewDataCon() |
---|
156 | throws WebException |
---|
157 | { |
---|
158 | return new HashMap<String, Object>(); |
---|
159 | } |
---|
160 | |
---|
161 | @ControllerMethod(view = VIEW_BIBLIO) |
---|
162 | public Map<String, Object> viewBiblio() |
---|
163 | throws WebException |
---|
164 | { |
---|
165 | return new HashMap<String, Object>(); |
---|
166 | } |
---|
167 | |
---|
168 | |
---|
169 | @ControllerMethod(view = VIEW_INTRA) |
---|
170 | public Map<String, Object> viewIntra() |
---|
171 | throws WebException |
---|
172 | { |
---|
173 | return new HashMap<String, Object>(); |
---|
174 | } |
---|
175 | |
---|
176 | @ControllerMethod(view = VIEW_ABOUT) |
---|
177 | public Map<String, Object> viewAbout() |
---|
178 | throws WebException |
---|
179 | { |
---|
180 | return new HashMap<String, Object>(); |
---|
181 | } |
---|
182 | |
---|
183 | @ControllerMethod(view = VIEW_ECC) |
---|
184 | public Map<String, Object> selectEcc( @ParamName("dateinf") final String dateinf, |
---|
185 | @ParamName("station") String station, |
---|
186 | @ParamName("instrument") final String instrument ) |
---|
187 | throws WebException |
---|
188 | { |
---|
189 | try |
---|
190 | { |
---|
191 | final List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStation( instrument, dateinf, "yyyyMMdd", station ); |
---|
192 | |
---|
193 | //dateinf="02021980"; |
---|
194 | //List<String> ListDates = _plotService.getLastDate(instrument); |
---|
195 | final List<String> listeDates = _serviceTools.getListeDates(); |
---|
196 | String rep = ""; |
---|
197 | String year = dateinf.substring( 0, 4 ); |
---|
198 | |
---|
199 | if( station.compareTo( "OHP" ) == 0 || station.compareTo( "ohp" ) == 0 ) |
---|
200 | { |
---|
201 | rep = "./resources/visu/ohp/ecc"; |
---|
202 | station = "OHP"; |
---|
203 | if( year.compareTo( "1970" ) == 0 ) year = "2007"; |
---|
204 | } |
---|
205 | else if( station.compareTo( "LA REUNION" ) == 0 || station.compareTo( "reunion" ) == 0 ) |
---|
206 | { |
---|
207 | rep = "./resources/visu/reu/ecc"; |
---|
208 | //rep="./resources/visu/ohp/lidar/o3_strato"; |
---|
209 | station = "LA REUNION"; |
---|
210 | if( year.compareTo( "1970" ) == 0 ) year = "2006"; |
---|
211 | //year="2006"; |
---|
212 | } |
---|
213 | else if( station.compareTo( "DDU" ) == 0 || station.compareTo( "ddu" ) == 0 ) |
---|
214 | { |
---|
215 | rep = "./resources/visu/ddu/ecc"; |
---|
216 | //rep="./resources/visu/ohp/lidar/o3_strato"; |
---|
217 | station = "DDU"; |
---|
218 | if( year.compareTo( "1970" ) == 0 ) year = "1991"; |
---|
219 | //year="2006"; |
---|
220 | } |
---|
221 | |
---|
222 | final Map<String, Object> model = new HashMap<String, Object>(); |
---|
223 | model.put( "plotsList", plotsList ); |
---|
224 | model.put( "listeDates", listeDates ); |
---|
225 | model.put( "firstDate", dateinf ); |
---|
226 | final String month = dateinf.substring( 4, 6 ); |
---|
227 | model.put( "month", month ); |
---|
228 | model.put( "year", year ); |
---|
229 | model.put( "station", station ); |
---|
230 | model.put( "rep", rep ); |
---|
231 | return model; |
---|
232 | } |
---|
233 | catch( ServiceException e ) |
---|
234 | { |
---|
235 | throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); |
---|
236 | } |
---|
237 | } |
---|
238 | |
---|
239 | @ControllerMethod(view = VIEW_ECC_RT) |
---|
240 | public Map<String, Object> selectEccRT( @ParamName("dateinf") String dateinf, |
---|
241 | @ParamName("station") String station, |
---|
242 | @ParamName("instrument") final String instrument, |
---|
243 | @ParamName("type") final String type ) |
---|
244 | throws WebException |
---|
245 | { |
---|
246 | try |
---|
247 | { |
---|
248 | |
---|
249 | |
---|
250 | String rep = ""; |
---|
251 | String year = dateinf.substring( 0, 4 ); |
---|
252 | String month= dateinf.substring( 4, 6 ); |
---|
253 | |
---|
254 | if( station.compareTo( "OHP" ) == 0 || station.compareTo( "ohp" ) == 0 ) |
---|
255 | { |
---|
256 | rep = "./resources/visu/ohp/ecc"; |
---|
257 | station = "OHP"; |
---|
258 | if( year.compareTo( "1970" ) == 0 ) { |
---|
259 | year = "2012"; |
---|
260 | month = "01"; |
---|
261 | } |
---|
262 | } |
---|
263 | else if( station.compareTo( "LA REUNION" ) == 0 || station.compareTo( "reunion" ) == 0 ) |
---|
264 | { |
---|
265 | rep = "./resources/visu/reu/ecc"; |
---|
266 | //rep="./resources/visu/ohp/lidar/o3_strato"; |
---|
267 | station = "LA REUNION"; |
---|
268 | if( year.compareTo( "1970" ) == 0 ) year = "2006"; |
---|
269 | //year="2006"; |
---|
270 | } |
---|
271 | else if( station.compareTo( "DDU" ) == 0 || station.compareTo( "ddu" ) == 0 ) |
---|
272 | { |
---|
273 | rep = "./resources/visu/ddu/ecc"; |
---|
274 | //rep="./resources/visu/ohp/lidar/o3_strato"; |
---|
275 | station = "DDU"; |
---|
276 | if( year.compareTo( "1970" ) == 0 ) year = "1991"; |
---|
277 | //year="2006"; |
---|
278 | } |
---|
279 | |
---|
280 | |
---|
281 | dateinf=year+month+"01"; |
---|
282 | final List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStationByType( instrument, dateinf, "yyyyMMdd", station, type ); |
---|
283 | |
---|
284 | |
---|
285 | //dateinf="02021980"; |
---|
286 | //List<String> ListDates = _plotService.getLastDate(instrument); |
---|
287 | final List<String> listeDates = _serviceTools.getListeDates(); |
---|
288 | final Map<String, Object> model = new HashMap<String, Object>(); |
---|
289 | |
---|
290 | model.put( "plotsList", plotsList ); |
---|
291 | model.put( "listeDates", listeDates ); |
---|
292 | model.put( "firstDate", dateinf ); |
---|
293 | |
---|
294 | model.put( "month", month ); |
---|
295 | model.put( "year", year ); |
---|
296 | model.put( "station", station ); |
---|
297 | |
---|
298 | // model.put( "dateinf", dateinf ); |
---|
299 | model.put( "rep", rep ); |
---|
300 | return model; |
---|
301 | |
---|
302 | } |
---|
303 | catch( ServiceException e ) |
---|
304 | { |
---|
305 | throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); |
---|
306 | } |
---|
307 | } |
---|
308 | |
---|
309 | public ModelAndView viewLidarO3s( final HttpServletRequest request, final HttpServletResponse response ) |
---|
310 | throws WebException |
---|
311 | { |
---|
312 | try |
---|
313 | { |
---|
314 | final List<String> listeDates = _serviceTools.getListeDates(); |
---|
315 | |
---|
316 | final ModelAndView modelAndView = new ModelAndView( VIEW_LIDAR_O3S ); |
---|
317 | modelAndView.addObject( "listeDates", listeDates ); |
---|
318 | |
---|
319 | return modelAndView; |
---|
320 | |
---|
321 | } |
---|
322 | catch( ServiceException e ) |
---|
323 | { |
---|
324 | throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); |
---|
325 | } |
---|
326 | } |
---|
327 | |
---|
328 | @ControllerMethod(view = VIEW_LIDAR_O3S) |
---|
329 | public Map<String, Object> selectLidarO3s( @ParamName("dateinf") final String dateinf, |
---|
330 | @ParamName("station") String station, |
---|
331 | @ParamName("instrument") final String instrument ) |
---|
332 | throws WebException |
---|
333 | |
---|
334 | /*public ModelAndView selectLidarO3s( final HttpServletRequest request, final HttpServletResponse response ) |
---|
335 | throws WebException*/ |
---|
336 | { |
---|
337 | try |
---|
338 | { |
---|
339 | /*String dateinf = request.getParameter( "dateinf" ); |
---|
340 | String station = request.getParameter( "station" ); |
---|
341 | |
---|
342 | final String instrument = request.getParameter( "instrument" );*/ |
---|
343 | |
---|
344 | List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStation( instrument, dateinf, "yyyyMMdd", station ); |
---|
345 | |
---|
346 | //dateinf="02021980"; |
---|
347 | //List<String> ListDates = _plotService.getLastDate(instrument); |
---|
348 | final List<String> listeDates = _serviceTools.getListeDates(); |
---|
349 | String rep = ""; |
---|
350 | String year = dateinf.substring( 0, 4 ); |
---|
351 | String month = dateinf.substring( 4, 6 ); |
---|
352 | |
---|
353 | if( station.compareTo( "OHP" ) == 0 || station.compareTo( "ohp" ) == 0 ) |
---|
354 | { |
---|
355 | rep = "./resources/visu/ohp/lidar/o3_strato"; |
---|
356 | station = "OHP"; |
---|
357 | if( year.compareTo( "1970" ) == 0 ) |
---|
358 | { |
---|
359 | |
---|
360 | year = "1991"; |
---|
361 | } |
---|
362 | } |
---|
363 | else if( station.compareTo( "REU" ) == 0 || station.compareTo( "reu" ) == 0 || station.compareTo( "LA REUNION" ) == 0 || station.compareTo( "REUNION" ) == 0 ) |
---|
364 | { |
---|
365 | rep = "./resources/visu/reu/lidar/o3_strato"; |
---|
366 | station = "LA REUNION"; |
---|
367 | if( year.compareTo( "1970" ) == 0 ) year = "2006"; |
---|
368 | //year="2006"; |
---|
369 | } |
---|
370 | |
---|
371 | else |
---|
372 | { |
---|
373 | rep = "./resources/visu/ddu/lidar/o3_strato"; |
---|
374 | station = "DDUModelAndView"; |
---|
375 | if( year.compareTo( "1970" ) == 0 ) |
---|
376 | { |
---|
377 | year = "1991"; |
---|
378 | //month="04"; |
---|
379 | } |
---|
380 | //year="2006"; |
---|
381 | } |
---|
382 | |
---|
383 | final Map<String, Object> modelAndView = new HashMap<String, Object>(); |
---|
384 | //plotsList=null; |
---|
385 | modelAndView.put( "plotsList", plotsList ); |
---|
386 | |
---|
387 | modelAndView.put( "listeDates", listeDates ); |
---|
388 | modelAndView.put( "firstDate", dateinf ); |
---|
389 | |
---|
390 | |
---|
391 | modelAndView.put( "month", month ); |
---|
392 | modelAndView.put( "year", year ); |
---|
393 | modelAndView.put( "station", station ); |
---|
394 | modelAndView.put( "rep", rep ); |
---|
395 | |
---|
396 | return modelAndView; |
---|
397 | |
---|
398 | } |
---|
399 | catch( ServiceException e ) |
---|
400 | { |
---|
401 | throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); |
---|
402 | } |
---|
403 | } |
---|
404 | |
---|
405 | @ControllerMethod(view = VIEW_LIDAR_O3T) |
---|
406 | public Map<String, Object> selectLidarO3t( @ParamName("dateinf") String dateinf, |
---|
407 | @ParamName("station") String station, |
---|
408 | @ParamName("instrument") final String instrument ) |
---|
409 | throws WebException |
---|
410 | { |
---|
411 | try |
---|
412 | { |
---|
413 | |
---|
414 | List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStation( instrument, dateinf, "yyyyMMdd", station ); |
---|
415 | |
---|
416 | //dateinf="02021980"; |
---|
417 | //List<String> ListDates = _plotService.getLastDate(instrument); |
---|
418 | final List<String> listeDates = _serviceTools.getListeDates(); |
---|
419 | String rep = ""; |
---|
420 | String year = dateinf.substring( 0, 4 ); |
---|
421 | String month = dateinf.substring( 4, 6 ); |
---|
422 | |
---|
423 | if( station.compareTo( "OHP" ) == 0 || station.compareTo( "ohp" ) == 0 ) |
---|
424 | { |
---|
425 | rep = "./resources/visu/ohp/lidar/o3_tropo"; |
---|
426 | station = "OHP"; |
---|
427 | if( year.compareTo( "1970" ) == 0 ) |
---|
428 | { |
---|
429 | year = "2007"; |
---|
430 | month = "05"; |
---|
431 | dateinf = year + month + "01"; |
---|
432 | } |
---|
433 | } |
---|
434 | //else if (station.compareTo("reunion")==0) { |
---|
435 | else |
---|
436 | { |
---|
437 | rep = "./resources/visu/reu/lidar/o3_tropo"; |
---|
438 | //rep="./resources/visu/ohp/lidar/o3_strato"; |
---|
439 | station = "LA REUNION"; |
---|
440 | if( year.compareTo( "1970" ) == 0 ) |
---|
441 | { |
---|
442 | year = "2006"; |
---|
443 | |
---|
444 | } |
---|
445 | //year="2006"; |
---|
446 | } |
---|
447 | |
---|
448 | final Map<String, Object> mView = new HashMap<String, Object>(); |
---|
449 | //plotsList=null; |
---|
450 | mView.put( "plotsList", plotsList ); |
---|
451 | |
---|
452 | mView.put( "listeDates", listeDates ); |
---|
453 | mView.put( "firstDate", dateinf ); |
---|
454 | |
---|
455 | //String month = dateinf.substring(4,6); |
---|
456 | mView.put( "month", month ); |
---|
457 | mView.put( "year", year ); |
---|
458 | mView.put( "station", station ); |
---|
459 | mView.put( "rep", rep ); |
---|
460 | |
---|
461 | return mView; |
---|
462 | |
---|
463 | } |
---|
464 | catch( ServiceException e ) |
---|
465 | { |
---|
466 | throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); |
---|
467 | } |
---|
468 | } |
---|
469 | |
---|
470 | @ControllerMethod(view = VIEW_UMK) |
---|
471 | public Map<String, Object> selectUmk( @ParamName("dateinf") String dateinf, |
---|
472 | @ParamName("station") String station, |
---|
473 | @ParamName("instrument") final String instrument ) |
---|
474 | throws WebException |
---|
475 | { |
---|
476 | try |
---|
477 | { |
---|
478 | //dateinf="02021980"; |
---|
479 | //List<String> ListDates = _plotService.getLastDate(instrument); |
---|
480 | String rep = ""; |
---|
481 | String year = dateinf.substring( 0, 4 ); |
---|
482 | String month = dateinf.substring( 4, 6 ); |
---|
483 | |
---|
484 | rep = "./resources/visu/ohp/umk"; |
---|
485 | station = "OHP"; |
---|
486 | if( year.compareTo( "1970" ) == 0 ) |
---|
487 | { |
---|
488 | year = "1983"; |
---|
489 | month = "09"; |
---|
490 | dateinf = year + month + "03"; |
---|
491 | } |
---|
492 | |
---|
493 | // dateinf="20120101"; |
---|
494 | dateinf=year+month+"01"; |
---|
495 | List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStation( instrument, dateinf, "yyyyMMdd", station ); |
---|
496 | final List<String> listeDates = _serviceTools.getListeDates(); |
---|
497 | |
---|
498 | final Map<String, Object> model = new HashMap<String, Object>(); |
---|
499 | |
---|
500 | model.put( "plotsList", plotsList ); |
---|
501 | |
---|
502 | |
---|
503 | |
---|
504 | final Map<String, Object> mView = new HashMap<String, Object>(); |
---|
505 | //plotsList=null; |
---|
506 | mView.put( "plotsList", plotsList ); |
---|
507 | |
---|
508 | mView.put( "listeDates", listeDates ); |
---|
509 | mView.put( "firstDate", dateinf ); |
---|
510 | |
---|
511 | //String month = dateinf.substring(4,6); |
---|
512 | mView.put( "month", month ); |
---|
513 | mView.put( "year", year ); |
---|
514 | mView.put( "station", station ); |
---|
515 | mView.put( "rep", rep ); |
---|
516 | |
---|
517 | |
---|
518 | |
---|
519 | return mView; |
---|
520 | |
---|
521 | } |
---|
522 | catch( ServiceException e ) |
---|
523 | { |
---|
524 | throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); |
---|
525 | } |
---|
526 | } |
---|
527 | |
---|
528 | @ControllerMethod(view = VIEW_LIDAR_TEMP) |
---|
529 | public Map<String, Object> selectLidarTemp( @ParamName("dateinf") String dateinf, |
---|
530 | @ParamName("station") String station, |
---|
531 | @ParamName("instrument") final String instrument ) |
---|
532 | throws WebException |
---|
533 | { |
---|
534 | try |
---|
535 | { |
---|
536 | |
---|
537 | List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStation( instrument, dateinf, "yyyyMMdd", station ); |
---|
538 | |
---|
539 | //dateinf="02021980"; |
---|
540 | //List<String> ListDates = _plotService.getLastDate(instrument); |
---|
541 | final List<String> listeDates = _serviceTools.getListeDates(); |
---|
542 | String rep = ""; |
---|
543 | String year = dateinf.substring( 0, 4 ); |
---|
544 | String month = dateinf.substring( 4, 6 ); |
---|
545 | |
---|
546 | if( station.compareTo( "OHP" ) == 0 || station.compareTo( "ohp" ) == 0 ) |
---|
547 | { |
---|
548 | rep = "./resources/visu/ohp/lidar/temp"; |
---|
549 | station = "OHP"; |
---|
550 | if( year.compareTo( "1970" ) == 0 ) |
---|
551 | { |
---|
552 | year = "2009"; |
---|
553 | month = "01"; |
---|
554 | } |
---|
555 | } |
---|
556 | |
---|
557 | if( station.compareTo( "REU" ) == 0 || station.compareTo( "reu" ) == 0 ) |
---|
558 | { |
---|
559 | rep = "./resources/visu/reu/lidar/temp"; |
---|
560 | station = "REU"; |
---|
561 | if( year.compareTo( "1970" ) == 0 ) |
---|
562 | { |
---|
563 | year = "1994"; |
---|
564 | month = "05"; |
---|
565 | } |
---|
566 | } |
---|
567 | |
---|
568 | final Map<String, Object> mView = new HashMap<String, Object>(); |
---|
569 | |
---|
570 | mView.put( "plotsList", plotsList ); |
---|
571 | |
---|
572 | mView.put( "listeDates", listeDates ); |
---|
573 | mView.put( "firstDate", dateinf ); |
---|
574 | |
---|
575 | |
---|
576 | mView.put( "month", month ); |
---|
577 | mView.put( "year", year ); |
---|
578 | mView.put( "station", station ); |
---|
579 | mView.put( "rep", rep ); |
---|
580 | |
---|
581 | return mView; |
---|
582 | |
---|
583 | } |
---|
584 | catch( ServiceException e ) |
---|
585 | { |
---|
586 | throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); |
---|
587 | } |
---|
588 | } |
---|
589 | |
---|
590 | @ControllerMethod(view = VIEW_LIDAR_AEROSOLS) |
---|
591 | public Map<String, Object> selectLidarAerosols( @ParamName("dateinf") String dateinf, |
---|
592 | @ParamName("station") String station, |
---|
593 | @ParamName("instrument") final String instrument ) |
---|
594 | throws WebException |
---|
595 | { |
---|
596 | try |
---|
597 | { |
---|
598 | |
---|
599 | List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStation( instrument, dateinf, "yyyyMMdd", station ); |
---|
600 | |
---|
601 | //dateinf="02021980"; |
---|
602 | //List<String> ListDates = _plotService.getLastDate(instrument); |
---|
603 | final List<String> listeDates = _serviceTools.getListeDates(); |
---|
604 | String rep = ""; |
---|
605 | String year = dateinf.substring( 0, 4 ); |
---|
606 | String month = dateinf.substring( 4, 6 ); |
---|
607 | |
---|
608 | if( station.compareTo( "OHP" ) == 0 || station.compareTo( "ohp" ) == 0 ) |
---|
609 | { |
---|
610 | rep = "./resources/visu/ohp/lidar/aerosols"; |
---|
611 | station = "OHP"; |
---|
612 | if( year.compareTo( "1970" ) == 0 ) |
---|
613 | { |
---|
614 | year = "2009"; |
---|
615 | month = "01"; |
---|
616 | } |
---|
617 | } |
---|
618 | |
---|
619 | if( station.compareTo( "DDU" ) == 0 || station.compareTo( "ddu" ) == 0 ) |
---|
620 | { |
---|
621 | rep = "./resources/visu/ddu/lidar/aerosols"; |
---|
622 | station = "DDU"; |
---|
623 | if( year.compareTo( "1970" ) == 0 ) |
---|
624 | { |
---|
625 | year = "2010"; |
---|
626 | month = "11"; |
---|
627 | } |
---|
628 | } |
---|
629 | |
---|
630 | final Map<String, Object> mView = new HashMap<String, Object>(); |
---|
631 | //plotsList=null; |
---|
632 | mView.put( "plotsList", plotsList ); |
---|
633 | |
---|
634 | mView.put( "listeDates", listeDates ); |
---|
635 | mView.put( "firstDate", dateinf ); |
---|
636 | |
---|
637 | //String month = dateinf.substring(4,6); |
---|
638 | mView.put( "month", month ); |
---|
639 | mView.put( "year", year ); |
---|
640 | mView.put( "station", station ); |
---|
641 | mView.put( "rep", rep ); |
---|
642 | |
---|
643 | return mView; |
---|
644 | |
---|
645 | } |
---|
646 | catch( ServiceException e ) |
---|
647 | { |
---|
648 | throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); |
---|
649 | } |
---|
650 | } |
---|
651 | |
---|
652 | @ControllerMethod(view =VIEW_SPECTRO_UV) |
---|
653 | public Map<String, Object> viewSpectroUV( @ParamName("dateinf") String dateinf, |
---|
654 | @ParamName("especes") String especes, |
---|
655 | @ParamName("instrument") final String instrument |
---|
656 | ) |
---|
657 | throws WebException |
---|
658 | { |
---|
659 | try |
---|
660 | { |
---|
661 | |
---|
662 | String m[]; |
---|
663 | m = new String[12]; |
---|
664 | String fname, iname, year; |
---|
665 | |
---|
666 | if( especes.equals( "nan" ) ) |
---|
667 | { |
---|
668 | especes = "uvauvb"; |
---|
669 | } |
---|
670 | |
---|
671 | if( dateinf.equals( "nan" ) ) |
---|
672 | { |
---|
673 | year = "2008"; |
---|
674 | dateinf = "2008"; |
---|
675 | |
---|
676 | } |
---|
677 | |
---|
678 | List<String> plotsList = _plotService.getPlotsByDateByInstrument( instrument, dateinf, "yyyy" ); |
---|
679 | final List<String> listeDates = _serviceTools.getListeDates(); |
---|
680 | |
---|
681 | final Map<String, Object> mView = new HashMap<String, Object>(); |
---|
682 | |
---|
683 | mView.put( "plotsList", plotsList ); |
---|
684 | |
---|
685 | mView.put( "listeDates", listeDates ); |
---|
686 | mView.put( "firstDate", dateinf ); |
---|
687 | mView.put( "especes", especes ); |
---|
688 | year = dateinf.substring( 0, 4 ); |
---|
689 | |
---|
690 | mView.put( "year", year ); |
---|
691 | mView.put( "m", m ); |
---|
692 | |
---|
693 | fname = "vasp_"; |
---|
694 | fname = fname.concat( especes ); |
---|
695 | fname = fname.concat( "_" ); |
---|
696 | fname = fname.concat( year ); |
---|
697 | |
---|
698 | iname = fname.concat( "01_plot1.jpg" ); |
---|
699 | if( plotsList.contains( iname ) ) m[0] = iname; |
---|
700 | else m[0] = "no"; |
---|
701 | |
---|
702 | iname = fname.concat( "02_plot1.jpg" ); |
---|
703 | if( plotsList.contains( iname ) ) m[1] = iname; |
---|
704 | else m[1] = "no"; |
---|
705 | |
---|
706 | iname = fname.concat( "03_plot1.jpg" ); |
---|
707 | if( plotsList.contains( iname ) ) m[2] = iname; |
---|
708 | else m[2] = "no"; |
---|
709 | |
---|
710 | iname = fname.concat( "04_plot1.jpg" ); |
---|
711 | if( plotsList.contains( iname ) ) m[3] = iname; |
---|
712 | else m[3] = "no"; |
---|
713 | |
---|
714 | iname = fname.concat( "05_plot1.jpg" ); |
---|
715 | if( plotsList.contains( iname ) ) m[4] = iname; |
---|
716 | else m[4] = "no"; |
---|
717 | |
---|
718 | iname = fname.concat( "06_plot1.jpg" ); |
---|
719 | if( plotsList.contains( iname ) ) m[5] = iname; |
---|
720 | else m[5] = "no"; |
---|
721 | |
---|
722 | iname = fname.concat( "07_plot1.jpg" ); |
---|
723 | if( plotsList.contains( iname ) ) m[6] = iname; |
---|
724 | else m[6] = "no"; |
---|
725 | |
---|
726 | iname = fname.concat( "08_plot1.jpg" ); |
---|
727 | if( plotsList.contains( iname ) ) m[7] = iname; |
---|
728 | else m[7] = "no"; |
---|
729 | |
---|
730 | iname = fname.concat( "09_plot1.jpg" ); |
---|
731 | if( plotsList.contains( iname ) ) m[8] = iname; |
---|
732 | else m[8] = "no"; |
---|
733 | |
---|
734 | iname = fname.concat( "10_plot1.jpg" ); |
---|
735 | if( plotsList.contains( iname ) ) m[9] = iname; |
---|
736 | else m[9] = "no"; |
---|
737 | |
---|
738 | iname = fname.concat( "11_plot1.jpg" ); |
---|
739 | if( plotsList.contains( iname ) ) m[10] = iname; |
---|
740 | else m[10] = "no"; |
---|
741 | |
---|
742 | iname = fname.concat( "12_plot1.jpg" ); |
---|
743 | if( plotsList.contains( iname ) ) m[11] = iname; |
---|
744 | else m[11] = "no"; |
---|
745 | |
---|
746 | return mView; |
---|
747 | |
---|
748 | } |
---|
749 | catch( ServiceException e ) |
---|
750 | { |
---|
751 | throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); |
---|
752 | } |
---|
753 | } |
---|
754 | |
---|
755 | |
---|
756 | public ModelAndView viewInstruments( final HttpServletRequest request, final HttpServletResponse response ) |
---|
757 | throws WebException |
---|
758 | { |
---|
759 | try |
---|
760 | { |
---|
761 | final List<Instrument> instruments = _instrumentService.getAllInstruments(); |
---|
762 | |
---|
763 | final ModelAndView modelAndView = new ModelAndView( VIEW_INSTRUMENT ); |
---|
764 | modelAndView.addObject( "instruments", instruments ); |
---|
765 | return modelAndView; |
---|
766 | |
---|
767 | } |
---|
768 | catch( ServiceException e ) |
---|
769 | { |
---|
770 | throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); |
---|
771 | } |
---|
772 | } |
---|
773 | |
---|
774 | public ModelAndView viewStation( final HttpServletRequest request, final HttpServletResponse response ) |
---|
775 | throws WebException |
---|
776 | { |
---|
777 | try |
---|
778 | { |
---|
779 | final Long stationId = Long.valueOf( request.getParameter( "stationId" ) ); |
---|
780 | final Station station = _stationService.getStationById( stationId ); |
---|
781 | |
---|
782 | final ModelAndView modelAndView = new ModelAndView( VIEW_STATION ); |
---|
783 | modelAndView.addObject( "station", station ); |
---|
784 | return modelAndView; |
---|
785 | |
---|
786 | } |
---|
787 | catch( ServiceException e ) |
---|
788 | { |
---|
789 | throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); |
---|
790 | } |
---|
791 | } |
---|
792 | |
---|
793 | @Required |
---|
794 | public void setStationService( final StationService stationService ) |
---|
795 | { |
---|
796 | _stationService = stationService; |
---|
797 | } |
---|
798 | |
---|
799 | @Required |
---|
800 | public void setInstrumentService( final InstrumentService instrumentService ) |
---|
801 | { |
---|
802 | _instrumentService = instrumentService; |
---|
803 | } |
---|
804 | |
---|
805 | @Required |
---|
806 | public void setServiceTools( final ServiceTools serviceTools ) |
---|
807 | { |
---|
808 | _serviceTools = serviceTools; |
---|
809 | } |
---|
810 | |
---|
811 | @Required |
---|
812 | public void setPlotService( final PlotService plotService ) |
---|
813 | { |
---|
814 | _plotService = plotService; |
---|
815 | } |
---|
816 | |
---|
817 | private static final Log LOGGER = LogFactory.getLog( Controller.class ); |
---|
818 | |
---|
819 | private static final String VIEW_INIT = "init"; |
---|
820 | |
---|
821 | private static final String VIEW_INSTRUMENT = "instrument"; |
---|
822 | private static final String VIEW_STATION = "station"; |
---|
823 | private static final String VIEW_LIDAR_O3S = "visus_lidar_o3s"; |
---|
824 | private static final String VIEW_LIDAR_O3T = "visus_lidar_o3t"; |
---|
825 | private static final String VIEW_UMK = "visus_umk"; |
---|
826 | private static final String VIEW_ECC = "visus_ecc"; |
---|
827 | private static final String VIEW_ECC_RT = "visus_ecc_realtime"; |
---|
828 | private static final String VIEW_SPECTRO_UV = "visus_spectro"; |
---|
829 | private static final String VIEW_LIDAR_TEMP = "visus_lidar_temp"; |
---|
830 | private static final String VIEW_LIDAR_AEROSOLS = "visus_lidar_aerosols"; |
---|
831 | private static final String VIEW_DATA_OHP = "data_ohp"; |
---|
832 | private static final String VIEW_ABOUT = "about"; |
---|
833 | private static final String VIEW_DATA_OPAR = "data_opar"; |
---|
834 | private static final String VIEW_DATA_DDU = "data_ddu"; |
---|
835 | private static final String VIEW_DATA_OMP = "data_lannemezan"; |
---|
836 | private static final String VIEW_DATA_VDA = "data_villeneuve"; |
---|
837 | private static final String VIEW_DATA_BRI = "data_briancon"; |
---|
838 | private static final String VIEW_DATA_SCO = "data_scorebysund"; |
---|
839 | private static final String VIEW_DATA_AND = "data_andoya"; |
---|
840 | private static final String VIEW_DATA_SOD = "data_sodankyla"; |
---|
841 | private static final String VIEW_DATA_ZHI = "data_zhigansk"; |
---|
842 | private static final String VIEW_DATA_SAL = "data_salekhard"; |
---|
843 | private static final String VIEW_DATA_BOR = "data_bordeaux"; |
---|
844 | private static final String VIEW_DATA_TAR = "data_tarawa"; |
---|
845 | private static final String VIEW_DATA_BAU = "data_bauru"; |
---|
846 | private static final String VIEW_DATA_KER = "data_kerguelen"; |
---|
847 | private static final String VIEW_DATA_RIO = "data_riogallegos"; |
---|
848 | private static final String VIEW_DATA_CON = "data_concordia"; |
---|
849 | private static final String VIEW_BIBLIO = "biblio"; |
---|
850 | private static final String VIEW_INTRA = "community"; |
---|
851 | |
---|
852 | |
---|
853 | //services que le controller peut utiliser |
---|
854 | private StationService _stationService; |
---|
855 | private InstrumentService _instrumentService; |
---|
856 | private ServiceTools _serviceTools; |
---|
857 | private PlotService _plotService; |
---|
858 | } |
---|