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

Last change on this file since 840 was 840, checked in by npipsl, 8 years ago

Mise à jour copyright 2016, date menu déroulant ecc ohp, date ecc ddu , état instrument Salekhard, date menu déroulant par défaut ladoar o3 tropo et aérosols ohp

File size: 29.9 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.ArrayList;
15import java.util.Date;
16import java.util.HashMap;
17import java.util.List;
18import java.util.Map;
19
20/**
21 * @author vmipsl
22 * @date 17 feb 2011
23 */
24public 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 = "2014";
206            }
207            else if( station.compareTo( "REU" ) == 0 || station.compareTo( "reu" ) == 0 || station.compareTo( "reunion" ) == 0 || 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 = "2015";
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 = "2015";
221                //year="2006";
222            }
223
224            String[] labelPlots = new String[plotsList.size()];
225
226            for (Integer i=0 ; i<plotsList.size() ; i++) {
227                labelPlots[i]=plotsList.get( i ).substring(5,9)+"/"+plotsList.get( i ).substring(9,11)+"/"+plotsList.get( i ).substring(11,13);
228            }
229
230            final Map<String, Object> model = new HashMap<String, Object>();
231            model.put( "plotsList", plotsList );
232            model.put( "listeDates", listeDates );
233            model.put( "firstDate", dateinf );
234            model.put( "labelPlots", labelPlots );
235            final String month = dateinf.substring( 4, 6 );
236            model.put( "month", month );
237            model.put( "year", year );
238            model.put( "station", station );
239            model.put( "rep", rep );
240            return model;
241        }
242        catch( ServiceException e )
243        {
244            throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e );
245        }
246    }
247
248    @ControllerMethod(view = VIEW_ECC_RT)
249        public Map<String, Object> selectEccRT( @ParamName("dateinf") String dateinf,
250                                              @ParamName("station") String station,
251                                              @ParamName("instrument") final String instrument,
252                                              @ParamName("type") final String type )
253                throws WebException
254        {
255            try
256            {
257
258                String rep = "";
259                String year = dateinf.substring( 0, 4 );
260                String month = dateinf.substring( 4, 6 );
261
262                if( station.compareTo( "OHP" ) == 0 || station.compareTo( "ohp" ) == 0 )
263                {
264                    rep = "./resources/visu/ohp/ecc";
265                    station = "OHP";
266                    if( year.compareTo( "1970" ) == 0 ) {
267                           //year = "2013";
268                           year = "2016";
269
270                           month = DateHelper.formatDate(new Date(),"MM");
271                           //month = "05";
272
273                    }
274                }
275                else if( station.compareTo( "LA REUNION" ) == 0 || station.compareTo( "reunion" ) == 0 )
276                {
277                    rep = "./resources/visu/reu/ecc";
278                    //rep="./resources/visu/ohp/lidar/o3_strato";
279                    station = "LA REUNION";
280                    if( year.compareTo( "1970" ) == 0 ) year = "2006";
281                    //year="2006";
282                }
283                else if( station.compareTo( "DDU" ) == 0 || station.compareTo( "ddu" ) == 0 )
284                {
285                    rep = "./resources/visu/ddu/ecc";
286                    //rep="./resources/visu/ohp/lidar/o3_strato";
287                    station = "DDU";
288                    if( year.compareTo( "1970" ) == 0 ) year = "1991";
289                    //year="2006";
290                }
291
292
293                dateinf=year+month+"01";
294                final List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStationByType( instrument, dateinf, "yyyyMMdd", station, type );
295                String[] labelPlots = new String[plotsList.size()];
296
297                for (Integer i=0 ; i<plotsList.size() ; i++) {
298                        //temp=
299                        labelPlots[i]=plotsList.get( i ).substring(5,9)+"/"+plotsList.get( i ).substring(9,11)+"/"+plotsList.get( i ).substring(11,13);
300                }
301
302                //dateinf="02021980";
303                //List<String> ListDates = _plotService.getLastDate(instrument);
304                final List<String> listeDates = _serviceTools.getListeDates();
305                final Map<String, Object> model = new HashMap<String, Object>();
306
307                model.put( "plotsList", plotsList );
308                model.put( "listeDates", listeDates );
309                model.put( "firstDate", dateinf );
310                model.put( "labelPlots", labelPlots );
311
312                model.put( "month", month );
313                model.put( "year", year );
314                model.put( "station", station );
315
316               // model.put( "dateinf", dateinf );
317                model.put( "rep", rep );
318                return model;
319
320            }
321            catch( ServiceException e )
322            {
323                throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e );
324            }
325        }
326
327    public ModelAndView viewLidarO3s( final HttpServletRequest request, final HttpServletResponse response )
328            throws WebException
329    {
330        try
331        {
332            final List<String> listeDates = _serviceTools.getListeDates();
333
334            final ModelAndView modelAndView = new ModelAndView( VIEW_LIDAR_O3S );
335            modelAndView.addObject( "listeDates", listeDates );
336
337            return modelAndView;
338
339        }
340        catch( ServiceException e )
341        {
342            throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e );
343        }
344    }
345
346     @ControllerMethod(view = VIEW_LIDAR_O3S)
347     public Map<String, Object> selectLidarO3s( @ParamName("dateinf") final String dateinf,
348                                          @ParamName("station") String station,
349                                          @ParamName("instrument") final String instrument )
350            throws WebException
351
352     /*public ModelAndView selectLidarO3s( final HttpServletRequest request, final HttpServletResponse response )
353            throws WebException*/
354    {
355        try
356        {
357            /*String dateinf = request.getParameter( "dateinf" );
358            String station = request.getParameter( "station" );
359
360            final String instrument = request.getParameter( "instrument" );*/
361
362            List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStation( instrument, dateinf, "yyyyMMdd", station );
363
364            //dateinf="02021980";
365            //List<String> ListDates = _plotService.getLastDate(instrument);
366            final List<String> listeDates = _serviceTools.getListeDates();
367            String rep = "";
368            String year = dateinf.substring( 0, 4 );
369            String month = dateinf.substring( 4, 6 );
370
371            if( station.compareTo( "OHP" ) == 0 || station.compareTo( "ohp" ) == 0 )
372            {
373                rep = "./resources/visu/ohp/lidar/o3_strato";
374                station = "OHP";
375                if( year.compareTo( "1970" ) == 0 )
376                {
377
378                    year = "2014";
379                }
380            }
381            else if( station.compareTo( "REU" ) == 0 || station.compareTo( "reu" ) == 0 || station.compareTo( "LA REUNION" ) == 0 || station.compareTo( "REUNION" ) == 0 )
382            {
383                rep = "./resources/visu/reu/lidar/o3_strato";
384                station = "LA REUNION";
385                if( year.compareTo( "1970" ) == 0 ) year = "2006";
386                //year="2006";
387            }
388
389            else
390            {
391                rep = "./resources/visu/ddu/lidar/o3_strato";
392                station = "DDU";
393                if( year.compareTo( "1970" ) == 0 )
394                {
395                    year = "2010";
396                    //month="04";
397                }
398                //year="2006";
399            }
400
401            final Map<String, Object> modelAndView = new HashMap<String, Object>();
402            //plotsList=null;
403            modelAndView.put( "plotsList", plotsList );
404
405            modelAndView.put( "listeDates", listeDates );
406            modelAndView.put( "firstDate", dateinf );
407
408
409            modelAndView.put( "month", month );
410            modelAndView.put( "year", year );
411            modelAndView.put( "station", station );
412            modelAndView.put( "rep", rep );
413
414            return modelAndView;
415
416        }
417        catch( ServiceException e )
418        {
419            throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e );
420        }
421    }
422
423    @ControllerMethod(view = VIEW_LIDAR_O3T)
424    public Map<String, Object> selectLidarO3t( @ParamName("dateinf") String dateinf,
425                                          @ParamName("station") String station,
426                                          @ParamName("instrument") final String instrument )
427            throws WebException
428    {
429        try
430        {
431
432            List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStation( instrument, dateinf, "yyyyMMdd", station );
433
434            //dateinf="02021980";
435            //List<String> ListDates = _plotService.getLastDate(instrument);
436            final List<String> listeDates = _serviceTools.getListeDates();
437            String rep = "";
438            String year = dateinf.substring( 0, 4 );
439            String month = dateinf.substring( 4, 6 );
440
441            if( station.compareTo( "OHP" ) == 0 || station.compareTo( "ohp" ) == 0 )
442            {
443                rep = "./resources/visu/ohp/lidar/o3_tropo";
444                station = "OHP";
445                if( year.compareTo( "1970" ) == 0 )
446                {
447                    year = "2014";
448                    month = "01";
449                    dateinf = year + month + "01";
450                }
451            }
452            //else if (station.compareTo("reunion")==0) {
453            else
454            {
455                rep = "./resources/visu/reu/lidar/o3_tropo";
456                //rep="./resources/visu/ohp/lidar/o3_strato";
457                station = "LA REUNION";
458                if( year.compareTo( "1970" ) == 0 )
459                {
460                    year = "2006";
461
462                }
463                //year="2006";
464            }
465
466            final Map<String, Object> mView = new HashMap<String, Object>();
467            //plotsList=null;
468            mView.put( "plotsList", plotsList );
469
470            mView.put( "listeDates", listeDates );
471            mView.put( "firstDate", dateinf );
472
473            //String month = dateinf.substring(4,6);
474            mView.put( "month", month );
475            mView.put( "year", year );
476            mView.put( "station", station );
477            mView.put( "rep", rep );
478
479            return mView;
480
481        }
482        catch( ServiceException e )
483        {
484            throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e );
485        }
486    }
487
488    @ControllerMethod(view = VIEW_UMK)
489    public Map<String, Object> selectUmk( @ParamName("dateinf") String dateinf,
490                                          @ParamName("station") String station,
491                                          @ParamName("instrument") final String instrument )
492            throws WebException
493    {
494        try
495        {
496            //dateinf="02021980";
497            //List<String> ListDates = _plotService.getLastDate(instrument);
498            String rep = "";
499            String year = dateinf.substring( 0, 4 );
500            String month = dateinf.substring( 4, 6 );
501
502            rep = "./resources/visu/ohp/umk";
503            station = "OHP";
504            if( year.compareTo( "1970" ) == 0 )
505            {
506                year = "1983";
507                month = "09";
508                dateinf = year + month + "03";
509            }
510
511//            dateinf="20120101";
512            dateinf=year+month+"01";
513            List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStation( instrument, dateinf, "yyyyMMdd", station );
514            final List<String> listeDates = _serviceTools.getListeDates();
515
516            final Map<String, Object> model = new HashMap<String, Object>();
517
518            model.put( "plotsList", plotsList );
519
520
521
522            final Map<String, Object> mView = new HashMap<String, Object>();
523            //plotsList=null;
524            mView.put( "plotsList", plotsList );
525
526            mView.put( "listeDates", listeDates );
527            mView.put( "firstDate", dateinf );
528
529            //String month = dateinf.substring(4,6);
530            mView.put( "month", month );
531            mView.put( "year", year );
532            mView.put( "station", station );
533            mView.put( "rep", rep );
534
535
536
537            return mView;
538
539        }
540        catch( ServiceException e )
541        {
542            throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e );
543        }
544    }
545
546    @ControllerMethod(view = VIEW_LIDAR_TEMP)
547    public Map<String, Object> selectLidarTemp( @ParamName("dateinf") String dateinf,
548                                          @ParamName("station") String station,
549                                          @ParamName("instrument") final String instrument )
550            throws WebException
551    {
552        try
553        {
554
555            List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStation( instrument, dateinf, "yyyyMMdd", station );
556
557            //dateinf="02021980";
558            //List<String> ListDates = _plotService.getLastDate(instrument);
559            final List<String> listeDates = _serviceTools.getListeDates();
560            String rep = "";
561            String year = dateinf.substring( 0, 4 );
562            String month = dateinf.substring( 4, 6 );
563
564            if( station.compareTo( "OHP" ) == 0 || station.compareTo( "ohp" ) == 0 )
565            {
566                rep = "./resources/visu/ohp/lidar/temp";
567                station = "OHP";
568                if( year.compareTo( "1970" ) == 0 )
569                {
570                    year = "2013";
571                    month = "01";
572                }
573            }
574
575            if( station.compareTo( "REU" ) == 0 || station.compareTo( "reu" ) == 0 )
576            {
577                rep = "./resources/visu/reu/lidar/temp";
578                station = "REU";
579                if( year.compareTo( "1970" ) == 0 )
580                {
581                    year = "1994";
582                    month = "05";
583                }
584            }
585
586            final Map<String, Object> mView = new HashMap<String, Object>();
587
588            mView.put( "plotsList", plotsList );
589
590            mView.put( "listeDates", listeDates );
591            mView.put( "firstDate", dateinf );
592
593
594            mView.put( "month", month );
595            mView.put( "year", year );
596            mView.put( "station", station );
597            mView.put( "rep", rep );
598
599            return mView;
600
601        }
602        catch( ServiceException e )
603        {
604            throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e );
605        }
606    }
607
608    @ControllerMethod(view = VIEW_LIDAR_AEROSOLS)
609    public Map<String, Object> selectLidarAerosols( @ParamName("dateinf") String dateinf,
610                                          @ParamName("station") String station,
611                                          @ParamName("instrument") final String instrument )
612            throws WebException
613    {
614        try
615        {
616
617            List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStation( instrument, dateinf, "yyyyMMdd", station );
618            //List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStation( instrument, dateinf, "yyyyMMdd", station );
619
620            //dateinf="02021980";
621            //List<String> ListDates = _plotService.getLastDate(instrument);
622            final List<String> listeDates = _serviceTools.getListeDates();
623            String rep = "";
624            String year = dateinf.substring( 0, 4 );
625            String month = dateinf.substring( 4, 6 );
626
627            if( station.compareTo( "OHP" ) == 0 || station.compareTo( "ohp" ) == 0 )
628            {
629                rep = "./resources/visu/ohp/lidar/aerosols";
630                station = "OHP";
631                if( year.compareTo( "1970" ) == 0 )
632                {
633                    year = "2013";
634                    month = "01";
635                }
636            }
637
638            if( station.compareTo( "DDU" ) == 0 || station.compareTo( "ddu" ) == 0 )
639            {
640                rep = "./resources/visu/ddu/lidar/aerosols";
641                station = "DDU";
642                if( year.compareTo( "1970" ) == 0 )
643                {
644                    year = "2014";
645                    month = "09";
646                }
647            }
648
649            final Map<String, Object> mView = new HashMap<String, Object>();
650            //plotsList=null;
651            mView.put( "plotsList", plotsList );
652
653            mView.put( "listeDates", listeDates );
654            mView.put( "firstDate", dateinf );
655
656            //String month = dateinf.substring(4,6);
657            mView.put( "month", month );
658            mView.put( "year", year );
659            mView.put( "station", station );
660            mView.put( "rep", rep );
661
662            return mView;
663
664        }
665        catch( ServiceException e )
666        {
667            throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e );
668        }
669    }
670
671    @ControllerMethod(view =VIEW_SPECTRO_UV)
672    public Map<String, Object> viewSpectroUV(  @ParamName("dateinf") String dateinf,
673                                          @ParamName("especes") String especes,
674                                          @ParamName("instrument") final String instrument
675    )
676            throws WebException
677    {
678        try
679        {
680
681            String m[];
682            m = new String[12];
683            String fname, iname, year;
684
685            if( especes.equals( "nan" ) )
686            {
687                especes = "uvauvb";
688            }
689
690            if( dateinf.equals( "nan" ) )
691            {
692                year = "2008";
693                dateinf = "2008";
694
695            }
696
697            List<String> plotsList = _plotService.getPlotsByDateByInstrument( instrument, dateinf, "yyyy" );
698            final List<String> listeDates = _serviceTools.getListeDates();
699
700            final Map<String, Object> mView = new HashMap<String, Object>();
701
702            mView.put( "plotsList", plotsList );
703
704            mView.put(  "listeDates", listeDates );
705            mView.put(  "firstDate", dateinf );
706            mView.put(  "especes", especes );
707            year = dateinf.substring( 0, 4 );
708
709            mView.put(  "year", year );
710            mView.put(  "m", m );
711
712            fname = "vasp_";
713            fname = fname.concat( especes );
714            fname = fname.concat( "_" );
715            fname = fname.concat( year );
716
717            iname = fname.concat( "01_plot1.jpg" );
718            if( plotsList.contains( iname ) ) m[0] = iname;
719            else m[0] = "no";
720
721            iname = fname.concat( "02_plot1.jpg" );
722            if( plotsList.contains( iname ) ) m[1] = iname;
723            else m[1] = "no";
724
725            iname = fname.concat( "03_plot1.jpg" );
726            if( plotsList.contains( iname ) ) m[2] = iname;
727            else m[2] = "no";
728
729            iname = fname.concat( "04_plot1.jpg" );
730            if( plotsList.contains( iname ) ) m[3] = iname;
731            else m[3] = "no";
732
733            iname = fname.concat( "05_plot1.jpg" );
734            if( plotsList.contains( iname ) ) m[4] = iname;
735            else m[4] = "no";
736
737            iname = fname.concat( "06_plot1.jpg" );
738            if( plotsList.contains( iname ) ) m[5] = iname;
739            else m[5] = "no";
740
741            iname = fname.concat( "07_plot1.jpg" );
742            if( plotsList.contains( iname ) ) m[6] = iname;
743            else m[6] = "no";
744
745            iname = fname.concat( "08_plot1.jpg" );
746            if( plotsList.contains( iname ) ) m[7] = iname;
747            else m[7] = "no";
748
749            iname = fname.concat( "09_plot1.jpg" );
750            if( plotsList.contains( iname ) ) m[8] = iname;
751            else m[8] = "no";
752
753            iname = fname.concat( "10_plot1.jpg" );
754            if( plotsList.contains( iname ) ) m[9] = iname;
755            else m[9] = "no";
756
757            iname = fname.concat( "11_plot1.jpg" );
758            if( plotsList.contains( iname ) ) m[10] = iname;
759            else m[10] = "no";
760
761            iname = fname.concat( "12_plot1.jpg" );
762            if( plotsList.contains( iname ) ) m[11] = iname;
763            else m[11] = "no";
764
765            return mView;
766
767        }
768        catch( ServiceException e )
769        {
770            throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e );
771        }
772    }
773
774
775    public ModelAndView viewInstruments( final HttpServletRequest request, final HttpServletResponse response )
776            throws WebException
777    {
778        try
779        {
780            final List<Instrument> instruments = _instrumentService.getAllInstruments();
781
782            final ModelAndView modelAndView = new ModelAndView( VIEW_INSTRUMENT );
783            modelAndView.addObject( "instruments", instruments );
784            return modelAndView;
785
786        }
787        catch( ServiceException e )
788        {
789            throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e );
790        }
791    }
792
793    public ModelAndView viewStation( final HttpServletRequest request, final HttpServletResponse response )
794            throws WebException
795    {
796        try
797        {
798            final Long stationId = Long.valueOf( request.getParameter( "stationId" ) );
799            final Station station = _stationService.getStationById( stationId );
800
801            final ModelAndView modelAndView = new ModelAndView( VIEW_STATION );
802            modelAndView.addObject( "station", station );
803            return modelAndView;
804
805        }
806        catch( ServiceException e )
807        {
808            throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e );
809        }
810    }
811
812    @Required
813    public void setStationService( final StationService stationService )
814    {
815        _stationService = stationService;
816    }
817
818    @Required
819    public void setInstrumentService( final InstrumentService instrumentService )
820    {
821        _instrumentService = instrumentService;
822    }
823
824    @Required
825    public void setServiceTools( final ServiceTools serviceTools )
826    {
827        _serviceTools = serviceTools;
828    }
829
830    @Required
831    public void setPlotService( final PlotService plotService )
832    {
833        _plotService = plotService;
834    }
835
836    private static final Log LOGGER = LogFactory.getLog( Controller.class );
837
838    private static final String VIEW_INIT = "init";
839
840    private static final String VIEW_INSTRUMENT = "instrument";
841    private static final String VIEW_STATION = "station";
842    private static final String VIEW_LIDAR_O3S = "visus_lidar_o3s";
843    private static final String VIEW_LIDAR_O3T = "visus_lidar_o3t";
844    private static final String VIEW_UMK = "visus_umk";
845    private static final String VIEW_ECC = "visus_ecc";
846    private static final String VIEW_ECC_RT = "visus_ecc_realtime";
847    private static final String VIEW_SPECTRO_UV = "visus_spectro";
848    private static final String VIEW_LIDAR_TEMP = "visus_lidar_temp";
849    private static final String VIEW_LIDAR_AEROSOLS = "visus_lidar_aerosols";
850    private static final String VIEW_DATA_OHP = "data_ohp";
851    private static final String VIEW_ABOUT = "about";
852    private static final String VIEW_DATA_OPAR = "data_opar";
853    private static final String VIEW_DATA_DDU = "data_ddu";
854    private static final String VIEW_DATA_OMP = "data_lannemezan";
855    private static final String VIEW_DATA_VDA = "data_villeneuve";
856    private static final String VIEW_DATA_BRI = "data_briancon";
857    private static final String VIEW_DATA_SCO = "data_scorebysund";
858    private static final String VIEW_DATA_AND = "data_andoya";
859    private static final String VIEW_DATA_SOD = "data_sodankyla";
860    private static final String VIEW_DATA_ZHI = "data_zhigansk";
861    private static final String VIEW_DATA_SAL = "data_salekhard";
862    private static final String VIEW_DATA_BOR = "data_bordeaux";
863    private static final String VIEW_DATA_TAR = "data_tarawa";
864    private static final String VIEW_DATA_BAU = "data_bauru";
865    private static final String VIEW_DATA_KER = "data_kerguelen";
866    private static final String VIEW_DATA_RIO = "data_riogallegos";
867    private static final String VIEW_DATA_CON = "data_concordia";
868    private static final String VIEW_BIBLIO = "biblio";
869    private static final String VIEW_INTRA = "community";
870
871
872    //services que le controller peut utiliser
873    private StationService _stationService;
874    private InstrumentService _instrumentService;
875    private ServiceTools _serviceTools;
876    private PlotService _plotService;
877}
Note: See TracBrowser for help on using the repository browser.