Changeset 139 for ether_megapoli
- Timestamp:
- 08/25/11 14:47:12 (13 years ago)
- Location:
- ether_megapoli/trunk
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
ether_megapoli/trunk/common/implementation/com/medias/Constantes.java
r89 r139 74 74 "WS (wind_speed : Attitudes and speed wrt ground from INS, air angles from radome, air speed from pitot)", 75 75 "C2Cl4 (Tetrachloroethylene)","C2H4 (Ethylene)", 76 "C2H6 (Ethane)","C3H6 (Propylene) 76 "C2H6 (Ethane)","C3H6 (Propylene)","C3H8 (Propane)","i-C4H10 (Iso-butane)","n-C4H10 (N-butane)","C5H8 (Isoprene)", 77 77 "i-C5H12 (Iso-pentane)","n-C5H12 (N-pentane)","C6H3Cl3 (Benzene, 1,2,4-trichloro-)","C6H4(CH3)(CH2CH3) (O-ethyltoluene)", 78 78 "C6H4Cl2 (Benzene, 1,2-dichloro-)","C6H5CHCH2 (Styrene)","C6H5Cl (Benzene, chloro-)","C6H5(CH2CH2CH3) (N-propylbenzene)", -
ether_megapoli/trunk/common/implementation/com/medias/Context.java
r129 r139 16 16 * Date: 27 janv. 2005 17 17 * Time: 15:45:10 18 * <p/>18 * 19 19 * Permet d'accéder au contexte courant pour chaque page de l'appli 20 20 */ … … 26 26 27 27 28 /** 29 * Permet d'obtenir la langue courante. 30 * 31 * @param request : la requête courante 32 * @return la langue courante. 33 */ 34 public static String getLangue( HttpServletRequest request ) 35 { 36 String lang = (String) request.getSession().getAttribute( "lang" ); 37 if( lang == null ) 38 { 39 // Pour initialiser la langue en Anglais 40 lang = request.getLocale().getLanguage(); 41 42 // Pour initialiser la langue en Français 43 //lang = Locale.FRENCH.getLanguage(); 44 } 45 return lang; 46 } 28 /** 29 * Permet d'obtenir la langue courante. 30 * @param request : la requête courante 31 * @return la langue courante. 32 */ 33 public static String getLangue(HttpServletRequest request) { 34 String lang=(String) request.getSession().getAttribute("lang"); 35 if (lang == null) { 36 // Pour initialiser la langue en Anglais 37 lang=request.getLocale().getLanguage(); 38 39 // Pour initialiser la langue en Français 40 //lang = Locale.FRENCH.getLanguage(); 41 } 42 return lang; 43 } 47 44 48 45 /** … … 65 62 } 66 63 67 public static String getLastModified( HttpServletRequest request, 68 javax.servlet.ServletContext application ) 69 { 70 Date d = new java.util.Date( new java.io.File( 71 application.getRealPath( request.getServletPath() ) ).lastModified() ); 72 return d.toString(); 73 } 64 public static String getLastModified(HttpServletRequest request, 65 javax.servlet.ServletContext application) { 66 Date d =new java.util.Date(new java.io.File( 67 application.getRealPath(request.getServletPath())).lastModified()); 68 return DateTime.dateToString(d,DateTime.formatDateStandard); 69 } 74 70 75 /** 76 * Permet d'obtenir la date courante, sous la forme YYYYMMDD 77 * 78 * @return la date courante 79 */ 80 public static String getSimpleDate() 81 { 82 java.util.Calendar c = java.util.Calendar.getInstance(); 83 String t = "0" + ( c.get( Calendar.MONTH ) + 1 ); 84 return c.get( Calendar.YEAR ) + t.substring( t.length() - 2 ) + c.get( Calendar.DAY_OF_MONTH ); 85 } 71 /** 72 * Permet d'obtenir la date courante, sous la forme YYYYMMDD 73 * @return la date courante 74 */ 75 public static String getSimpleDate() { 76 java.util.Calendar c = java.util.Calendar.getInstance(); 77 String t= "0"+(c.get(Calendar.MONTH)+1); 78 return c.get(Calendar.YEAR)+t.substring(t.length()-2)+c.get(Calendar.DAY_OF_MONTH); 79 } 86 80 87 /** 88 * Désigne l'adresse com.medias.mail du webmaster 89 */ 90 public static String getWebmaster( HttpServletRequest request ) 91 { 92 String webmaster = (String) request.getSession().getServletContext().getAttribute( "APP_WEBMASTER" ); 93 return webmaster; 94 } 81 /** 82 * Désigne l'adresse mail du webmaster 83 */ 84 public static String getWebmaster(HttpServletRequest request) { 85 String webmaster = (String)request.getSession().getServletContext().getAttribute("APP_WEBMASTER"); 86 return webmaster; 87 } 88 89 /** 90 * Permet de définir le nom de la racine à partir de laquelle les paths sont calculés. 91 * @return le nom de la racine. 92 */ 93 public static String getWebroot(HttpServletRequest request) { 94 String path = request.getSession().getServletContext().getRealPath(""); 95 return path.substring(path.lastIndexOf("/")+1); 96 } 95 97 96 /** 97 * Permet de définir le nom de la racine à partir de laquelle les paths sont calculés. 98 * 99 * @return le nom de la racine. 100 */ 101 public static String getWebroot( HttpServletRequest request ) 102 { 103 String path = request.getSession().getServletContext().getRealPath( "" ); 104 return path.substring( path.lastIndexOf( "/" ) + 1 ); 105 } 98 /** 99 * Permet d'obtenir l'uri de la page courante. 100 * @param request : la requête courante 101 * @return l'uri de la page courante 102 */ 103 public static String getPageURI(HttpServletRequest request) { 104 return request.getRequestURI().substring(request.getRequestURI().indexOf('/')+1); 105 } 106 106 107 /** 108 * Permet d'obtenir l'uri de la page courante. 109 * 110 * @param request : la requête courante 111 * @return l'uri de la page courante 112 */ 113 public static String getPageURI( HttpServletRequest request ) 114 { 115 return request.getRequestURI().substring( request.getRequestURI().indexOf( '/' ) + 1 ); 116 } 117 118 /** 119 * Permet d'obtenir l'URI relative de la page courante. 120 * Cette méthode est en particulier utilisée pour retomber sur la page courante lorsqu'on 121 * change de langue. 122 * 123 * @param request 124 * @return 125 */ 126 public static String getRelativePageURI( HttpServletRequest request ) 127 { 128 String pageUri = getPageURI( request ); 129 if( pageUri.indexOf( '/' ) != -1 ) 130 { 131 pageUri = pageUri.substring( pageUri.indexOf( '/' ) ); 107 /** 108 * Permet d'obtenir l'URI relative de la page courante. 109 * Cette méthode est en particulier utilisée pour retomber sur la page courante lorsqu'on 110 * change de langue. 111 * @param request 112 * @return 113 */ 114 public static String getRelativePageURI(HttpServletRequest request) { 115 String pageUri = getPageURI(request); 116 if (pageUri.indexOf('/') != -1) { 117 pageUri = pageUri.substring(pageUri.indexOf('/')); 132 118 } 133 134 119 return pageUri; 120 } 135 121 136 122 137 public static String getRelativePath( HttpServletRequest request ) 138 { 139 String uri = getPageURI( request ); 140 if( uri.indexOf( '/' ) != -1 ) 141 { 142 uri = uri.substring( uri.indexOf( '/' ), uri.lastIndexOf( '/' ) ); 143 } 144 return uri; 145 } 146 147 public static String getAnInternationalizeString( String bundle, String key ) 148 { 149 ResourceBundle resourceBundle = null; 150 String lang = Constantes.lang; 151 String message = null; 152 if( lang.trim().equals( "en" ) ) 153 { 154 resourceBundle = ResourceBundle.getBundle( bundle, Locale.ENGLISH ); 155 message = resourceBundle.getString( key ); 156 } 157 else 158 { 159 resourceBundle = ResourceBundle.getBundle( bundle, Locale.FRENCH ); 160 message = resourceBundle.getString( key ); 161 } 162 if( message == null ) 163 { 164 resourceBundle = ResourceBundle.getBundle( bundle, Locale.FRENCH ); 165 message = resourceBundle.getString( key ); 166 } 167 return message; 168 } 169 170 public static String getString( String bundle, String key ) 171 { 172 ResourceBundle resourceBundle = ResourceBundle.getBundle( bundle ); 173 String message = resourceBundle.getString( key ); 174 return message; 175 } 123 public static String getRelativePath(HttpServletRequest request) { 124 String uri = getPageURI(request); 125 if (uri.indexOf('/') != -1) { 126 uri = uri.substring(uri.indexOf('/'),uri.lastIndexOf('/')); 127 } 128 return uri; 129 } 130 131 public static String getAnInternationalizeString(String bundle, String key) { 132 ResourceBundle resourceBundle = null; 133 String lang = Constantes.lang; 134 String message = null; 135 if (lang.trim().equals("en")) { 136 resourceBundle = ResourceBundle.getBundle(bundle, Locale.ENGLISH); 137 message = resourceBundle.getString(key); 138 } else { 139 resourceBundle = ResourceBundle.getBundle(bundle, Locale.FRENCH); 140 message = resourceBundle.getString(key); 141 } 142 if (message == null) { 143 resourceBundle = ResourceBundle.getBundle(bundle, Locale.FRENCH); 144 message = resourceBundle.getString(key); 145 } 146 return message; 147 } 148 149 public static String getString(String bundle, String key) { 150 ResourceBundle resourceBundle = ResourceBundle.getBundle(bundle); 151 String message = resourceBundle.getString(key); 152 return message; 153 } 176 154 } -
ether_megapoli/trunk/common/implementation/com/medias/ConversionException.java
r89 r139 1 package com.medias;/*1 /* 2 2 * Created on 15 févr. 2005 3 3 * … … 5 5 * Window - Preferences - Java - Code Style - Code Templates 6 6 */ 7 package com.medias; 7 8 8 9 /** … … 14 15 public class ConversionException extends Exception { 15 16 /** 16 * com.medias17 * 17 18 */ 18 19 private static final long serialVersionUID = 1L; -
ether_megapoli/trunk/common/implementation/com/medias/DateTime.java
r89 r139 4 4 import java.text.SimpleDateFormat; 5 5 import java.text.ParseException; 6 import java.util.Calendar; 6 7 import java.util.Date; 7 8 … … 12 13 public class DateTime { 13 14 14 /** 15 * Définit si une string est une date au format dd/MM/yyyy. 15 public final static String formatDateStandard = "dd/MM/yyyy"; 16 public final static String formatHeureStandard = "HH:mm:ss"; 17 /** 18 * Définit si une string est une date au format date standard. 16 19 * @param date String à vérifier. 17 20 * @return Vrai si c'est une date valide. 18 21 */ 19 22 public static boolean isDateFr(String date) { 20 return isDate(date, "dd/MM/yyyy");23 return isDate(date, formatDateStandard); 21 24 } 22 25 … … 28 31 */ 29 32 public static boolean isDate(String date, String format) { 33 if (date == null) return false; 30 34 SimpleDateFormat sd = new SimpleDateFormat(format); 31 35 sd.setLenient(false); … … 45 49 */ 46 50 public static boolean isHeureFr(String heure) { 47 return isHeure(heure, "HH:mm:ss") || isHeure(heure, "HH:mm");51 return isHeure(heure, formatHeureStandard) || isHeure(heure, "HH:mm"); 48 52 } 49 53 … … 74 78 return getDate(date, "dd/MM/yy"); 75 79 } 76 return getDate(date, "dd/MM/yyyy");80 return getDate(date, formatDateStandard); 77 81 } 78 82 … … 83 87 */ 84 88 public static Date getHeureFr(String heure) { 85 Date heur = getDate(heure, "HH:mm:ss");89 Date heur = getDate(heure, formatHeureStandard); 86 90 if(heur == null) { 87 91 heur = getDate(heure, "HH:mm"); … … 112 116 */ 113 117 public static Timestamp stringToBd(String dateHeure) { 114 SimpleDateFormat sd = new SimpleDateFormat( "dd/MM/yyyy HH:mm:ss");118 SimpleDateFormat sd = new SimpleDateFormat(formatDateStandard+" "+formatHeureStandard); 115 119 sd.setLenient(false); 116 120 try { … … 125 129 /** 126 130 * Renvoie la date courante 127 * @return Date courante au format d d/MM/yyyy.131 * @return Date courante au format date standard. 128 132 */ 129 133 public static String getCurrentDate() { 130 134 Date date = new Date(); 131 SimpleDateFormat sd = new SimpleDateFormat( "dd/MM/yyyy");135 SimpleDateFormat sd = new SimpleDateFormat(formatDateStandard); 132 136 return sd.format(date); 133 137 } … … 139 143 public static String getCurrentHeure() { 140 144 Date date = new Date(); 141 SimpleDateFormat sd = new SimpleDateFormat( "hh:mm:ss");145 SimpleDateFormat sd = new SimpleDateFormat(formatHeureStandard); 142 146 return sd.format(date); 143 147 } … … 155 159 /** 156 160 * Créer une date francaise au format dd/MM/yyy à partir du nombre de millisecondes. 157 * @param dateVar com.medias.Nombre de millisecondes.158 * @return Date au format d d/MM/yyyy.161 * @param dateVar Nombre de millisecondes. 162 * @return Date au format date standard. 159 163 */ 160 164 public static String longToStringDateFr(long dateVar) { 161 SimpleDateFormat sd = new SimpleDateFormat( "dd/MM/yyyy");165 SimpleDateFormat sd = new SimpleDateFormat(formatDateStandard); 162 166 Date date = new Date(dateVar); 163 167 sd.setLenient(false); … … 173 177 /** 174 178 * Créer une heure francaise au format hh:mm:ss à partir du nombre de millisecondes. 175 * @param heureVar com.medias.Nombre de millisecondes.179 * @param heureVar Nombre de millisecondes. 176 180 * @return Heure au format hh:mm:ss. 177 181 */ 178 182 public static String longToStringHeureFr(long heureVar) { 179 SimpleDateFormat sd = new SimpleDateFormat( "hh:mm:ss");183 SimpleDateFormat sd = new SimpleDateFormat(formatHeureStandard); 180 184 Date date = new Date(heureVar); 181 185 sd.setLenient(false); … … 199 203 return new Timestamp(0); 200 204 } 201 SimpleDateFormat sdf1 = new SimpleDateFormat( "HH:mm:ss");202 SimpleDateFormat sdf2 = new SimpleDateFormat( "dd/MM/yyyy");205 SimpleDateFormat sdf1 = new SimpleDateFormat(formatHeureStandard); 206 SimpleDateFormat sdf2 = new SimpleDateFormat(formatDateStandard); 203 207 return new Timestamp(getDate(sdf2.format(date) + " " + sdf1.format(heure) , 204 "dd/MM/yyyy HH:mm:ss").getTime());208 formatDateStandard+" "+formatHeureStandard).getTime()); 205 209 } 206 210 … … 215 219 } 216 220 217 SimpleDateFormat sdf = new SimpleDateFormat( "dd/MM/yyyy");221 SimpleDateFormat sdf = new SimpleDateFormat(formatDateStandard); 218 222 return sdf.format(date); 219 223 } … … 228 232 return null; 229 233 } 230 SimpleDateFormat sdf = new SimpleDateFormat( "HH:mm:ss");234 SimpleDateFormat sdf = new SimpleDateFormat(formatHeureStandard); 231 235 return sdf.format(date); 232 236 } … … 239 243 public static String dateToString(Date date) { 240 244 Timestamp t; 241 SimpleDateFormat sdf = new SimpleDateFormat( "dd/MM/yyyy HH:mm:ss");245 SimpleDateFormat sdf = new SimpleDateFormat(formatDateStandard+" "+formatHeureStandard); 242 246 if (date == null) { 243 247 return null; … … 246 250 return sdf.format(t); 247 251 } 252 253 public static String dateToString(Date date, String format) { 254 Timestamp t; 255 SimpleDateFormat sdf = new SimpleDateFormat(format); 256 if (date == null) { 257 return null; 258 } 259 t = new Timestamp(date.getTime()); 260 return sdf.format(t); 261 } 262 263 /** 264 * Convertit un String en date 265 */ 266 public static Date stringToDate(String sdate, String format) { 267 Date date = new Date(); 268 SimpleDateFormat sdf =new SimpleDateFormat(format); 269 try { 270 date = sdf.parse(sdate); 271 } 272 catch(Exception e) { 273 return null; 274 } 275 return date; 276 } 277 278 /** 279 * Convertit un String en date au format standard (JJ/MM/AAAA) 280 */ 281 public static Date stringToDate(String sdate) { 282 Date date = new Date(); 283 SimpleDateFormat sdf =new SimpleDateFormat(formatDateStandard); 284 try { 285 date = sdf.parse(sdate); 286 } 287 catch(Exception e) { 288 return null; 289 } 290 return date; 291 } 292 293 /** 294 * Renvoie la date indiqué en argument +/- inc jour 295 */ 296 public static String getJourInc(String dateStr, String format, int inc) { 297 Calendar c = Calendar.getInstance(); 298 c.setTime(stringToDate(dateStr, format)); 299 c.add(Calendar.DATE, inc); 300 return dateToString(c.getTime(),format); 301 } 302 303 /** 304 * Compare 2 dates au format JJ/MM/AAAA 305 * @return vrai si date1 est plus grand que date2 306 */ 307 public static boolean plusGrand(String sdate1,String sdate2) { 308 if (sdate1 == null || sdate2 == null) return false; 309 Date date1 = stringToDate(sdate1); 310 Date date2 = stringToDate(sdate2); 311 return date1.after(date2); 312 } 248 313 } -
ether_megapoli/trunk/persistence/implementation/com/medias/objects/Fichier.hbm.xml
r89 r139 18 18 </many-to-one> 19 19 <property name="fichierNom" type="string"> 20 <column name="fichier_nom" length=" 50" not-null="true">20 <column name="fichier_nom" length="100" not-null="true"> 21 21 <comment>nom du fichier</comment> 22 22 </column> -
ether_megapoli/trunk/persistence/implementation/com/medias/objects/Jeu.hbm.xml
r89 r139 4 4 <!-- Generated 5 f?vr. 2007 11:07:12 by Hibernate Tools 3.2.0.b9 --> 5 5 <hibernate-mapping> 6 <class name=" com.medias.database.objects.Jeu" table="jeu" schema="public">6 <class name="org.medias.megapoli.model.database.objects.Jeu" table="jeu" schema="public"> 7 7 <comment>Table exprimant des informations sur les jeux de donnees de la base</comment> 8 8 <id name="jeuId" type="int"> … … 12 12 </generator> 13 13 </id> 14 <many-to-one name="personneByPiId" class=" com.medias.database.objects.Personne" fetch="select">14 <many-to-one name="personneByPiId" class="org.medias.megapoli.model.database.objects.Personne" fetch="select"> 15 15 <column name="pi_id"> 16 16 <comment>lien vers la table personne (pi)</comment> 17 17 </column> 18 18 </many-to-one> 19 <many-to-one name="personneByContactId" class=" com.medias.database.objects.Personne" fetch="select">19 <many-to-one name="personneByContactId" class="org.medias.megapoli.model.database.objects.Personne" fetch="select"> 20 20 <column name="contact_id" not-null="true"> 21 21 <comment>lien vers la table personne (contact technique)</comment> 22 22 </column> 23 23 </many-to-one> 24 <many-to-one name="personneByIntegrateurId" class=" com.medias.database.objects.Personne" fetch="select">24 <many-to-one name="personneByIntegrateurId" class="org.medias.megapoli.model.database.objects.Personne" fetch="select"> 25 25 <column name="integrateur_id" not-null="true"> 26 26 <comment>lien vers la table personne (integrateur)</comment> 27 27 </column> 28 28 </many-to-one> 29 <many-to-one name="organisme" class=" com.medias.database.objects.Organisme" fetch="select">29 <many-to-one name="organisme" class="org.medias.megapoli.model.database.objects.Organisme" fetch="select"> 30 30 <column name="organisme_id" not-null="true"> 31 31 <comment>lien vers la table organisme</comment> 32 32 </column> 33 33 </many-to-one> 34 <many-to-one name="commentaire" class=" com.medias.database.objects.Commentaire" fetch="select">34 <many-to-one name="commentaire" class="org.medias.megapoli.model.database.objects.Commentaire" fetch="select"> 35 35 <column name="commentaire_id"> 36 36 <comment>lien vers la table commentaire</comment> 37 37 </column> 38 38 </many-to-one> 39 <many-to-one name="categorie" class=" com.medias.database.objects.Categorie" fetch="select">39 <many-to-one name="categorie" class="org.medias.megapoli.model.database.objects.Categorie" fetch="select"> 40 40 <column name="categorie_id" not-null="true"> 41 41 <comment>lien vers la table categorie</comment> … … 118 118 </column> 119 119 </key> 120 <many-to-many entity-name=" com.medias.database.objects.Plateforme">120 <many-to-many entity-name="org.medias.megapoli.model.database.objects.Plateforme"> 121 121 <column name="plateforme_id" not-null="true"> 122 122 <comment>lien vers la table plateforme</comment> … … 130 130 </column> 131 131 </key> 132 <one-to-many class=" com.medias.database.objects.Bilan" />132 <one-to-many class="org.medias.megapoli.model.database.objects.Bilan" /> 133 133 </set> 134 134 <set name="capteurs" table="requete_capt_jeu"> … … 138 138 </column> 139 139 </key> 140 <many-to-many entity-name=" com.medias.database.objects.Capteur">140 <many-to-many entity-name="org.medias.megapoli.model.database.objects.Capteur"> 141 141 <column name="capteur_id" not-null="true"> 142 142 <comment>lien vers la table capteur</comment> … … 150 150 </column> 151 151 </key> 152 <many-to-many entity-name=" com.medias.database.objects.Parametre">152 <many-to-many entity-name="org.medias.megapoli.model.database.objects.Parametre"> 153 153 <column name="parametre_id" not-null="true"> 154 154 <comment>lien vers la table parametre</comment> … … 162 162 </column> 163 163 </key> 164 <one-to-many class=" com.medias.database.objects.Sequence" />164 <one-to-many class="org.medias.megapoli.model.database.objects.Sequence" /> 165 165 </set> 166 166 <set name="fichiers" inverse="true"> … … 170 170 </column> 171 171 </key> 172 <one-to-many class=" com.medias.database.objects.Fichier" />172 <one-to-many class="org.medias.megapoli.model.database.objects.Fichier" /> 173 173 </set> 174 174 <set name="requeteNbvalsJeus" inverse="true"> … … 178 178 </column> 179 179 </key> 180 <one-to-many class=" com.medias.database.objects.RequeteNbvalsJeu" />180 <one-to-many class="org.medias.megapoli.model.database.objects.RequeteNbvalsJeu" /> 181 181 </set> 182 182 </class>
Note: See TracChangeset
for help on using the changeset viewer.