Changeset 204 for ether_ndacc/trunk/web/src/com/ether/Controller.java
- Timestamp:
- 09/21/11 16:12:07 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ether_ndacc/trunk/web/src/com/ether/Controller.java
r201 r204 1 1 package com.ether; 2 2 3 import java.util.List; 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; 4 11 5 12 import javax.servlet.http.HttpServletRequest; 6 13 import javax.servlet.http.HttpServletResponse; 7 8 import org.springframework.web.servlet.ModelAndView; 9 import org.springframework.web.servlet.mvc.multiaction.MultiActionController; 10 11 import com.ether.instrument.Instrument; 12 import com.ether.station.Station; 14 import java.util.HashMap; 15 import java.util.List; 16 import java.util.Map; 13 17 14 18 /** 15 19 * @author vmipsl 16 * @date 02feb 201120 * @date 17 feb 2011 17 21 */ 18 public class Controller extends MultiActionController 22 public class Controller 23 extends ControllerEther 19 24 { 20 // Default view if methodName is unknown 21 public ModelAndView home(final HttpServletRequest request, final HttpServletResponse response) throws WebException 22 { 23 //okok 24 return new ModelAndView("index"); 25 } 26 27 28 public ModelAndView thisCall(final HttpServletRequest request, final HttpServletResponse response) 29 throws WebException 30 { 31 32 String pageCourante = request.getParameter("target"); 33 34 String pagePref = pageCourante.substring( 1, pageCourante.lastIndexOf('.')); 35 36 37 final ModelAndView modelAndView = new ModelAndView(pagePref); 38 39 return modelAndView; 40 41 } 42 43 44 public ModelAndView viewLidarO3s(final HttpServletRequest request, final HttpServletResponse response) 45 throws WebException 46 { 47 try { 48 final List<String> listeDates = _serviceTools.getListeDates(); 49 50 final ModelAndView modelAndView = new ModelAndView(VIEW_LIDAR_O3S); 51 modelAndView.addObject("listeDates", listeDates); 52 53 return modelAndView; 54 55 } catch (ServiceException e) { 56 throw new WebException(WebException.WebCode.SERVICE_PROBLEM, e); 57 } 58 } 59 60 61 public ModelAndView selectEcc(final HttpServletRequest request, final HttpServletResponse response) 62 throws WebException 63 { 64 try { 65 String dateinf = request.getParameter("dateinf"); 66 String station = request.getParameter("station"); 67 68 final String instrument = request.getParameter("instrument"); 69 70 List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStation(instrument, dateinf,"yyyyMMdd",station); 71 72 //dateinf="02021980"; 73 //List<String> ListDates = _plotService.getLastDate(instrument); 74 final List<String> listeDates = _serviceTools.getListeDates(); 75 String rep=""; 76 String year = dateinf.substring(0, 4); 77 78 if (station.compareTo("OHP")==0 || station.compareTo("ohp")==0 ) { 79 rep="./resources/visu/ohp/ecc"; 80 station="OHP"; 81 if (year.compareTo("1970") == 0) year="2007"; 82 } 83 else if (station.compareTo("LA REUNION")==0 || station.compareTo("reunion")==0 ) { 84 rep="./resources/visu/reu/ecc"; 85 //rep="./resources/visu/ohp/lidar/o3_strato"; 86 station="LA REUNION"; 87 if (year.compareTo("1970") == 0) year="2006"; 88 //year="2006"; 89 } 90 else if (station.compareTo("DDU")==0 || station.compareTo("ddu")==0 ) { 91 rep="./resources/visu/ddu/ecc"; 92 //rep="./resources/visu/ohp/lidar/o3_strato"; 93 station="DDU"; 94 if (year.compareTo("1970") == 0) year="1991"; 95 //year="2006"; 96 } 97 98 99 final ModelAndView modelAndView = new ModelAndView(VIEW_ECC); 100 //plotsList=null; 101 modelAndView.addObject("plotsList", plotsList); 102 103 modelAndView.addObject("listeDates", listeDates); 104 modelAndView.addObject("firstDate", dateinf); 105 106 String month = dateinf.substring(4,6); 107 modelAndView.addObject("month", month); 108 modelAndView.addObject("year", year); 109 modelAndView.addObject("station", station); 110 modelAndView.addObject("rep", rep); 111 112 return modelAndView; 113 114 } catch (ServiceException e) { 115 throw new WebException(WebException.WebCode.SERVICE_PROBLEM, e); 116 } 117 } 118 119 120 public ModelAndView selectLidarO3s(final HttpServletRequest request, final HttpServletResponse response) 121 throws WebException 122 { 123 try { 124 String dateinf = request.getParameter("dateinf"); 125 String station = request.getParameter("station"); 126 127 final String instrument = request.getParameter("instrument"); 128 129 List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStation(instrument, dateinf,"yyyyMMdd",station); 130 131 //dateinf="02021980"; 132 //List<String> ListDates = _plotService.getLastDate(instrument); 133 final List<String> listeDates = _serviceTools.getListeDates(); 134 String rep=""; 135 String year = dateinf.substring(0, 4); 136 String month = dateinf.substring(4,6); 137 138 if (station.compareTo("OHP")==0 || station.compareTo("ohp")==0 ) { 139 rep="./resources/visu/ohp/lidar/o3_strato"; 140 station="OHP"; 141 if (year.compareTo("1970") == 0) { 142 143 year="1991"; 144 } 145 } 146 else if (station.compareTo("REU")==0 || station.compareTo("reu")==0 || station.compareTo("LA REUNION")==0 || station.compareTo("REUNION")==0) { 147 rep="./resources/visu/reu/lidar/o3_strato"; 148 station="LA REUNION"; 149 if (year.compareTo("1970") == 0) year="2006"; 150 //year="2006"; 151 } 152 153 else { 154 rep="./resources/visu/ddu/lidar/o3_strato"; 155 station="DDU"; 156 if (year.compareTo("1970") == 0) { 157 year="1991"; 158 //month="04"; 159 } 160 //year="2006"; 161 } 162 163 final ModelAndView modelAndView = new ModelAndView(VIEW_LIDAR_O3S); 164 //plotsList=null; 165 modelAndView.addObject("plotsList", plotsList); 166 167 modelAndView.addObject("listeDates", listeDates); 168 modelAndView.addObject("firstDate", dateinf); 169 170 171 modelAndView.addObject("month", month); 172 modelAndView.addObject("year", year); 173 modelAndView.addObject("station", station); 174 modelAndView.addObject("rep", rep); 175 176 return modelAndView; 177 178 } catch (ServiceException e) { 179 throw new WebException(WebException.WebCode.SERVICE_PROBLEM, e); 180 } 181 } 182 183 public ModelAndView selectLidarO3t(final HttpServletRequest request, final HttpServletResponse response) 184 throws WebException 185 { 186 try { 187 String dateinf = request.getParameter("dateinf"); 188 String station = request.getParameter("station"); 189 190 final String instrument = request.getParameter("instrument"); 191 192 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 String month = dateinf.substring(4, 6); 200 201 if (station.compareTo("OHP")==0 || station.compareTo("ohp")==0 ) { 202 rep="./resources/visu/ohp/lidar/o3_tropo"; 203 station="OHP"; 204 if (year.compareTo("1970") == 0) { 205 year="2007"; 206 month="05"; 207 dateinf=year+month+"01"; 208 } 209 } 210 //else if (station.compareTo("reunion")==0) { 211 else { 212 rep="./resources/visu/reu/lidar/o3_tropo"; 213 //rep="./resources/visu/ohp/lidar/o3_strato"; 214 station="LA REUNION"; 215 if (year.compareTo("1970") == 0) { 216 year="2006"; 217 218 } 219 //year="2006"; 220 } 221 222 223 final ModelAndView modelAndView = new ModelAndView(VIEW_LIDAR_O3T); 224 //plotsList=null; 225 modelAndView.addObject("plotsList", plotsList); 226 227 modelAndView.addObject("listeDates", listeDates); 228 modelAndView.addObject("firstDate", dateinf); 229 230 //String month = dateinf.substring(4,6); 231 modelAndView.addObject("month", month); 232 modelAndView.addObject("year", year); 233 modelAndView.addObject("station", station); 234 modelAndView.addObject("rep", rep); 235 236 return modelAndView; 237 238 } catch (ServiceException e) { 239 throw new WebException(WebException.WebCode.SERVICE_PROBLEM, e); 240 } 241 } 242 243 public ModelAndView selectLidarTemp(final HttpServletRequest request, final HttpServletResponse response) 244 throws WebException 245 { 246 try { 247 String dateinf = request.getParameter("dateinf"); 248 String station = request.getParameter("station"); 249 250 final String instrument = request.getParameter("instrument"); 251 252 List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStation(instrument, dateinf,"yyyyMMdd",station); 253 254 //dateinf="02021980"; 255 //List<String> ListDates = _plotService.getLastDate(instrument); 256 final List<String> listeDates = _serviceTools.getListeDates(); 257 String rep=""; 258 String year = dateinf.substring(0, 4); 259 String month = dateinf.substring(4, 6); 260 261 if (station.compareTo("OHP")==0 || station.compareTo("ohp")==0 ) { 262 rep="./resources/visu/ohp/lidar/temp"; 263 station="OHP"; 264 if (year.compareTo("1970") == 0) { 265 year="2009"; 266 month="01"; 267 } 268 } 269 270 if (station.compareTo("REU")==0 || station.compareTo("reu")==0 ) { 271 rep="./resources/visu/reu/lidar/temp"; 272 station="REU"; 273 if (year.compareTo("1970") == 0) { 274 year="1994"; 275 month="05"; 276 } 277 } 278 279 final ModelAndView modelAndView = new ModelAndView(VIEW_LIDAR_TEMP); 280 //plotsList=null; 281 modelAndView.addObject("plotsList", plotsList); 282 283 modelAndView.addObject("listeDates", listeDates); 284 modelAndView.addObject("firstDate", dateinf); 285 286 //String month = dateinf.substring(4,6); 287 modelAndView.addObject("month", month); 288 modelAndView.addObject("year", year); 289 modelAndView.addObject("station", station); 290 modelAndView.addObject("rep", rep); 291 292 return modelAndView; 293 294 } catch (ServiceException e) { 295 throw new WebException(WebException.WebCode.SERVICE_PROBLEM, e); 296 } 297 } 298 299 300 public ModelAndView selectLidarAerosols(final HttpServletRequest request, final HttpServletResponse response) 301 throws WebException 302 { 303 try { 304 String dateinf = request.getParameter("dateinf"); 305 String station = request.getParameter("station"); 306 307 final String instrument = request.getParameter("instrument"); 308 309 List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStation(instrument, dateinf,"yyyyMMdd",station); 310 311 //dateinf="02021980"; 312 //List<String> ListDates = _plotService.getLastDate(instrument); 313 final List<String> listeDates = _serviceTools.getListeDates(); 314 String rep=""; 315 String year = dateinf.substring(0, 4); 316 String month = dateinf.substring(4, 6); 317 318 if (station.compareTo("OHP")==0 || station.compareTo("ohp")==0 ) { 319 rep="./resources/visu/ohp/lidar/aerosols"; 320 station="OHP"; 321 if (year.compareTo("1970") == 0) { 322 year="2009"; 323 month="01"; 324 } 325 } 326 327 if (station.compareTo("DDU")==0 || station.compareTo("ddu")==0 ) { 328 rep="./resources/visu/ddu/lidar/aerosols"; 329 station="DDU"; 330 if (year.compareTo("1970") == 0) { 331 year="2010"; 332 month="01"; 333 } 334 } 335 336 final ModelAndView modelAndView = new ModelAndView(VIEW_LIDAR_AEROSOLS); 337 //plotsList=null; 338 modelAndView.addObject("plotsList", plotsList); 339 340 modelAndView.addObject("listeDates", listeDates); 341 modelAndView.addObject("firstDate", dateinf); 342 343 //String month = dateinf.substring(4,6); 344 modelAndView.addObject("month", month); 345 modelAndView.addObject("year", year); 346 modelAndView.addObject("station", station); 347 modelAndView.addObject("rep", rep); 348 349 return modelAndView; 350 351 } catch (ServiceException e) { 352 throw new WebException(WebException.WebCode.SERVICE_PROBLEM, e); 353 } 354 } 355 356 public ModelAndView viewSpectroUV(final HttpServletRequest request, final HttpServletResponse response) throws WebException 357 { 358 try { 359 String dateinf = request.getParameter("dateinf"); 360 //List<String> m = new ArrayList<String>(12); 361 362 String m[]; 363 m = new String[12]; 364 String fname, iname, year; 365 366 final String instrument = request.getParameter("instrument"); 367 String especes = request.getParameter("especes"); 368 369 if (especes.equals("nan")) { 370 especes="uvauvb"; 371 } 372 373 if (dateinf.equals("nan")) { 374 year = "2008"; 375 dateinf="2008"; 376 377 } 378 379 List<String> plotsList = _plotService.getPlotsByDateByInstrument(instrument, dateinf,"yyyy"); 380 final List<String> listeDates = _serviceTools.getListeDates(); 381 382 final ModelAndView modelAndView = new ModelAndView(VIEW_SPECTRO_UV); 383 modelAndView.addObject("plotsList", plotsList); 384 385 modelAndView.addObject("listeDates", listeDates); 386 modelAndView.addObject("firstDate", dateinf); 387 modelAndView.addObject("especes", especes); 388 year = dateinf.substring(0, 4); 389 390 modelAndView.addObject("year", year); 391 modelAndView.addObject("m", m); 392 393 fname="vasp_"; 394 fname=fname.concat(especes); 395 fname=fname.concat("_"); 396 fname=fname.concat(year); 397 398 iname=fname.concat("01_plot1.jpg"); 399 if (plotsList.contains(iname)) m[0]=iname; 400 else m[0]="no"; 401 402 iname=fname.concat("02_plot1.jpg"); 403 if (plotsList.contains(iname)) m[1]=iname; 404 else m[1]="no"; 405 406 iname=fname.concat("03_plot1.jpg"); 407 if (plotsList.contains(iname)) m[2]=iname; 408 else m[2]="no"; 409 410 iname=fname.concat("04_plot1.jpg"); 411 if (plotsList.contains(iname)) m[3]=iname; 412 else m[3]="no"; 413 414 iname=fname.concat("05_plot1.jpg"); 415 if (plotsList.contains(iname)) m[4]=iname; 416 else m[4]="no"; 417 418 iname=fname.concat("06_plot1.jpg"); 419 if (plotsList.contains(iname)) m[5]=iname; 420 else m[5]="no"; 421 422 iname=fname.concat("07_plot1.jpg"); 423 if (plotsList.contains(iname)) m[6]=iname; 424 else m[6]="no"; 425 426 iname=fname.concat("08_plot1.jpg"); 427 if (plotsList.contains(iname)) m[7]=iname; 428 else m[7]="no"; 429 430 iname=fname.concat("09_plot1.jpg"); 431 if (plotsList.contains(iname)) m[8]=iname; 432 else m[8]="no"; 433 434 iname=fname.concat("10_plot1.jpg"); 435 if (plotsList.contains(iname)) m[9]=iname; 436 else m[9]="no"; 437 438 iname=fname.concat("11_plot1.jpg"); 439 if (plotsList.contains(iname)) m[10]=iname; 440 else m[10]="no"; 441 442 iname=fname.concat("12_plot1.jpg"); 443 if (plotsList.contains(iname)) m[11]=iname; 444 else m[11]="no"; 445 446 return modelAndView; 447 448 } catch (ServiceException e) { 449 throw new WebException(WebException.WebCode.SERVICE_PROBLEM, e); 450 } 451 } 452 453 454 455 public ModelAndView viewInstruments(final HttpServletRequest request, final HttpServletResponse response) 456 throws WebException 457 { 458 try { 459 final List<Instrument> instruments = _instrumentService.getAllInstruments(); 460 461 final ModelAndView modelAndView = new ModelAndView(VIEW_INSTRUMENT); 462 modelAndView.addObject("instruments", instruments); 463 return modelAndView; 464 465 } catch (ServiceException e) { 466 throw new WebException(WebException.WebCode.SERVICE_PROBLEM, e); 467 } 468 } 469 470 public ModelAndView viewStation(final HttpServletRequest request, final HttpServletResponse response) throws WebException 471 { 472 try { 473 final Long stationId = Long.valueOf(request.getParameter("stationId")); 474 final Station station = _stationService.getStationById(stationId); 475 476 final ModelAndView modelAndView = new ModelAndView(VIEW_STATION); 477 modelAndView.addObject("station", station); 478 return modelAndView; 479 480 } catch (ServiceException e) { 481 throw new WebException(WebException.WebCode.SERVICE_PROBLEM, e); 482 } 483 } 484 485 public void setStationService(final StationService stationService) 486 { 487 _stationService = stationService; 488 } 489 490 public void setInstrumentService(final InstrumentService instrumentService) 491 { 492 _instrumentService = instrumentService; 493 } 494 495 public void setServiceTools(final ServiceTools serviceTools) 496 { 497 _serviceTools=serviceTools; 498 } 499 500 public void setPlotService(final PlotService plotService) 501 { 502 _plotService=plotService; 503 } 25 /** *********************************************************** **/ 26 /** *********************** VIEWS ***************************** **/ 27 /** *********************************************************** **/ 28 29 /** 30 * Default view if url's methodName is unknown 31 * 32 * @return 33 * @throws WebException 34 */ 35 @ControllerMethod(view = VIEW_INIT) 36 public Map<String, Object> home() 37 throws WebException 38 { 39 return new HashMap<String, Object>(); 40 } 41 42 @ControllerMethod(view = VIEW_DATA_OHP) 43 public Map<String, Object> viewDataOhp() 44 throws WebException 45 { 46 return new HashMap<String, Object>(); 47 } 48 49 50 @ControllerMethod(view = VIEW_ECC) 51 public Map<String, Object> selectEcc( @ParamName("dateinf") final String dateinf, 52 @ParamName("station") String station, 53 @ParamName("instrument") final String instrument ) 54 throws WebException 55 { 56 try 57 { 58 final List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStation( instrument, dateinf, "yyyyMMdd", station ); 59 60 //dateinf="02021980"; 61 //List<String> ListDates = _plotService.getLastDate(instrument); 62 final List<String> listeDates = _serviceTools.getListeDates(); 63 String rep = ""; 64 String year = dateinf.substring( 0, 4 ); 65 66 if( station.compareTo( "OHP" ) == 0 || station.compareTo( "ohp" ) == 0 ) 67 { 68 rep = "./resources/visu/ohp/ecc"; 69 station = "OHP"; 70 if( year.compareTo( "1970" ) == 0 ) year = "2007"; 71 } 72 else if( station.compareTo( "LA REUNION" ) == 0 || station.compareTo( "reunion" ) == 0 ) 73 { 74 rep = "./resources/visu/reu/ecc"; 75 //rep="./resources/visu/ohp/lidar/o3_strato"; 76 station = "LA REUNION"; 77 if( year.compareTo( "1970" ) == 0 ) year = "2006"; 78 //year="2006"; 79 } 80 else if( station.compareTo( "DDU" ) == 0 || station.compareTo( "ddu" ) == 0 ) 81 { 82 rep = "./resources/visu/ddu/ecc"; 83 //rep="./resources/visu/ohp/lidar/o3_strato"; 84 station = "DDU"; 85 if( year.compareTo( "1970" ) == 0 ) year = "1991"; 86 //year="2006"; 87 } 88 89 final Map<String, Object> model = new HashMap<String, Object>(); 90 model.put( "plotsList", plotsList ); 91 model.put( "listeDates", listeDates ); 92 model.put( "firstDate", dateinf ); 93 final String month = dateinf.substring( 4, 6 ); 94 model.put( "month", month ); 95 model.put( "year", year ); 96 model.put( "station", station ); 97 model.put( "rep", rep ); 98 return model; 99 } 100 catch( ServiceException e ) 101 { 102 throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); 103 } 104 } 105 106 public ModelAndView viewLidarO3s( final HttpServletRequest request, final HttpServletResponse response ) 107 throws WebException 108 { 109 try 110 { 111 final List<String> listeDates = _serviceTools.getListeDates(); 112 113 final ModelAndView modelAndView = new ModelAndView( VIEW_LIDAR_O3S ); 114 modelAndView.addObject( "listeDates", listeDates ); 115 116 return modelAndView; 117 118 } 119 catch( ServiceException e ) 120 { 121 throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); 122 } 123 } 124 125 public ModelAndView selectLidarO3s( final HttpServletRequest request, final HttpServletResponse response ) 126 throws WebException 127 { 128 try 129 { 130 String dateinf = request.getParameter( "dateinf" ); 131 String station = request.getParameter( "station" ); 132 133 final String instrument = request.getParameter( "instrument" ); 134 135 List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStation( instrument, dateinf, "yyyyMMdd", station ); 136 137 //dateinf="02021980"; 138 //List<String> ListDates = _plotService.getLastDate(instrument); 139 final List<String> listeDates = _serviceTools.getListeDates(); 140 String rep = ""; 141 String year = dateinf.substring( 0, 4 ); 142 String month = dateinf.substring( 4, 6 ); 143 144 if( station.compareTo( "OHP" ) == 0 || station.compareTo( "ohp" ) == 0 ) 145 { 146 rep = "./resources/visu/ohp/lidar/o3_strato"; 147 station = "OHP"; 148 if( year.compareTo( "1970" ) == 0 ) 149 { 150 151 year = "1991"; 152 } 153 } 154 else if( station.compareTo( "REU" ) == 0 || station.compareTo( "reu" ) == 0 || station.compareTo( "LA REUNION" ) == 0 || station.compareTo( "REUNION" ) == 0 ) 155 { 156 rep = "./resources/visu/reu/lidar/o3_strato"; 157 station = "LA REUNION"; 158 if( year.compareTo( "1970" ) == 0 ) year = "2006"; 159 //year="2006"; 160 } 161 162 else 163 { 164 rep = "./resources/visu/ddu/lidar/o3_strato"; 165 station = "DDU"; 166 if( year.compareTo( "1970" ) == 0 ) 167 { 168 year = "1991"; 169 //month="04"; 170 } 171 //year="2006"; 172 } 173 174 final ModelAndView modelAndView = new ModelAndView( VIEW_LIDAR_O3S ); 175 //plotsList=null; 176 modelAndView.addObject( "plotsList", plotsList ); 177 178 modelAndView.addObject( "listeDates", listeDates ); 179 modelAndView.addObject( "firstDate", dateinf ); 180 181 182 modelAndView.addObject( "month", month ); 183 modelAndView.addObject( "year", year ); 184 modelAndView.addObject( "station", station ); 185 modelAndView.addObject( "rep", rep ); 186 187 return modelAndView; 188 189 } 190 catch( ServiceException e ) 191 { 192 throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); 193 } 194 } 195 196 public ModelAndView selectLidarO3t( final HttpServletRequest request, final HttpServletResponse response ) 197 throws WebException 198 { 199 try 200 { 201 String dateinf = request.getParameter( "dateinf" ); 202 String station = request.getParameter( "station" ); 203 204 final String instrument = request.getParameter( "instrument" ); 205 206 List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStation( instrument, dateinf, "yyyyMMdd", station ); 207 208 //dateinf="02021980"; 209 //List<String> ListDates = _plotService.getLastDate(instrument); 210 final List<String> listeDates = _serviceTools.getListeDates(); 211 String rep = ""; 212 String year = dateinf.substring( 0, 4 ); 213 String month = dateinf.substring( 4, 6 ); 214 215 if( station.compareTo( "OHP" ) == 0 || station.compareTo( "ohp" ) == 0 ) 216 { 217 rep = "./resources/visu/ohp/lidar/o3_tropo"; 218 station = "OHP"; 219 if( year.compareTo( "1970" ) == 0 ) 220 { 221 year = "2007"; 222 month = "05"; 223 dateinf = year + month + "01"; 224 } 225 } 226 //else if (station.compareTo("reunion")==0) { 227 else 228 { 229 rep = "./resources/visu/reu/lidar/o3_tropo"; 230 //rep="./resources/visu/ohp/lidar/o3_strato"; 231 station = "LA REUNION"; 232 if( year.compareTo( "1970" ) == 0 ) 233 { 234 year = "2006"; 235 236 } 237 //year="2006"; 238 } 239 240 241 final ModelAndView modelAndView = new ModelAndView( VIEW_LIDAR_O3T ); 242 //plotsList=null; 243 modelAndView.addObject( "plotsList", plotsList ); 244 245 modelAndView.addObject( "listeDates", listeDates ); 246 modelAndView.addObject( "firstDate", dateinf ); 247 248 //String month = dateinf.substring(4,6); 249 modelAndView.addObject( "month", month ); 250 modelAndView.addObject( "year", year ); 251 modelAndView.addObject( "station", station ); 252 modelAndView.addObject( "rep", rep ); 253 254 return modelAndView; 255 256 } 257 catch( ServiceException e ) 258 { 259 throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); 260 } 261 } 262 263 public ModelAndView selectLidarTemp( final HttpServletRequest request, final HttpServletResponse response ) 264 throws WebException 265 { 266 try 267 { 268 String dateinf = request.getParameter( "dateinf" ); 269 String station = request.getParameter( "station" ); 270 271 final String instrument = request.getParameter( "instrument" ); 272 273 List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStation( instrument, dateinf, "yyyyMMdd", station ); 274 275 //dateinf="02021980"; 276 //List<String> ListDates = _plotService.getLastDate(instrument); 277 final List<String> listeDates = _serviceTools.getListeDates(); 278 String rep = ""; 279 String year = dateinf.substring( 0, 4 ); 280 String month = dateinf.substring( 4, 6 ); 281 282 if( station.compareTo( "OHP" ) == 0 || station.compareTo( "ohp" ) == 0 ) 283 { 284 rep = "./resources/visu/ohp/lidar/temp"; 285 station = "OHP"; 286 if( year.compareTo( "1970" ) == 0 ) 287 { 288 year = "2009"; 289 month = "01"; 290 } 291 } 292 293 if( station.compareTo( "REU" ) == 0 || station.compareTo( "reu" ) == 0 ) 294 { 295 rep = "./resources/visu/reu/lidar/temp"; 296 station = "REU"; 297 if( year.compareTo( "1970" ) == 0 ) 298 { 299 year = "1994"; 300 month = "05"; 301 } 302 } 303 304 final ModelAndView modelAndView = new ModelAndView( VIEW_LIDAR_TEMP ); 305 //plotsList=null; 306 modelAndView.addObject( "plotsList", plotsList ); 307 308 modelAndView.addObject( "listeDates", listeDates ); 309 modelAndView.addObject( "firstDate", dateinf ); 310 311 //String month = dateinf.substring(4,6); 312 modelAndView.addObject( "month", month ); 313 modelAndView.addObject( "year", year ); 314 modelAndView.addObject( "station", station ); 315 modelAndView.addObject( "rep", rep ); 316 317 return modelAndView; 318 319 } 320 catch( ServiceException e ) 321 { 322 throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); 323 } 324 } 325 326 327 public ModelAndView selectLidarAerosols( final HttpServletRequest request, final HttpServletResponse response ) 328 throws WebException 329 { 330 try 331 { 332 String dateinf = request.getParameter( "dateinf" ); 333 String station = request.getParameter( "station" ); 334 335 final String instrument = request.getParameter( "instrument" ); 336 337 List<String> plotsList = _plotService.getPlotsByDateByInstrumentByStation( instrument, dateinf, "yyyyMMdd", station ); 338 339 //dateinf="02021980"; 340 //List<String> ListDates = _plotService.getLastDate(instrument); 341 final List<String> listeDates = _serviceTools.getListeDates(); 342 String rep = ""; 343 String year = dateinf.substring( 0, 4 ); 344 String month = dateinf.substring( 4, 6 ); 345 346 if( station.compareTo( "OHP" ) == 0 || station.compareTo( "ohp" ) == 0 ) 347 { 348 rep = "./resources/visu/ohp/lidar/aerosols"; 349 station = "OHP"; 350 if( year.compareTo( "1970" ) == 0 ) 351 { 352 year = "2009"; 353 month = "01"; 354 } 355 } 356 357 if( station.compareTo( "DDU" ) == 0 || station.compareTo( "ddu" ) == 0 ) 358 { 359 rep = "./resources/visu/ddu/lidar/aerosols"; 360 station = "DDU"; 361 if( year.compareTo( "1970" ) == 0 ) 362 { 363 year = "2010"; 364 month = "01"; 365 } 366 } 367 368 final ModelAndView modelAndView = new ModelAndView( VIEW_LIDAR_AEROSOLS ); 369 //plotsList=null; 370 modelAndView.addObject( "plotsList", plotsList ); 371 372 modelAndView.addObject( "listeDates", listeDates ); 373 modelAndView.addObject( "firstDate", dateinf ); 374 375 //String month = dateinf.substring(4,6); 376 modelAndView.addObject( "month", month ); 377 modelAndView.addObject( "year", year ); 378 modelAndView.addObject( "station", station ); 379 modelAndView.addObject( "rep", rep ); 380 381 return modelAndView; 382 383 } 384 catch( ServiceException e ) 385 { 386 throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); 387 } 388 } 389 390 public ModelAndView viewSpectroUV( final HttpServletRequest request, final HttpServletResponse response ) 391 throws WebException 392 { 393 try 394 { 395 String dateinf = request.getParameter( "dateinf" ); 396 //List<String> m = new ArrayList<String>(12); 397 398 String m[]; 399 m = new String[12]; 400 String fname, iname, year; 401 402 final String instrument = request.getParameter( "instrument" ); 403 String especes = request.getParameter( "especes" ); 404 405 if( especes.equals( "nan" ) ) 406 { 407 especes = "uvauvb"; 408 } 409 410 if( dateinf.equals( "nan" ) ) 411 { 412 year = "2008"; 413 dateinf = "2008"; 414 415 } 416 417 List<String> plotsList = _plotService.getPlotsByDateByInstrument( instrument, dateinf, "yyyy" ); 418 final List<String> listeDates = _serviceTools.getListeDates(); 419 420 final ModelAndView modelAndView = new ModelAndView( VIEW_SPECTRO_UV ); 421 modelAndView.addObject( "plotsList", plotsList ); 422 423 modelAndView.addObject( "listeDates", listeDates ); 424 modelAndView.addObject( "firstDate", dateinf ); 425 modelAndView.addObject( "especes", especes ); 426 year = dateinf.substring( 0, 4 ); 427 428 modelAndView.addObject( "year", year ); 429 modelAndView.addObject( "m", m ); 430 431 fname = "vasp_"; 432 fname = fname.concat( especes ); 433 fname = fname.concat( "_" ); 434 fname = fname.concat( year ); 435 436 iname = fname.concat( "01_plot1.jpg" ); 437 if( plotsList.contains( iname ) ) m[0] = iname; 438 else m[0] = "no"; 439 440 iname = fname.concat( "02_plot1.jpg" ); 441 if( plotsList.contains( iname ) ) m[1] = iname; 442 else m[1] = "no"; 443 444 iname = fname.concat( "03_plot1.jpg" ); 445 if( plotsList.contains( iname ) ) m[2] = iname; 446 else m[2] = "no"; 447 448 iname = fname.concat( "04_plot1.jpg" ); 449 if( plotsList.contains( iname ) ) m[3] = iname; 450 else m[3] = "no"; 451 452 iname = fname.concat( "05_plot1.jpg" ); 453 if( plotsList.contains( iname ) ) m[4] = iname; 454 else m[4] = "no"; 455 456 iname = fname.concat( "06_plot1.jpg" ); 457 if( plotsList.contains( iname ) ) m[5] = iname; 458 else m[5] = "no"; 459 460 iname = fname.concat( "07_plot1.jpg" ); 461 if( plotsList.contains( iname ) ) m[6] = iname; 462 else m[6] = "no"; 463 464 iname = fname.concat( "08_plot1.jpg" ); 465 if( plotsList.contains( iname ) ) m[7] = iname; 466 else m[7] = "no"; 467 468 iname = fname.concat( "09_plot1.jpg" ); 469 if( plotsList.contains( iname ) ) m[8] = iname; 470 else m[8] = "no"; 471 472 iname = fname.concat( "10_plot1.jpg" ); 473 if( plotsList.contains( iname ) ) m[9] = iname; 474 else m[9] = "no"; 475 476 iname = fname.concat( "11_plot1.jpg" ); 477 if( plotsList.contains( iname ) ) m[10] = iname; 478 else m[10] = "no"; 479 480 iname = fname.concat( "12_plot1.jpg" ); 481 if( plotsList.contains( iname ) ) m[11] = iname; 482 else m[11] = "no"; 483 484 return modelAndView; 485 486 } 487 catch( ServiceException e ) 488 { 489 throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); 490 } 491 } 492 493 494 public ModelAndView viewInstruments( final HttpServletRequest request, final HttpServletResponse response ) 495 throws WebException 496 { 497 try 498 { 499 final List<Instrument> instruments = _instrumentService.getAllInstruments(); 500 501 final ModelAndView modelAndView = new ModelAndView( VIEW_INSTRUMENT ); 502 modelAndView.addObject( "instruments", instruments ); 503 return modelAndView; 504 505 } 506 catch( ServiceException e ) 507 { 508 throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); 509 } 510 } 511 512 public ModelAndView viewStation( final HttpServletRequest request, final HttpServletResponse response ) 513 throws WebException 514 { 515 try 516 { 517 final Long stationId = Long.valueOf( request.getParameter( "stationId" ) ); 518 final Station station = _stationService.getStationById( stationId ); 519 520 final ModelAndView modelAndView = new ModelAndView( VIEW_STATION ); 521 modelAndView.addObject( "station", station ); 522 return modelAndView; 523 524 } 525 catch( ServiceException e ) 526 { 527 throw new WebException( WebException.WebCode.SERVICE_PROBLEM, e ); 528 } 529 } 530 531 @Required 532 public void setStationService( final StationService stationService ) 533 { 534 _stationService = stationService; 535 } 536 537 @Required 538 public void setInstrumentService( final InstrumentService instrumentService ) 539 { 540 _instrumentService = instrumentService; 541 } 542 543 @Required 544 public void setServiceTools( final ServiceTools serviceTools ) 545 { 546 _serviceTools = serviceTools; 547 } 548 549 @Required 550 public void setPlotService( final PlotService plotService ) 551 { 552 _plotService = plotService; 553 } 554 555 private static final Log LOGGER = LogFactory.getLog( Controller.class ); 556 557 private static final String VIEW_INIT = "init"; 504 558 505 559 private static final String VIEW_INSTRUMENT = "instrument"; … … 511 565 private static final String VIEW_LIDAR_TEMP = "visus_lidar_temp"; 512 566 private static final String VIEW_LIDAR_AEROSOLS = "visus_lidar_aerosols"; 567 private static final String VIEW_DATA_OHP = "data_ohp"; 513 568 514 569 //services que le controller peut utiliser
Note: See TracChangeset
for help on using the changeset viewer.