source: ether_ndacc/trunk/web/src/com/ether/Controller.java @ 432

Last change on this file since 432 was 432, checked in by rboipsl, 12 years ago

clean

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