Changeset 286
- Timestamp:
- 12/06/11 11:13:50 (13 years ago)
- Location:
- ether_megapoli/trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
ether_megapoli/trunk/common/interface/com/ether/FormattedException.java
r275 r286 47 47 } 48 48 49 public static String formatThrowable( final Enum<? extends Code> code, final String message, final Throwable throwable ) 50 { 51 if( throwable.equals( EXCEPTION_THROWABLE ) ) 52 return code.name(); 53 else 54 return prefix( code, message ); 55 } 56 49 57 /** 50 58 * Prefixes the message with code if not null. … … 64 72 } 65 73 74 public static Throwable getExceptionThrowable() 75 { 76 return EXCEPTION_THROWABLE; 77 } 78 66 79 /** 67 80 * The error code, it identifies the type of error. … … 75 88 public static String DEFAULT_MESSAGE = "no message"; 76 89 public static String DEFAULT_THROWABLE = null; 90 private static final Throwable EXCEPTION_THROWABLE = new Throwable( "EXCEPTION_THROWABLE" ); 77 91 } -
ether_megapoli/trunk/service/implementation/com/ether/EtherPlotServiceImpl.java
r213 r286 102 102 else 103 103 { 104 //throw new ServiceException( ServiceException.ServiceCode.NO_DATA, "No data for this plot", ServiceException.getExceptionThrowable() ); 104 105 final JPane jPaneCenter = createEmptyCenterPane( locale ); 105 106 jPane.add( jPaneCenter, BorderLayout.CENTER ); -
ether_megapoli/trunk/service/implementation/com/medias/megapoli/trade/ListePlateformesAdapter.java
r152 r286 4 4 package com.medias.megapoli.trade; 5 5 6 import java.util.ArrayList;7 import java.util.List;8 9 import org.apache.struts.action.ActionForm;10 import org.hibernate.HibernateException;11 6 import com.medias.database.objects.Plateforme; 12 7 import com.medias.database.objects.TypePlateforme; … … 14 9 import com.medias.megapoli.struts.forms.PlateformesForm; 15 10 import com.medias.utils.hibernate.CommunicationBD; 11 import org.apache.struts.action.ActionForm; 12 import org.hibernate.HibernateException; 13 14 import java.util.ArrayList; 15 import java.util.List; 16 16 17 17 18 18 /** 19 19 * @author pignot 20 * 21 * Classe permettant, au moyen de requêtes sur la base de données, 22 * de charger la liste des plateformes 20 * Classe permettant, au moyen de requêtes sur la base de données, 21 * de charger la liste des plateformes 22 * <p/> 23 * (relookée un minimum vmipsl) 23 24 */ 24 public class ListePlateformesAdapter { 25 private ArrayList<Plateforme> plateformes; 26 27 // private int min, max; 28 29 // public ListePlateformesAdapter() { 30 // plateformes = new ArrayList<Plateforme>(); 31 // } 25 public class ListePlateformesAdapter 26 { 27 public void loadPlateformesFromDatabase( final ActionForm form ) 28 { 29 try 30 { 31 CommunicationBD.open(); 32 final List<Plateforme> plats = (List<Plateforme>) CommunicationBD.getList( "from Plateforme order by typePlateforme.typePlateformeNom, plateformeNom" ); 33 final ArrayList<Plateforme> plateformes = new ArrayList<Plateforme>(); 32 34 33 public void loadPlateformesFromDatabase(ActionForm form) { 34 try { 35 CommunicationBD.open(); 36 List<?> plats = CommunicationBD.getList("from Plateforme order by typePlateforme.typePlateformeNom, plateformeNom"); 37 plateformes = new ArrayList<Plateforme>(); 38 Plateforme plateforme, plat; 39 TypePlateforme typePlateforme; 40 for (int numPlat=0; numPlat<plats.size(); numPlat++) { 41 plat = (Plateforme)plats.get(numPlat); 42 plateforme = new Plateforme(); 43 plateforme.setPlateformeId(plat.getPlateformeId()); 44 plateforme.setPlateformeNom(plat.getPlateformeNom()); 45 typePlateforme = new TypePlateforme(); 46 typePlateforme.setTypePlateformeId(plat.getTypePlateforme().getTypePlateformeId()); 47 typePlateforme.setTypePlateformeNom(plat.getTypePlateforme().getTypePlateformeNom()); 48 plateforme.setTypePlateforme(typePlateforme); 49 plateformes.add(plateforme); 50 } 51 CommunicationBD.close(); 52 if (form instanceof PlateformesForm) 53 ((PlateformesForm)form).setPlateformes(plateformes); 54 else 55 ((DatasForm)form).setPlateformes(plateformes); 56 } 57 catch (HibernateException e) { 58 System.out.println ("exception_ListePlateformesAdapter"); 59 // Libération de la connection à la base de données 60 try { 61 CommunicationBD.close(); 62 } catch (HibernateException ex) { 63 64 } 65 } 66 } 35 for( final Plateforme requestPlateform : plats ) 36 { 37 final Plateforme plateform = new Plateforme(); 38 plateform.setPlateformeId( requestPlateform.getPlateformeId() ); 39 plateform.setPlateformeNom( requestPlateform.getPlateformeNom() ); 67 40 68 /** 69 * En cours ... 70 */ 71 // private void trouverMinMax(ArrayList locs, String attribut) { 72 // Method appelGet; 73 // Class[] cl = {}; 74 // Object[] arg = {}; 75 // Localisation loc; 76 // Integer val; 77 // for (int num = 0; num<locs.size(); num++) { 78 // loc = ((Localisation)locs.get(num)); 79 // try { 80 // // Création de la méthode correspondant au type trouvé 81 // appelGet = Localisation.class.getMethod("get" + attribut,cl); 82 // // Invocation de la méthode sur la donnée 83 // val = (Integer) appelGet.invoke(loc,arg); 84 // } catch (NoSuchMethodException e2) { 85 // e2.printStackTrace(); 86 // } catch (SecurityException e) { 87 // e.printStackTrace(); 88 // } catch (IllegalArgumentException e1) { 89 // e1.printStackTrace(); 90 // } catch (IllegalAccessException e1) { 91 // e1.printStackTrace(); 92 // } catch (InvocationTargetException e1) { 93 // e1.printStackTrace(); 94 // } 95 // 96 // 97 // } 98 // 99 // } 41 final TypePlateforme typePlateforme = new TypePlateforme(); 42 typePlateforme.setTypePlateformeId( requestPlateform.getTypePlateforme().getTypePlateformeId() ); 43 typePlateforme.setTypePlateformeNom( requestPlateform.getTypePlateforme().getTypePlateformeNom() ); 44 plateform.setTypePlateforme( typePlateforme ); 45 46 //plateform.setMesures( requestPlateform.getMesures() ); 47 plateformes.add( plateform ); 48 } 49 CommunicationBD.close(); 50 if( form instanceof PlateformesForm ) 51 ( (PlateformesForm) form ).setPlateformes( plateformes ); 52 else 53 ( (DatasForm) form ).setPlateformes( plateformes ); 54 } 55 catch( HibernateException e ) 56 { 57 // System.out.println( "exception_ListePlateformesAdapter" ); 58 // Libération de la connection à la base de données 59 try 60 { 61 CommunicationBD.close(); 62 } 63 catch( HibernateException ignored ) 64 { 65 } 66 } 67 } 100 68 } -
ether_megapoli/trunk/service/interface/com/ether/ServiceException.java
r269 r286 15 15 } 16 16 17 protected ServiceException( final Enum<? extends Code> code, final String message, final Throwable cause, final Object... parameters )17 protected ServiceException( final Enum<? extends Code> code, final String message, final Throwable throwable, final Object... parameters ) 18 18 { 19 super( prefix( code, message ), cause, parameters );19 super( formatThrowable( code, message, throwable ), throwable, parameters ); 20 20 } 21 21 … … 35 35 DATE_NOT_FOUND, 36 36 USER_NOT_FOUND, 37 WAITING_USER_NOT_FOUND 37 WAITING_USER_NOT_FOUND, 38 NO_DATA 38 39 } 39 40 } -
ether_megapoli/trunk/web/data/parameter.jsp
r259 r286 1 <%@ page language="java" contentType="text/html; charset=UTF-8" %>2 <%@ page import="com.medias.Calcul" %>3 <%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>4 <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>5 <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>6 <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>7 <%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>1 <%@ page language="java" contentType="text/html; charset=UTF-8" %> 2 <%@ page import="com.medias.Calcul" %> 3 <%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %> 4 <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %> 5 <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> 6 <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %> 7 <%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %> 8 8 9 9 <tiles:insert page="/resources/templates/templateMegapoli.jsp" flush="true"> … … 21 21 22 22 <%--****************** CONTENT ****************** --%> 23 23 <tiles:put name="bodytitle" type="string"><bean:message key="data.access.param"/></tiles:put> 24 24 25 25 <tiles:put name="body" type="string"> 26 26 27 27 <logic:present name="<%=org.apache.struts.Globals.ERROR_KEY%>"> … … 30 30 31 31 <div id="messages"> 32 <html:messages id="mess" property="<%= org.apache.struts.action.ActionMessages.GLOBAL_MESSAGE %>" message="true"> 33 <bean:write name="mess"/> 34 </html:messages> 35 </div> 36 37 <%--div class="submit"> 38 <html:link page="/data/access/catalogResume.jsp"><bean:message key="data.access"/></html:link> 39 </div--%> 40 41 <nested:root name="parametresForm"> 42 <table> 43 <tr><th/> 44 <%--nested:define id="b_parametres" property="parametres"/> 45 <bean:define type="java.lang.String" id="nbParametres" value="<%=(new Integer(((ArrayList)b_parametres).size())).toString()%>"/--%> 46 <nested:size id="nbParametres" property="parametres"/> 47 <bean:write name="nbParametres"/> 48 <logic:equal name="nbParametres" value="1"> 49 <bean:message key="data.access.param2" arg0=""/> 50 </logic:equal> 51 <logic:notEqual name="nbParametres" value="1"> 52 <bean:message key="data.access.param2" arg0="s"/> 53 </logic:notEqual> 54 </th></tr> 32 <html:messages id="mess" property="<%= org.apache.struts.action.ActionMessages.GLOBAL_MESSAGE %>" message="true"> 33 <bean:write name="mess"/> 34 </html:messages> 35 </div> 55 36 56 <bean:define id="nomCatPrec" value=""/> 57 <nested:iterate property="parametres" indexId="paramId"> 58 <nested:nest property="categorieParam"> 59 <nested:define id="nomCat" property="categorieParamNom"/> 60 </nested:nest> 61 <tr><td> 62 <nested:notEqual name="nomCat" value="${nomCatPrec}"> 63 <div id="messages"><bean:write name="nomCat"/> :</div> 64 </nested:notEqual> 65 <bean:define type="java.lang.String" id="parite" value="<%=Calcul.getParite(paramId.intValue())%>"/> 66 <logic:equal name="parite" value="pair"><bean:define id="idP" value="pair"/></logic:equal> 67 <logic:equal name="parite" value="impair"><bean:define id="idP" value="impair"/></logic:equal> 68 <table class="${idP}" style="margin-left: 20px"> 69 <tr> 70 <td style="width:155px;" nowrap> 71 <nested:define id="id" property="parametreId"/> 72 <html:link page="/DescParametre.do" titleKey="data.access.param4" paramName="id" paramId="idParam"> 73 <nested:write property="parametreNom"/> (<nested:write property="parametreCode"/>) 74 </html:link> 75 </td> 76 </tr> 77 </table> 78 <bean:define id="nomCatPrec" value="${nomCat}"/> 79 </td></tr> 80 </nested:iterate> 81 </table> 37 <nested:root name="parametresForm"> 38 <table> 39 <tr> 40 <th> 41 <nested:size id="nbParametres" property="parametres"/> 42 <bean:write name="nbParametres"/> 43 <logic:equal name="nbParametres" value="1"><bean:message key="data.access.param2" arg0=""/></logic:equal> 44 <logic:notEqual name="nbParametres" value="1"><bean:message key="data.access.param2" arg0="s"/></logic:notEqual> 45 </th> 46 </tr> 47 48 <bean:define id="nomCatPrec" value=""/> 49 <nested:iterate property="parametres" indexId="paramId"> 50 <nested:nest property="categorieParam"> 51 <nested:define id="nomCat" property="categorieParamNom"/> 52 </nested:nest> 53 <tr> 54 <td> 55 <nested:notEqual name="nomCat" value="${nomCatPrec}"> 56 <div id="messages"><bean:write name="nomCat"/> :</div> 57 </nested:notEqual> 58 <bean:define type="java.lang.String" id="parite" value="<%=Calcul.getParite(paramId.intValue())%>"/> 59 <logic:equal name="parite" value="pair"><bean:define id="idP" value="pair"/></logic:equal> 60 <logic:equal name="parite" value="impair"><bean:define id="idP" value="impair"/></logic:equal> 61 62 <table class="${idP}" style="margin-left: 20px"> 63 <tr> 64 <td style="width:155px;" nowrap> 65 <nested:define id="id" property="parametreId"/> 66 <html:link page="/DescParametre.do" titleKey="data.access.param4" paramName="id" paramId="idParam"> 67 <nested:write property="parametreNom"/> (<nested:write property="parametreCode"/>) 68 </html:link> 69 </td> 70 </tr> 71 </table> 72 <bean:define id="nomCatPrec" value="${nomCat}"/> 73 </td> 74 </tr> 75 </nested:iterate> 76 </table> 82 77 83 78 <div class="hdp" align="right"> … … 87 82 </div> 88 83 89 84 </nested:root> 90 85 91 <%--div class="submit"> 92 <html:link page="/data/access/catalogResume.jsp"><bean:message key="data.access"/></html:link> 93 </div--%> 94 95 </tiles:put> 86 </tiles:put> 96 87 </tiles:insert> -
ether_megapoli/trunk/web/data/plateform.jsp
r259 r286 35 35 </div> 36 36 37 <%--div class="submit">38 <html:link page="/data/access/access.jsp"><bean:message key="data.access"/></html:link>39 </div--%>40 41 37 <nested:root name="plateformesForm"> 42 38 <table> 43 39 <tr><th/> 44 <%--nested:define id="b_plateformes" property="plateformes"/>45 <bean:define type="java.lang.String" id="nbPlateformes" value="<%=(new Integer(((ArrayList)b_plateformes).size())).toString()%>"/--%>46 40 <nested:size id="nbPlateformes" property="plateformes"/> 47 41 <bean:write name="nbPlateformes"/> -
ether_megapoli/trunk/web/resources/js/classesForJQuery/etherHelper.js
r268 r286 11 11 { 12 12 var index = jQuery.inArray( element, elementList ); 13 return (-1 == index);13 return (-1 != index); 14 14 } 15 15 -
ether_megapoli/trunk/web/src/com/ether/ControllerData.java
r261 r286 2 2 3 3 import com.ether.annotation.ControllerMethod; 4 import com.medias.database.objects.Plateforme; 4 5 import org.apache.commons.logging.Log; 5 6 import org.apache.commons.logging.LogFactory; 6 7 7 8 import java.util.HashMap; 9 import java.util.List; 8 10 import java.util.Map; 9 11 … … 50 52 throws ServiceException 51 53 { 54 // final List<Plateforme> plateforms = getEtherService().getAllPlateforms(); 55 56 // final Map<String, Object> model = new HashMap<String, Object>(); 57 // model.put( "plateforms", getJsonHelper().toJSON( plateforms ) ); 58 // return model; 52 59 return new HashMap<String, Object>(); 53 60 } -
ether_megapoli/trunk/web/src/com/ether/WebException.java
r284 r286 30 30 protected WebException( final Enum<? extends Code> code, final String message, final Throwable throwable, final Object... parameters ) 31 31 { 32 super( formatBO( code, message, throwable ), throwable, parameters ); 33 } 34 35 private static String formatBO( final Enum<? extends Code> code, final String message, final Throwable throwable ) 36 { 37 if( throwable.equals( EXCEPTION_THROWABLE ) ) 38 return code.name(); 39 else 40 return prefix( code, message ); 41 } 42 43 public static Throwable getExceptionThrowable() 44 { 45 return EXCEPTION_THROWABLE; 32 super( formatThrowable( code, message, throwable ), throwable, parameters ); 46 33 } 47 34 … … 62 49 63 50 private static final Throwable DEFAULT_THROWABLE = null; 64 private static final Throwable EXCEPTION_THROWABLE = new Throwable( "EXCEPTION_THROWABLE" );65 51 }
Note: See TracChangeset
for help on using the changeset viewer.