[113] | 1 | package com.ether; |
---|
| 2 | |
---|
[204] | 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; |
---|
[113] | 11 | |
---|
| 12 | import javax.servlet.http.HttpServletRequest; |
---|
| 13 | import javax.servlet.http.HttpServletResponse; |
---|
[434] | 14 | import java.util.ArrayList; |
---|
[432] | 15 | import java.util.Date; |
---|
[204] | 16 | import java.util.HashMap; |
---|
| 17 | import java.util.List; |
---|
| 18 | import java.util.Map; |
---|
[113] | 19 | |
---|
| 20 | /** |
---|
| 21 | * @author vmipsl |
---|
[204] | 22 | * @date 17 feb 2011 |
---|
[113] | 23 | */ |
---|
[204] | 24 | public class Controller |
---|
| 25 | extends ControllerEther |
---|
[113] | 26 | { |
---|
[204] | 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 |
---|
[113] | 40 | { |
---|
[204] | 41 | return new HashMap<String, Object>(); |
---|
[113] | 42 | } |
---|
| 43 | |
---|
[204] | 44 | @ControllerMethod(view = VIEW_DATA_OHP) |
---|
| 45 | public Map<String, Object> viewDataOhp() |
---|
| 46 | throws WebException |
---|
[113] | 47 | { |
---|
[204] | 48 | return new HashMap<String, Object>(); |
---|
| 49 | } |
---|
[183] | 50 | |
---|
[364] | 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 | |
---|
[232] | 178 | @ControllerMethod(view = VIEW_ABOUT) |
---|
| 179 | public Map<String, Object> viewAbout() |
---|
| 180 | throws WebException |
---|
| 181 | { |
---|
| 182 | return new HashMap<String, Object>(); |
---|
| 183 | } |
---|
[183] | 184 | |
---|
[204] | 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 ); |
---|
[183] | 194 | |
---|
[204] | 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 ); |
---|
[183] | 200 | |
---|
[204] | 201 | if( station.compareTo( "OHP" ) == 0 || station.compareTo( "ohp" ) == 0 ) |
---|
| 202 | { |
---|
| 203 | rep = "./resources/visu/ohp/ecc"; |
---|
| 204 | station = "OHP"; |
---|
[823] | 205 | if( year.compareTo( "1970" ) == 0 ) year = "2014"; |
---|
[204] | 206 | } |
---|
[770] | 207 | else if( station.compareTo( "REU" ) == 0 || station.compareTo( "reu" ) == 0 || station.compareTo( "reunion" ) == 0 || station.compareTo( "LA REUNION" ) == 0 || station.compareTo( "REUNION" ) == 0 ) |
---|
[204] | 208 | { |
---|
| 209 | rep = "./resources/visu/reu/ecc"; |
---|
| 210 | //rep="./resources/visu/ohp/lidar/o3_strato"; |
---|
| 211 | station = "LA REUNION"; |
---|
[839] | 212 | if( year.compareTo( "1970" ) == 0 ) year = "2015"; |
---|
[204] | 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"; |
---|
[823] | 220 | if( year.compareTo( "1970" ) == 0 ) year = "2015"; |
---|
[204] | 221 | //year="2006"; |
---|
| 222 | } |
---|
[183] | 223 | |
---|
[518] | 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 | |
---|
[204] | 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 ); |
---|
[518] | 234 | model.put( "labelPlots", labelPlots ); |
---|
[204] | 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 | } |
---|
[183] | 247 | |
---|
[405] | 248 | @ControllerMethod(view = VIEW_ECC_RT) |
---|
[429] | 249 | public Map<String, Object> selectEccRT( @ParamName("dateinf") String dateinf, |
---|
[405] | 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 ); |
---|
[432] | 260 | String month = dateinf.substring( 4, 6 ); |
---|
[405] | 261 | |
---|
| 262 | if( station.compareTo( "OHP" ) == 0 || station.compareTo( "ohp" ) == 0 ) |
---|
| 263 | { |
---|
| 264 | rep = "./resources/visu/ohp/ecc"; |
---|
| 265 | station = "OHP"; |
---|
[429] | 266 | if( year.compareTo( "1970" ) == 0 ) { |
---|
[792] | 267 | //year = "2013"; |
---|
| 268 | year = "2014"; |
---|
[432] | 269 | |
---|
[770] | 270 | month = DateHelper.formatDate(new Date(),"MM"); |
---|
| 271 | //month = "05"; |
---|
| 272 | |
---|
[429] | 273 | } |
---|
[405] | 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 | |
---|
[429] | 292 | |
---|
| 293 | dateinf=year+month+"01"; |
---|
| 294 | final List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStationByType( instrument, dateinf, "yyyyMMdd", station, type ); |
---|
[434] | 295 | String[] labelPlots = new String[plotsList.size()]; |
---|
[429] | 296 | |
---|
[434] | 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); |
---|
[432] | 300 | } |
---|
[429] | 301 | |
---|
| 302 | //dateinf="02021980"; |
---|
| 303 | //List<String> ListDates = _plotService.getLastDate(instrument); |
---|
| 304 | final List<String> listeDates = _serviceTools.getListeDates(); |
---|
[405] | 305 | final Map<String, Object> model = new HashMap<String, Object>(); |
---|
[429] | 306 | |
---|
[405] | 307 | model.put( "plotsList", plotsList ); |
---|
| 308 | model.put( "listeDates", listeDates ); |
---|
| 309 | model.put( "firstDate", dateinf ); |
---|
[434] | 310 | model.put( "labelPlots", labelPlots ); |
---|
[429] | 311 | |
---|
[405] | 312 | model.put( "month", month ); |
---|
| 313 | model.put( "year", year ); |
---|
| 314 | model.put( "station", station ); |
---|
[429] | 315 | |
---|
| 316 | // model.put( "dateinf", dateinf ); |
---|
[405] | 317 | model.put( "rep", rep ); |
---|
| 318 | return model; |
---|
[429] | 319 | |
---|
[405] | 320 | } |
---|
| 321 | catch( ServiceException e ) |
---|
| 322 | { |
---|
| 323 | throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); |
---|
| 324 | } |
---|
| 325 | } |
---|
| 326 | |
---|
[204] | 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 | } |
---|
[183] | 344 | } |
---|
| 345 | |
---|
[364] | 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 ) |
---|
[204] | 350 | throws WebException |
---|
[364] | 351 | |
---|
| 352 | /*public ModelAndView selectLidarO3s( final HttpServletRequest request, final HttpServletResponse response ) |
---|
| 353 | throws WebException*/ |
---|
[204] | 354 | { |
---|
| 355 | try |
---|
| 356 | { |
---|
[364] | 357 | /*String dateinf = request.getParameter( "dateinf" ); |
---|
[204] | 358 | String station = request.getParameter( "station" ); |
---|
[183] | 359 | |
---|
[364] | 360 | final String instrument = request.getParameter( "instrument" );*/ |
---|
[204] | 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 | |
---|
[799] | 378 | year = "2014"; |
---|
[204] | 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"; |
---|
[518] | 392 | station = "DDU"; |
---|
[204] | 393 | if( year.compareTo( "1970" ) == 0 ) |
---|
| 394 | { |
---|
[770] | 395 | year = "2010"; |
---|
[204] | 396 | //month="04"; |
---|
| 397 | } |
---|
| 398 | //year="2006"; |
---|
| 399 | } |
---|
| 400 | |
---|
[364] | 401 | final Map<String, Object> modelAndView = new HashMap<String, Object>(); |
---|
[204] | 402 | //plotsList=null; |
---|
[364] | 403 | modelAndView.put( "plotsList", plotsList ); |
---|
[204] | 404 | |
---|
[364] | 405 | modelAndView.put( "listeDates", listeDates ); |
---|
| 406 | modelAndView.put( "firstDate", dateinf ); |
---|
[204] | 407 | |
---|
| 408 | |
---|
[364] | 409 | modelAndView.put( "month", month ); |
---|
| 410 | modelAndView.put( "year", year ); |
---|
| 411 | modelAndView.put( "station", station ); |
---|
| 412 | modelAndView.put( "rep", rep ); |
---|
[204] | 413 | |
---|
| 414 | return modelAndView; |
---|
| 415 | |
---|
| 416 | } |
---|
| 417 | catch( ServiceException e ) |
---|
| 418 | { |
---|
| 419 | throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); |
---|
| 420 | } |
---|
| 421 | } |
---|
| 422 | |
---|
[364] | 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 ) |
---|
[204] | 427 | throws WebException |
---|
[183] | 428 | { |
---|
[204] | 429 | try |
---|
| 430 | { |
---|
[113] | 431 | |
---|
[204] | 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 | { |
---|
[770] | 447 | year = "2012"; |
---|
| 448 | month = "01"; |
---|
[204] | 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 | |
---|
[364] | 466 | final Map<String, Object> mView = new HashMap<String, Object>(); |
---|
| 467 | //plotsList=null; |
---|
| 468 | mView.put( "plotsList", plotsList ); |
---|
[204] | 469 | |
---|
[364] | 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 | |
---|
[429] | 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(); |
---|
[364] | 515 | |
---|
[429] | 516 | final Map<String, Object> model = new HashMap<String, Object>(); |
---|
| 517 | |
---|
| 518 | model.put( "plotsList", plotsList ); |
---|
| 519 | |
---|
| 520 | |
---|
| 521 | |
---|
[364] | 522 | final Map<String, Object> mView = new HashMap<String, Object>(); |
---|
[204] | 523 | //plotsList=null; |
---|
[364] | 524 | mView.put( "plotsList", plotsList ); |
---|
[204] | 525 | |
---|
[364] | 526 | mView.put( "listeDates", listeDates ); |
---|
| 527 | mView.put( "firstDate", dateinf ); |
---|
[204] | 528 | |
---|
| 529 | //String month = dateinf.substring(4,6); |
---|
[364] | 530 | mView.put( "month", month ); |
---|
| 531 | mView.put( "year", year ); |
---|
| 532 | mView.put( "station", station ); |
---|
| 533 | mView.put( "rep", rep ); |
---|
[204] | 534 | |
---|
[429] | 535 | |
---|
| 536 | |
---|
[364] | 537 | return mView; |
---|
[204] | 538 | |
---|
| 539 | } |
---|
| 540 | catch( ServiceException e ) |
---|
| 541 | { |
---|
| 542 | throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); |
---|
| 543 | } |
---|
[113] | 544 | } |
---|
| 545 | |
---|
[364] | 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 ) |
---|
[204] | 550 | throws WebException |
---|
| 551 | { |
---|
| 552 | try |
---|
| 553 | { |
---|
[113] | 554 | |
---|
[204] | 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 | { |
---|
[770] | 570 | year = "2013"; |
---|
[204] | 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 | |
---|
[364] | 586 | final Map<String, Object> mView = new HashMap<String, Object>(); |
---|
[204] | 587 | |
---|
[364] | 588 | mView.put( "plotsList", plotsList ); |
---|
[204] | 589 | |
---|
[364] | 590 | mView.put( "listeDates", listeDates ); |
---|
| 591 | mView.put( "firstDate", dateinf ); |
---|
[204] | 592 | |
---|
| 593 | |
---|
[364] | 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 | |
---|
[204] | 601 | } |
---|
| 602 | catch( ServiceException e ) |
---|
| 603 | { |
---|
| 604 | throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); |
---|
| 605 | } |
---|
| 606 | } |
---|
| 607 | |
---|
[364] | 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 ) |
---|
[204] | 612 | throws WebException |
---|
[113] | 613 | { |
---|
[204] | 614 | try |
---|
| 615 | { |
---|
[113] | 616 | |
---|
[204] | 617 | List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStation( instrument, dateinf, "yyyyMMdd", station ); |
---|
[432] | 618 | //List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStation( instrument, dateinf, "yyyyMMdd", station ); |
---|
[204] | 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 = "2009"; |
---|
| 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 | { |
---|
[799] | 644 | year = "2014"; |
---|
| 645 | month = "09"; |
---|
[204] | 646 | } |
---|
| 647 | } |
---|
| 648 | |
---|
[364] | 649 | final Map<String, Object> mView = new HashMap<String, Object>(); |
---|
[204] | 650 | //plotsList=null; |
---|
[364] | 651 | mView.put( "plotsList", plotsList ); |
---|
[204] | 652 | |
---|
[364] | 653 | mView.put( "listeDates", listeDates ); |
---|
| 654 | mView.put( "firstDate", dateinf ); |
---|
[204] | 655 | |
---|
| 656 | //String month = dateinf.substring(4,6); |
---|
[364] | 657 | mView.put( "month", month ); |
---|
| 658 | mView.put( "year", year ); |
---|
| 659 | mView.put( "station", station ); |
---|
| 660 | mView.put( "rep", rep ); |
---|
[204] | 661 | |
---|
[364] | 662 | return mView; |
---|
[204] | 663 | |
---|
| 664 | } |
---|
| 665 | catch( ServiceException e ) |
---|
| 666 | { |
---|
| 667 | throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); |
---|
| 668 | } |
---|
[113] | 669 | } |
---|
| 670 | |
---|
[364] | 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 | ) |
---|
[204] | 676 | throws WebException |
---|
| 677 | { |
---|
| 678 | try |
---|
| 679 | { |
---|
[113] | 680 | |
---|
[204] | 681 | String m[]; |
---|
| 682 | m = new String[12]; |
---|
| 683 | String fname, iname, year; |
---|
[113] | 684 | |
---|
[204] | 685 | if( especes.equals( "nan" ) ) |
---|
| 686 | { |
---|
| 687 | especes = "uvauvb"; |
---|
| 688 | } |
---|
[113] | 689 | |
---|
[204] | 690 | if( dateinf.equals( "nan" ) ) |
---|
| 691 | { |
---|
| 692 | year = "2008"; |
---|
| 693 | dateinf = "2008"; |
---|
[113] | 694 | |
---|
[204] | 695 | } |
---|
[113] | 696 | |
---|
[204] | 697 | List<String> plotsList = _plotService.getPlotsByDateByInstrument( instrument, dateinf, "yyyy" ); |
---|
| 698 | final List<String> listeDates = _serviceTools.getListeDates(); |
---|
[113] | 699 | |
---|
[364] | 700 | final Map<String, Object> mView = new HashMap<String, Object>(); |
---|
[113] | 701 | |
---|
[364] | 702 | mView.put( "plotsList", plotsList ); |
---|
| 703 | |
---|
| 704 | mView.put( "listeDates", listeDates ); |
---|
| 705 | mView.put( "firstDate", dateinf ); |
---|
| 706 | mView.put( "especes", especes ); |
---|
[204] | 707 | year = dateinf.substring( 0, 4 ); |
---|
[113] | 708 | |
---|
[364] | 709 | mView.put( "year", year ); |
---|
| 710 | mView.put( "m", m ); |
---|
[113] | 711 | |
---|
[204] | 712 | fname = "vasp_"; |
---|
| 713 | fname = fname.concat( especes ); |
---|
| 714 | fname = fname.concat( "_" ); |
---|
| 715 | fname = fname.concat( year ); |
---|
[113] | 716 | |
---|
[204] | 717 | iname = fname.concat( "01_plot1.jpg" ); |
---|
| 718 | if( plotsList.contains( iname ) ) m[0] = iname; |
---|
| 719 | else m[0] = "no"; |
---|
[113] | 720 | |
---|
[204] | 721 | iname = fname.concat( "02_plot1.jpg" ); |
---|
| 722 | if( plotsList.contains( iname ) ) m[1] = iname; |
---|
| 723 | else m[1] = "no"; |
---|
[113] | 724 | |
---|
[204] | 725 | iname = fname.concat( "03_plot1.jpg" ); |
---|
| 726 | if( plotsList.contains( iname ) ) m[2] = iname; |
---|
| 727 | else m[2] = "no"; |
---|
[113] | 728 | |
---|
[204] | 729 | iname = fname.concat( "04_plot1.jpg" ); |
---|
| 730 | if( plotsList.contains( iname ) ) m[3] = iname; |
---|
| 731 | else m[3] = "no"; |
---|
[113] | 732 | |
---|
[204] | 733 | iname = fname.concat( "05_plot1.jpg" ); |
---|
| 734 | if( plotsList.contains( iname ) ) m[4] = iname; |
---|
| 735 | else m[4] = "no"; |
---|
[113] | 736 | |
---|
[204] | 737 | iname = fname.concat( "06_plot1.jpg" ); |
---|
| 738 | if( plotsList.contains( iname ) ) m[5] = iname; |
---|
| 739 | else m[5] = "no"; |
---|
[113] | 740 | |
---|
[204] | 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 | |
---|
[364] | 765 | return mView; |
---|
[204] | 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 |
---|
[113] | 777 | { |
---|
[204] | 778 | try |
---|
| 779 | { |
---|
| 780 | final List<Instrument> instruments = _instrumentService.getAllInstruments(); |
---|
[113] | 781 | |
---|
[204] | 782 | final ModelAndView modelAndView = new ModelAndView( VIEW_INSTRUMENT ); |
---|
| 783 | modelAndView.addObject( "instruments", instruments ); |
---|
| 784 | return modelAndView; |
---|
[113] | 785 | |
---|
[204] | 786 | } |
---|
| 787 | catch( ServiceException e ) |
---|
| 788 | { |
---|
| 789 | throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); |
---|
| 790 | } |
---|
[113] | 791 | } |
---|
| 792 | |
---|
[204] | 793 | public ModelAndView viewStation( final HttpServletRequest request, final HttpServletResponse response ) |
---|
| 794 | throws WebException |
---|
[113] | 795 | { |
---|
[204] | 796 | try |
---|
| 797 | { |
---|
| 798 | final Long stationId = Long.valueOf( request.getParameter( "stationId" ) ); |
---|
| 799 | final Station station = _stationService.getStationById( stationId ); |
---|
[113] | 800 | |
---|
[204] | 801 | final ModelAndView modelAndView = new ModelAndView( VIEW_STATION ); |
---|
| 802 | modelAndView.addObject( "station", station ); |
---|
| 803 | return modelAndView; |
---|
[113] | 804 | |
---|
[204] | 805 | } |
---|
| 806 | catch( ServiceException e ) |
---|
| 807 | { |
---|
| 808 | throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); |
---|
| 809 | } |
---|
[113] | 810 | } |
---|
| 811 | |
---|
[204] | 812 | @Required |
---|
| 813 | public void setStationService( final StationService stationService ) |
---|
[113] | 814 | { |
---|
[204] | 815 | _stationService = stationService; |
---|
[113] | 816 | } |
---|
| 817 | |
---|
[204] | 818 | @Required |
---|
| 819 | public void setInstrumentService( final InstrumentService instrumentService ) |
---|
[113] | 820 | { |
---|
[204] | 821 | _instrumentService = instrumentService; |
---|
[113] | 822 | } |
---|
[204] | 823 | |
---|
| 824 | @Required |
---|
| 825 | public void setServiceTools( final ServiceTools serviceTools ) |
---|
[113] | 826 | { |
---|
[204] | 827 | _serviceTools = serviceTools; |
---|
[113] | 828 | } |
---|
[204] | 829 | |
---|
| 830 | @Required |
---|
| 831 | public void setPlotService( final PlotService plotService ) |
---|
[113] | 832 | { |
---|
[204] | 833 | _plotService = plotService; |
---|
[113] | 834 | } |
---|
| 835 | |
---|
[204] | 836 | private static final Log LOGGER = LogFactory.getLog( Controller.class ); |
---|
| 837 | |
---|
| 838 | private static final String VIEW_INIT = "init"; |
---|
| 839 | |
---|
[113] | 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"; |
---|
[364] | 844 | private static final String VIEW_UMK = "visus_umk"; |
---|
[113] | 845 | private static final String VIEW_ECC = "visus_ecc"; |
---|
[405] | 846 | private static final String VIEW_ECC_RT = "visus_ecc_realtime"; |
---|
[113] | 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"; |
---|
[204] | 850 | private static final String VIEW_DATA_OHP = "data_ohp"; |
---|
[232] | 851 | private static final String VIEW_ABOUT = "about"; |
---|
[364] | 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"; |
---|
[113] | 870 | |
---|
[364] | 871 | |
---|
[113] | 872 | //services que le controller peut utiliser |
---|
| 873 | private StationService _stationService; |
---|
| 874 | private InstrumentService _instrumentService; |
---|
| 875 | private ServiceTools _serviceTools; |
---|
| 876 | private PlotService _plotService; |
---|
| 877 | } |
---|