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