Changeset 247 for ether_megapoli/trunk/web/src
- Timestamp:
- 11/14/11 16:33:00 (13 years ago)
- Location:
- ether_megapoli/trunk/web/src
- Files:
-
- 3 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
ether_megapoli/trunk/web/src/ApplicationResources.properties
r228 r247 83 83 data.intro1=Vous pouvez demander l'ouverture d'un compte personnalis\u00E9 en envoyant un email au 84 84 data.authentification=Authentification 85 data.authentification.intro=Veuillez vous identifier ci-dessousafin d'acc\u00E9der aux zones prot\u00E9g\u00E9es de ce site.85 data.authentification.intro=Veuillez vous identifier afin d'acc\u00E9der aux zones prot\u00E9g\u00E9es de ce site. 86 86 data.authentification.login=Login 87 87 data.authentification.pwd=Mot de passe … … 251 251 data.access.intro2=Une interface dynamique permet d'extraire des donn\u00E9es de la base de donn\u00E9es Megapoli. 252 252 data.access.intro3=Dans cette zone, vous pouvez \:<ul><li>acc\u00E9der aux donn\u00E9es en t\u00E9l\u00E9chargeant directement les fichiers d'origine issus de chaque jeu de donn\u00E9es</li><li>consulter les m\u00E9tadonn\u00E9es \:</li></ul> 253 data.access.intro4=Cette zone concerne l'acc\u00E8s et le d\u00E9p\u00F4t de donn\u00E9es. 253 254 data.access.listFiles.title=Fichiers d\u00E9pos\u00E9s dans le jeu {0} 254 255 data.access.metadata.link=Voir les m\u00E9tadonn\u00E9es du jeu … … 503 504 plot.degres=Degr\u00E9s 504 505 506 ####################### BACKOFFICE ####################### 507 bo.fulltitle=MEGAPOLI Backoffice -
ether_megapoli/trunk/web/src/ApplicationResources_en.properties
r228 r247 83 83 data.intro1=You can ask for a login account by sending an email to the 84 84 data.authentification=Authentification 85 data.authentification.intro=Please login belowto access the protected areas of this website.85 data.authentification.intro=Please login to access the protected areas of this website. 86 86 data.authentification.login=Login 87 87 data.authentification.pwd=Password … … 251 251 data.access.intro2=The interface is based on interactive queries through Megapoli database 252 252 data.access.intro3=In this area, you can<ul><li>access the data by directly downloading the original files from each data set</li><li>consult the data characteristics \:</li></ul> 253 data.access.intro4=This area is for access and download MEGAPOLI data. 253 254 data.access.listFiles.title=Files uploaded in the data set {0} 254 255 data.access.metadata.link=See metadata … … 502 503 plot.longitude=Longitude 503 504 plot.degres=Degrees 505 506 507 ####################### BACKOFFICE ####################### 508 bo.fulltitle=MEGAPOLI Backoffice -
ether_megapoli/trunk/web/src/com/ether/ControllerBackoffice.java
r246 r247 37 37 /** 38 38 * @author vmipsl 39 * @date 1 7 feb201139 * @date 13 nov 2011 40 40 */ 41 public class Controller Visualization41 public class ControllerBackoffice 42 42 extends ControllerEther 43 43 { 44 // TODO : mettre un pwd pour chaque méthode !!! 45 44 46 /** *********************************************************** **/ 45 47 /** *********************** VIEWS ***************************** **/ 46 48 /** *********************************************************** **/ 47 // Default view if methodName is unknown 48 public ModelAndView home( final HttpServletRequest request, final HttpServletResponse response ) 49 throws EtherException 50 { 51 return new ModelAndView( "index" ); 52 } 53 54 @ControllerMethod(view = VIEW_WORK) 55 public Map<String, Object> viewInWork() 56 throws ServiceException 57 { 58 return new HashMap<String, Object>(); 59 } 60 61 @ControllerMethod(view = VIEW_VISUALIZATION) 49 @ControllerMethod(view = VIEW_BO_INDEX) 62 50 public Map<String, Object> view() 63 51 throws ServiceException … … 76 64 final Map<String, Object> model = new HashMap<String, Object>(); 77 65 model.put( "plateforms", getJsonHelper().toJSON( plateforms ) ); 78 model.put( "axeTypesForFixedPlateforms", getJSONAxeTypesForFixedPlateforms() );79 model.put( "axeTypesForMobilePlateforms", getJSONAxeTypesForMobilePlateforms() );80 66 model.put( "firstDate", DateHelper.formatDate( firstDate, DateHelper.ENGLISH_DATE_PATTERN ) ); 81 67 model.put( "lastDate", DateHelper.formatDate( endDate, DateHelper.ENGLISH_DATE_PATTERN ) ); … … 86 72 /** *********************** CALLS ***************************** **/ 87 73 /** *********************************************************** **/ 88 @ControllerMethod(jsonResult = true)89 public JSONObject searchParametersByPlateform( @Mandatory @ParamName(ParameterConstants.PARAMETER_ID) final Integer plateformId )90 throws ServiceException, EtherException91 {92 final List<Parametre> fullParametersByPlateform = _etherService.getParametersByPlateformId( plateformId );93 final List<List<Parametre>> parametersByPlateform = manageMenusForParameterList( fullParametersByPlateform );94 74 95 final JSONObject result = new JSONObject(); 96 result.put( ParameterConstants.PARAMETER_PARAMETERS, getJsonHelper().toJSON( parametersByPlateform ) ); 97 return result; 98 } 99 100 /** 101 * This method manage the sub-menus for the list of parameters (to avoid multiple "Particle Concentration" by example) 102 * The fullParameters must be ordered with parameterName ascendant 103 * 104 * @param fullParameters 105 * @return 106 */ 107 @NotNull 108 private List<List<Parametre>> manageMenusForParameterList( @NotNull final List<Parametre> fullParameters ) 109 { 110 final List<List<Parametre>> parameterListWithMenu = new ArrayList<List<Parametre>>(); 111 112 int i = 0; 113 while( i < fullParameters.size() ) 114 { 115 final Parametre fullParameter = fullParameters.get( i ); 116 final int firstIndex = fullParameters.indexOf( fullParameter ); 117 final int lastIndex = fullParameters.lastIndexOf( fullParameter ); 118 final List<Parametre> parameters = fullParameters.subList( firstIndex, lastIndex + 1 ); 119 parameterListWithMenu.add( parameters ); 120 i += parameters.size(); 121 } 122 123 return parameterListWithMenu; 124 } 125 126 127 @ControllerMethod(jsonResult = true, loginMandatory = true) 128 public JSONObject downloadData( @ParamName(ParameterConstants.PARAMETER_DATE_BEGIN) final String dateBegin, 129 @ParamName(ParameterConstants.PARAMETER_DATE_END) final String dateEnd, 130 @ParamName(ParameterConstants.PARAMETER_PFID_PID_LIST) final String pIdPIdArrayString, 131 @NotNull final Personne personne ) 132 throws ServiceException, WebException 133 { 134 final JSONObject result = new JSONObject(); 135 136 final List<Pair<String, String>> pfIdPIdList = EtherHelper.extractpfIdPIdListFromString( pIdPIdArrayString, String.class, String.class ); 137 if( null == pfIdPIdList ) 138 throw new WebException( WebException.WebCode.PLATEFORM_OR_PARAMETER_IS_NULL, null ); 139 140 final DatasForm dataForm = createDataForm( dateBegin, dateEnd, pfIdPIdList ); 141 142 final XMLOutputter outXml = new XMLOutputter(); 143 final Document docXml = Requete.toXml( dataForm, personne ); 144 final String requete = outXml.outputString( docXml ); 145 try 146 { 147 final String encoded = "requete=" + URLEncoder.encode( requete, "UTF-8" ); 148 // Configuration de l'URL 149 final String urlCGIStr = (String) this.getServletContext().getAttribute( "APP_CGI" ); 150 final URL urlCGI = new URL( urlCGIStr ); 151 final URLConnection conn = urlCGI.openConnection(); 152 conn.setDoOutput( true ); 153 conn.setUseCaches( false ); 154 conn.setRequestProperty( "content-type", "application/x-www-form-urlencoded" ); 155 156 // Envoi de la requête 157 final DataOutputStream out = new DataOutputStream( conn.getOutputStream() ); 158 out.writeBytes( encoded ); 159 out.flush(); 160 out.close(); 161 162 // Réponse du CGI 163 final BufferedReader in = new BufferedReader( new InputStreamReader( conn.getInputStream() ) ); 164 String aLine; 165 while( ( aLine = in.readLine() ) != null ) 166 { 167 if( aLine.length() == 0 ) continue; 168 if( aLine.startsWith( "1" ) ) 169 { 170 System.err.println( "ERROR :" + aLine ); 171 } 172 else System.out.println( "REPONSE :" + aLine ); 173 } 174 } 175 catch( Exception e ) 176 { 177 result.put( ParameterConstants.PARAMETER_RESULT, ParameterConstants.PARAMETER_NOT_OK ); 178 return result; 179 } 180 181 result.put( ParameterConstants.PARAMETER_RESULT, ParameterConstants.PARAMETER_OK ); 182 return result; 183 } 184 185 /** 186 * This method create a dataForms to simulate and use the struts actions "DataAccessAction" and "DataSubmitAction" 187 * 188 * @param dateBegin 189 * @param dateEnd 190 * @param pfIdPIdList 191 * @return 192 * @throws WebException 193 */ 194 @NotNull 195 private DatasForm createDataForm( final String dateBegin, final String dateEnd, final List<Pair<String, String>> pfIdPIdList ) 196 throws WebException 197 { 198 final DatasForm dataForm = new DatasForm(); 199 200 // Plateforms and parameters 201 final List<String> plateformIds = EtherHelper.getFirstValues( pfIdPIdList ); 202 final List<String> parameterIds = EtherHelper.getSecondValues( pfIdPIdList ); 203 dataForm.setSelectPlats( plateformIds.toArray( new String[plateformIds.size()] ) ); 204 dataForm.setSelectParams( parameterIds.toArray( new String[parameterIds.size()] ) ); 205 206 // Localisations 207 final MesureAdapter mAdapter = new MesureAdapter(); 208 mAdapter.loadLocsFromDatabase( dataForm ); 209 210 // Dates 211 final Calendar calendar = Calendar.getInstance(); 212 String formatedDateBegin = null; 213 String formatedDateEnd = null; 214 if( null != dateBegin && null != dateEnd && !"false".equals( dateBegin ) && !"false".equals( dateEnd ) ) 215 { 216 try 217 { 218 calendar.setTimeInMillis( Long.valueOf( dateBegin ) ); 219 formatedDateBegin = DateHelper.formatDate( calendar.getTime(), DateHelper.FRENCH_DATE_PATTERN ); 220 calendar.setTimeInMillis( Long.valueOf( dateEnd ) ); 221 formatedDateEnd = DateHelper.formatDate( calendar.getTime(), DateHelper.FRENCH_DATE_PATTERN ); 222 dataForm.setDateDeb( formatedDateBegin ); 223 dataForm.setDateFin( formatedDateEnd ); 224 } 225 catch( Exception e ) 226 { 227 throw new WebException( WebException.WebCode.INVALID_DATE, e ); 228 } 229 } 230 else 231 mAdapter.loadDatesFromDatabase( dataForm ); 232 233 // Fill dataForm 234 final ValeurAdapter vAdapter = new ValeurAdapter(); 235 vAdapter.loadCountFromDatabase( dataForm ); 236 dataForm.setListeCoords( dataForm.getLatMin() + "," + dataForm.getLatMax() + "," + dataForm.getLonMin() + "," + dataForm.getLonMax() ); 237 dataForm.setListeDates( dataForm.getDateDeb() + "," + dataForm.getDateFin() ); 238 dataForm.setOutput( FORMAT_DEFAULT ); 239 dataForm.setCompression( COMPRESSION_DEFAULT ); 240 241 return dataForm; 242 } 243 244 private List<JSONObject> getJSONAxeTypesForFixedPlateforms() 245 { 246 final AxeTypeForFixedPlateform[] axeTypes = AxeTypeForFixedPlateform.values(); 247 248 final List<JSONObject> jsonAxeTypes = new ArrayList<JSONObject>( axeTypes.length ); 249 250 for( final AxeTypeForFixedPlateform axeType : axeTypes ) 251 { 252 final JSONObject jsonAxeType = new JSONObject(); 253 jsonAxeType.put( "text", axeType.name() ); 254 jsonAxeType.put( "value", axeType.name() ); 255 jsonAxeTypes.add( jsonAxeType ); 256 } 257 return jsonAxeTypes; 258 } 259 260 private List<JSONObject> getJSONAxeTypesForMobilePlateforms() 261 { 262 final AxeTypeForMobilePlateform[] axeTypes = AxeTypeForMobilePlateform.values(); 263 264 final List<JSONObject> jsonAxeTypes = new ArrayList<JSONObject>( axeTypes.length ); 265 266 for( final AxeTypeForMobilePlateform axeType : axeTypes ) 267 { 268 final JSONObject jsonAxeType = new JSONObject(); 269 jsonAxeType.put( "text", axeType.name() ); 270 jsonAxeType.put( "value", axeType.name() ); 271 jsonAxeTypes.add( jsonAxeType ); 272 } 273 return jsonAxeTypes; 274 } 275 276 @Required 75 @Required 277 76 public void setEtherService( @NotNull final EtherService etherService ) 278 77 { … … 280 79 } 281 80 282 private static final Log LOGGER = LogFactory.getLog( Controller Visualization.class );81 private static final Log LOGGER = LogFactory.getLog( ControllerBackoffice.class ); 283 82 284 private static final String VIEW_WORK = "visualization/inWork"; 285 private static final String VIEW_VISUALIZATION = "visualization/visu"; 83 private static final String VIEW_BO_INDEX = "backoffice/index"; 286 84 private static final String VIEW_VISUALIZATION_PARAMETER_BY_PLATEFORM = "visualization/visu_parameter_by_pf"; 287 private static final String VIEW_DOWNLOAD_OK = "data/access/extract3";288 85 289 private static final String FORMAT_DEFAULT = "NASA-AMES";290 private static final String COMPRESSION_DEFAULT = "None";291 86 private EtherService _etherService; 292 87 } -
ether_megapoli/trunk/web/src/com/ether/ControllerData.java
r246 r247 18 18 /** *********************** VIEWS ***************************** **/ 19 19 /** *********************************************************** **/ 20 @ControllerMethod(view = VIEW_CATALOG )21 public Map<String, Object> viewCatalog ()20 @ControllerMethod(view = VIEW_CATALOG_RESUME) 21 public Map<String, Object> viewCatalogResume() 22 22 throws ServiceException 23 23 { … … 53 53 } 54 54 55 @ControllerMethod(view = VIEW_DATA_RESUME) 56 public Map<String, Object> viewDataResume() 57 throws ServiceException 58 { 59 return new HashMap<String, Object>(); 60 } 61 62 @ControllerMethod(view = VIEW_METADATA_INFO) 63 public Map<String, Object> viewMetadataInfo() 64 throws ServiceException 65 { 66 return new HashMap<String, Object>(); 67 } 68 69 @ControllerMethod(view = VIEW_DESC_PARAMETER) 70 public Map<String, Object> viewDescParameter() 71 throws ServiceException 72 { 73 return new HashMap<String, Object>(); 74 } 75 76 @ControllerMethod(view = VIEW_DESC_SENSOR) 77 public Map<String, Object> viewDescSensor() 78 throws ServiceException 79 { 80 return new HashMap<String, Object>(); 81 } 82 83 @ControllerMethod(view = VIEW_DESC_PLATEFORM) 84 public Map<String, Object> viewDescPlateform() 85 throws ServiceException 86 { 87 return new HashMap<String, Object>(); 88 } 89 55 90 /** *********************************************************** **/ 56 91 /** *********************** CALLS ***************************** **/ … … 59 94 private static final Log LOGGER = LogFactory.getLog( ControllerData.class ); 60 95 61 private static final String VIEW_CATALOG = "data/access";96 private static final String VIEW_CATALOG_RESUME = "data/catalogResume"; 62 97 private static final String VIEW_SETS = "data/jeux"; 63 private static final String VIEW_PARAMETERS = "data/param"; 64 private static final String VIEW_SENSORS = "data/capt"; 65 private static final String VIEW_PLATEFORMS = "data/plat"; 98 private static final String VIEW_PARAMETERS = "data/parameter"; 99 private static final String VIEW_SENSORS = "data/sensor"; 100 private static final String VIEW_PLATEFORMS = "data/plateform"; 101 private static final String VIEW_DATA_RESUME = "data/dataResume"; 102 103 private static final String VIEW_METADATA_INFO = "data/metadataInfo"; 104 private static final String VIEW_DESC_PARAMETER = "data/desc_parameter"; 105 private static final String VIEW_DESC_SENSOR = "data/desc_sensor"; 106 private static final String VIEW_DESC_PLATEFORM = "data/desc_plateform"; 107 66 108 } -
ether_megapoli/trunk/web/src/com/ether/ControllerEponge.java
r246 r247 10 10 /** 11 11 * @author vmipsl 12 * @date 1 0nov 201112 * @date 12 nov 2011 13 13 */ 14 public class Controller Data14 public class ControllerEponge 15 15 extends ControllerEther 16 16 { … … 18 18 /** *********************** VIEWS ***************************** **/ 19 19 /** *********************************************************** **/ 20 @ControllerMethod(view = VIEW_ CATALOG)21 public Map<String, Object> view Catalog()20 @ControllerMethod(view = VIEW_ERRORS) 21 public Map<String, Object> viewErrors() 22 22 throws ServiceException 23 23 { … … 25 25 } 26 26 27 @ControllerMethod(view = VIEW_SETS) 28 public Map<String, Object> viewSets() 29 throws ServiceException 30 { 31 return new HashMap<String, Object>(); 32 } 33 34 @ControllerMethod(view = VIEW_PARAMETERS) 35 public Map<String, Object> viewParameters() 36 throws ServiceException 37 { 38 return new HashMap<String, Object>(); 39 } 40 41 @ControllerMethod(view = VIEW_SENSORS) 42 public Map<String, Object> viewSensors() 43 throws ServiceException 44 { 45 return new HashMap<String, Object>(); 46 } 47 48 @ControllerMethod(view = VIEW_PLATEFORMS) 49 public Map<String, Object> viewPlateforms() 27 @ControllerMethod(view = VIEW_LOGIN) 28 public Map<String, Object> viewLogin() 50 29 throws ServiceException 51 30 { … … 57 36 /** *********************************************************** **/ 58 37 59 private static final Log LOGGER = LogFactory.getLog( Controller Data.class );38 private static final Log LOGGER = LogFactory.getLog( ControllerEponge.class ); 60 39 61 private static final String VIEW_CATALOG = "data/access"; 62 private static final String VIEW_SETS = "data/jeux"; 63 private static final String VIEW_PARAMETERS = "data/param"; 64 private static final String VIEW_SENSORS = "data/capt"; 65 private static final String VIEW_PLATEFORMS = "data/plat"; 40 private static final String VIEW_ERRORS = "project/errors"; 41 private static final String VIEW_LOGIN = "project/login"; 66 42 }
Note: See TracChangeset
for help on using the changeset viewer.