Caro(a) Colega,
"; texto_email += "Na sequência do acidente de trabalho do colaborador "; @@ -14162,7 +14213,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } @@ -14191,7 +14242,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } } @@ -14220,13 +14271,13 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); System.out.println("EMAIL FASE 4 ERROR : " + ex.getMessage()); } } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } @@ -14264,7 +14315,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean { //// catch (Exception ex) //// { //// System.out.println("MAIL ERROR : " + ex.getMessage()); -//// ex.printStackTrace(); +//// ErrorLogger.logException( ex ); //// } // // } @@ -14516,7 +14567,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean { catch(Exception ex) { getSessionBean1().setMsg("Erro na actualização da análise !"); - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } @@ -14568,7 +14619,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); return null; } @@ -14657,7 +14708,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean { txtTrabalhador.setText(""); gridSiprp.setRendered(false); gridDadosAcidenteSeg.setRendered(false); - ex.printStackTrace(); + ErrorLogger.logException( ex ); } return null; @@ -14808,7 +14859,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } hidAnchor.setValue("dados"); } @@ -14827,7 +14878,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean { // } // catch(Exception ex) // { -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // } getSessionBean1().setIeBug(true); return null; @@ -14863,7 +14914,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); return false; } return true; @@ -14900,7 +14951,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); return false; } diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/EnviarCorrecao.java b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/EnviarCorrecao.java index c3247f18..d1e1ec04 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/EnviarCorrecao.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/EnviarCorrecao.java @@ -7,6 +7,7 @@ package analiseacidentestrabalho; import beans.Correcao; +import com.evolute.utils.error.ErrorLogger; import com.sun.data.provider.RowKey; import com.sun.rave.web.ui.appbase.AbstractPageBean; import com.sun.rave.web.ui.component.Body; @@ -31,7 +32,6 @@ import java.util.ArrayList; import javax.faces.FacesException; import javax.faces.component.html.HtmlPanelGrid; import javax.faces.event.ValueChangeEvent; -import javax.servlet.ServletContext; /** *
Page bean that corresponds to a similarly named JSP page. This @@ -678,7 +678,7 @@ public class EnviarCorrecao extends AbstractPageBean { // } // catch(Exception ex) // { -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // } // return "form_hs"; return null; @@ -712,7 +712,7 @@ public class EnviarCorrecao extends AbstractPageBean { // } // catch(Exception ex) // { -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // } return null; } @@ -738,7 +738,7 @@ public class EnviarCorrecao extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } return "form_hs"; } diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FichaUtilizador.java b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FichaUtilizador.java index c2fe7505..c2e09df8 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FichaUtilizador.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FichaUtilizador.java @@ -8,6 +8,7 @@ package analiseacidentestrabalho; import beans.Permissao; import beans.Utilizador; +import com.evolute.utils.error.ErrorLogger; import com.sun.rave.web.ui.appbase.AbstractPageBean; import com.sun.rave.web.ui.component.Body; import com.sun.rave.web.ui.component.Button; @@ -730,12 +731,12 @@ public class FichaUtilizador extends AbstractPageBean { } catch(Exception ex1) { - ex1.printStackTrace(); + ErrorLogger.logException( ex1 ); } } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } @@ -783,7 +784,7 @@ public class FichaUtilizador extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } try @@ -794,7 +795,7 @@ public class FichaUtilizador extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } @@ -812,7 +813,7 @@ public class FichaUtilizador extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); getSessionBean1().setMsg("Erro na eliminação do utilizador!"); } @@ -824,7 +825,7 @@ public class FichaUtilizador extends AbstractPageBean { // } // catch(Exception ex) // { - // ex.printStackTrace(); + // ErrorLogger.logException( ex ); // } } @@ -986,9 +987,14 @@ public class FichaUtilizador extends AbstractPageBean { } catch(Exception ex){} - try { - getExternalContext().redirect("Login.jsp"); - } catch(Exception e) {} + try + { + getExternalContext().redirect("Login.jsp"); + } + catch ( Exception e ) + { + ErrorLogger.logException( e ); + } //return "login"; return null; } @@ -1017,7 +1023,7 @@ public class FichaUtilizador extends AbstractPageBean { catch(Exception ex) { getSessionBean1().setMsg("Erro na criação do utilizador!"); - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } else //edit @@ -1031,7 +1037,7 @@ public class FichaUtilizador extends AbstractPageBean { catch(Exception ex) { getSessionBean1().setMsg("Erro na actualização do utilizador"); - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } @@ -1062,7 +1068,7 @@ public class FichaUtilizador extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } if(tipo.intValue() == SEG || tipo.intValue() == RH || tipo.intValue() == GESTOR || tipo.intValue() == DIRECTOR_RH || tipo.intValue() == DIRECTOR_SIPRP) { @@ -1090,7 +1096,7 @@ public class FichaUtilizador extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } else // medicos @@ -1106,7 +1112,7 @@ public class FichaUtilizador extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } } @@ -1255,7 +1261,7 @@ public class FichaUtilizador extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } } @@ -1316,7 +1322,7 @@ public class FichaUtilizador extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } drpNome.setSelected(u.getFuncionario_hst_id()); drpNome.setStyleClass("show"); @@ -1347,7 +1353,7 @@ public class FichaUtilizador extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } drpNome.setSelected(u.getMedico_id()); txtNome.setStyleClass("hide"); @@ -1380,10 +1386,8 @@ public class FichaUtilizador extends AbstractPageBean { // u.setLogin( (String) txtLogin.getText() ); String password = (String) txtPassword.getText(); u.setPassword( password ); - java.util.Date today = - new java.util.Date(); - java.sql.Date sqlToday = - new java.sql.Date(today.getTime()); + java.util.Date today = new java.util.Date(); + java.sql.Date sqlToday = new java.sql.Date(today.getTime()); u.setData_password(sqlToday); @@ -1410,7 +1414,7 @@ public class FichaUtilizador extends AbstractPageBean { // } // catch(Exception ex) // { -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // } // u.setCap( (String) txtCap.getText()); // } @@ -1424,7 +1428,7 @@ public class FichaUtilizador extends AbstractPageBean { // } // catch(Exception ex) // { -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // } // u.setNumero_cedula( (String) stCedula.getText()); // } @@ -1560,9 +1564,7 @@ public class FichaUtilizador extends AbstractPageBean { getSessionBean1().setNavFrom("FormDirSiprp"); } - return "gestao_utilizadores"; - } public String lnkAjuda_action() { @@ -1579,7 +1581,7 @@ public class FichaUtilizador extends AbstractPageBean { // } // catch(Exception ex) // { -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // } return null; } diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormDirGerRh.java b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormDirGerRh.java index a97ff5c3..04ed741b 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormDirGerRh.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormDirGerRh.java @@ -8,6 +8,7 @@ package analiseacidentestrabalho; import beans.Utilizador; import beans.AnaliseAcidente; +import com.evolute.utils.error.ErrorLogger; import com.sun.data.provider.RowKey; import com.sun.rave.web.ui.appbase.AbstractPageBean; import com.sun.rave.web.ui.component.Body; @@ -1016,7 +1017,7 @@ public class FormDirGerRh extends AbstractPageBean { { //lblActivos.setRendered(false); table1.setRendered(false); - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } try @@ -1031,7 +1032,7 @@ public class FormDirGerRh extends AbstractPageBean { { //lblActivos.setRendered(false); table2.setRendered(false); - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } fillAnoDropDown(); } @@ -1098,11 +1099,19 @@ public class FormDirGerRh extends AbstractPageBean { (javax.servlet.http.HttpSession) getExternalContext().getSession(true); session.invalidate(); } - catch(Exception ex){} + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } - try { - getExternalContext().redirect("Login.jsp"); - } catch(Exception e) {} + try + { + getExternalContext().redirect("Login.jsp"); + } + catch(Exception e) + { + ErrorLogger.logException( e ); + } //return "login"; return null; } @@ -1238,7 +1247,7 @@ public class FormDirGerRh extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } Integer ano = null; @@ -1300,16 +1309,14 @@ public class FormDirGerRh extends AbstractPageBean { table2.setRendered(true); txtSearchMsg.setRendered(false); - getSessionBean1().getAnalisesConcluidasDataProvider().setList(concluidasList); - - + getSessionBean1().getAnalisesConcluidasDataProvider().setList(concluidasList); } catch(Exception ex) { table2.setRendered(false); txtSearchMsg.setRendered(true); txtSearchMsg.setText("Não foram encontrados registos para a sua pesquisa !"); - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } return null; @@ -1424,7 +1431,7 @@ public class FormDirGerRh extends AbstractPageBean { } catch(Exception ex) { - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } } @@ -1471,7 +1478,7 @@ public class FormDirGerRh extends AbstractPageBean { // } // catch(Exception ex) // { -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // } return null; } @@ -1491,7 +1498,7 @@ public class FormDirGerRh extends AbstractPageBean { // } // catch(Exception ex) // { -// +// ErrorLogger.logException( ex ); // } return null; } @@ -1549,6 +1556,7 @@ public class FormDirGerRh extends AbstractPageBean { table1.setRendered( false ); txtSearchMsg.setRendered( true ); txtSearchMsg.setText( "Não foram encontrados registos para a sua pesquisa !" ); + ErrorLogger.logException( e ); } return null; diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormDirSiprp.java b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormDirSiprp.java index 8af33dd7..691c7d9e 100755 --- a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormDirSiprp.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormDirSiprp.java @@ -8,6 +8,7 @@ package analiseacidentestrabalho; import beans.Utilizador; import beans.AnaliseAcidente; +import com.evolute.utils.error.ErrorLogger; import com.sun.data.provider.RowKey; import com.sun.rave.web.ui.appbase.AbstractPageBean; import com.sun.rave.web.ui.component.Body; @@ -1037,7 +1038,7 @@ public class FormDirSiprp extends AbstractPageBean { { //lblActivos.setRendered(false); table2.setRendered( false ); - ex.printStackTrace(); + ErrorLogger.logException( ex ); } try @@ -1052,7 +1053,7 @@ public class FormDirSiprp extends AbstractPageBean { { //lblActivos.setRendered(false); table3.setRendered(false); - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } fillAnoDropDown(); } @@ -1109,11 +1110,19 @@ public class FormDirSiprp extends AbstractPageBean { (javax.servlet.http.HttpSession) getExternalContext().getSession(true); session.invalidate(); } - catch(Exception ex){} + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } - try { - getExternalContext().redirect("Login.jsp"); - } catch(Exception e) {} + try + { + getExternalContext().redirect("Login.jsp"); + } + catch(Exception e) + { + ErrorLogger.logException( e ); + } //return "login"; return null; } @@ -1276,7 +1285,7 @@ public class FormDirSiprp extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } Integer ano = null; @@ -1347,7 +1356,7 @@ public class FormDirSiprp extends AbstractPageBean { table3.setRendered(false); txtSearchMsg.setRendered(true); txtSearchMsg.setText("Não foram encontrados registos para a sua pesquisa !"); - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } return null; @@ -1455,7 +1464,7 @@ public class FormDirSiprp extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } @@ -1502,7 +1511,7 @@ public class FormDirSiprp extends AbstractPageBean { // } // catch(Exception ex) // { -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // } return null; } @@ -1527,7 +1536,7 @@ public class FormDirSiprp extends AbstractPageBean { // } // catch(Exception ex) // { -// +// ErrorLogger.logException( ex ); // } return null; } @@ -1586,6 +1595,7 @@ public class FormDirSiprp extends AbstractPageBean { table2.setRendered( false ); txtSearchMsg.setRendered( true ); txtSearchMsg.setText( "Não foram encontrados registos para a sua pesquisa !" ); + ErrorLogger.logException( e ); } return null; diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormGestor.java b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormGestor.java index e9c58d47..5c513940 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormGestor.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormGestor.java @@ -8,6 +8,7 @@ package analiseacidentestrabalho; import beans.Utilizador; import beans.AnaliseAcidente; +import com.evolute.utils.error.ErrorLogger; import com.sun.data.provider.RowKey; import com.sun.rave.web.ui.appbase.AbstractPageBean; import com.sun.rave.web.ui.component.Body; @@ -1056,7 +1057,7 @@ public class FormGestor extends AbstractPageBean { { //lblActivos.setRendered(false); table1.setRendered(false); - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } try @@ -1079,7 +1080,7 @@ public class FormGestor extends AbstractPageBean { { //lblActivos.setRendered(false); table2.setRendered(false); - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } fillAnoDropDown(); } @@ -1133,7 +1134,7 @@ public class FormGestor extends AbstractPageBean { // } // catch(Exception ex) // { -// +// ErrorLogger.logException( ex ); // } return null; } @@ -1166,11 +1167,19 @@ public class FormGestor extends AbstractPageBean { (javax.servlet.http.HttpSession) getExternalContext().getSession(true); session.invalidate(); } - catch(Exception ex){} + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } - try { - getExternalContext().redirect("Login.jsp"); - } catch(Exception e) {} + try + { + getExternalContext().redirect("Login.jsp"); + } + catch(Exception e) + { + ErrorLogger.logException( e ); + } //return "login"; return null; } @@ -1308,7 +1317,7 @@ public class FormGestor extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } Integer ano = null; @@ -1363,7 +1372,6 @@ public class FormGestor extends AbstractPageBean { AnalisesDataProvider adp = new AnalisesDataProvider(); try { - //getSessionBean1().getAnalisesConcluidasDataProvider().setList(new ArrayList()); ArrayList concluidasList = null; if ( getSessionBean1().getCurrentUser().getGestor_geral().matches( "y" ) ) @@ -1378,19 +1386,16 @@ public class FormGestor extends AbstractPageBean { ano, mes, dia, por, nome, null ); } - table2.setRendered(true); txtSearchMsg.setRendered(false); - getSessionBean1().getAnalisesConcluidasDataProvider().setList(concluidasList); - - + getSessionBean1().getAnalisesConcluidasDataProvider().setList(concluidasList); } catch(Exception ex) { table2.setRendered(false); txtSearchMsg.setRendered(true); txtSearchMsg.setText("Não foram encontrados registos para a sua pesquisa !"); - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } return null; @@ -1496,7 +1501,7 @@ public class FormGestor extends AbstractPageBean { } catch(Exception ex) { - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } } @@ -1543,7 +1548,7 @@ public class FormGestor extends AbstractPageBean { // } // catch(Exception ex) // { -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // } return null; } @@ -1630,6 +1635,7 @@ public class FormGestor extends AbstractPageBean { table1.setRendered( false ); txtSearchMsg.setRendered( true ); txtSearchMsg.setText( "Não foram encontrados registos para a sua pesquisa !" ); + ErrorLogger.logException( e ); } return null; diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormHS.java b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormHS.java index d44b7f79..949c9f6f 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormHS.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormHS.java @@ -8,6 +8,7 @@ package analiseacidentestrabalho; import beans.Utilizador; import beans.AnaliseAcidente; +import com.evolute.utils.error.ErrorLogger; import com.sun.data.provider.RowKey; import com.sun.rave.web.ui.appbase.AbstractPageBean; import com.sun.rave.web.ui.component.Body; @@ -1336,7 +1337,7 @@ public class FormHS extends AbstractPageBean { { //lblActivos.setRendered(false); table1.setRendered(false); - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } try @@ -1351,7 +1352,7 @@ public class FormHS extends AbstractPageBean { { //lblActivos.setRendered(false); table2.setRendered(false); - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } try @@ -1367,8 +1368,8 @@ public class FormHS extends AbstractPageBean { { //lblActivos.setRendered(false); table3.setRendered(false); - ex.printStackTrace(); - System.out.println("ERRRRRROR : " + ex.getMessage()); + ErrorLogger.logException( ex ); +// System.out.println("ERRRRRROR : " + ex.getMessage()); } fillAnoDropDown(); } @@ -1418,11 +1419,19 @@ public class FormHS extends AbstractPageBean { (javax.servlet.http.HttpSession) getExternalContext().getSession(true); session.invalidate(); } - catch(Exception ex){} + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } - try { - getExternalContext().redirect("Login.jsp"); - } catch(Exception e) {} + try + { + getExternalContext().redirect("Login.jsp"); + } + catch(Exception e) + { + ErrorLogger.logException( e ); + } //return "login"; return null; } @@ -1583,7 +1592,7 @@ public class FormHS extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } Integer ano = null; @@ -1646,16 +1655,14 @@ public class FormHS extends AbstractPageBean { table3.setRendered(true); txtSearchMsg.setRendered(false); - getSessionBean1().getAnalisesConcluidasDataProvider().setList(concluidasList); - - + getSessionBean1().getAnalisesConcluidasDataProvider().setList(concluidasList); } catch(Exception ex) { table3.setRendered(false); txtSearchMsg.setRendered(true); txtSearchMsg.setText("Não foram encontrados registos para a sua pesquisa !"); - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } return null; @@ -1697,7 +1704,7 @@ public class FormHS extends AbstractPageBean { } catch(Exception ex) { - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } } @@ -1914,7 +1921,7 @@ public class FormHS extends AbstractPageBean { // } // catch(Exception ex) // { -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // } return null; } @@ -1939,7 +1946,7 @@ public class FormHS extends AbstractPageBean { // } // catch(Exception ex) // { -// +// ErrorLogger.logException( ex ); // } return null; } @@ -2001,6 +2008,7 @@ public class FormHS extends AbstractPageBean { table1.setRendered( false ); txtSearchMsg.setRendered( true ); txtSearchMsg.setText( "Não foram encontrados registos para a sua pesquisa !" ); + ErrorLogger.logException( e ); } return null; @@ -2061,6 +2069,7 @@ public class FormHS extends AbstractPageBean { table2.setRendered( false ); txtSearchMsg.setRendered( true ); txtSearchMsg.setText( "Não foram encontrados registos para a sua pesquisa !" ); + ErrorLogger.logException( e ); } return null; diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormMedico.java b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormMedico.java index 29af1a51..4c47f085 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormMedico.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormMedico.java @@ -7,6 +7,7 @@ package analiseacidentestrabalho; import beans.AnaliseAcidente; +import com.evolute.utils.error.ErrorLogger; import com.sun.data.provider.RowKey; import com.sun.rave.web.ui.appbase.AbstractPageBean; import com.sun.rave.web.ui.component.Body; @@ -1248,7 +1249,7 @@ public class FormMedico extends AbstractPageBean { { //lblActivos.setRendered(false); table1.setRendered(false); - ex.printStackTrace(); + ErrorLogger.logException( ex ); } table2.setRendered(false); @@ -1265,7 +1266,7 @@ public class FormMedico extends AbstractPageBean { { //lblActivos.setRendered(false); table2.setRendered(false); - ex.printStackTrace(); + ErrorLogger.logException( ex ); } try @@ -1280,7 +1281,7 @@ public class FormMedico extends AbstractPageBean { { //lblActivos.setRendered(false); table3.setRendered(false); - ex.printStackTrace(); + ErrorLogger.logException( ex ); } fillAnoDropDown(); } @@ -1335,7 +1336,10 @@ public class FormMedico extends AbstractPageBean { (javax.servlet.http.HttpSession) getExternalContext().getSession(true); session.invalidate(); } - catch(Exception ex){} + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } return "login"; } @@ -1477,7 +1481,7 @@ public class FormMedico extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } Integer ano = null; @@ -1540,7 +1544,7 @@ public class FormMedico extends AbstractPageBean { table3.setRendered(false); txtSearchMsg.setRendered(true); txtSearchMsg.setText("Não foram encontrados registos para a sua pesquisa !"); - ex.printStackTrace(); + ErrorLogger.logException( ex ); } return null; } @@ -1575,7 +1579,7 @@ public class FormMedico extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } @@ -1754,6 +1758,7 @@ public class FormMedico extends AbstractPageBean { table1.setRendered( false ); txtSearchMsg.setRendered( true ); txtSearchMsg.setText( "Não foram encontrados registos para a sua pesquisa !" ); + ErrorLogger.logException( e ); } return null; @@ -1804,6 +1809,7 @@ public class FormMedico extends AbstractPageBean { table2.setRendered( false ); txtSearchMsg.setRendered( true ); txtSearchMsg.setText( "Não foram encontrados registos para a sua pesquisa !" ); + ErrorLogger.logException( e ); } return null; diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormRH.java b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormRH.java index 941ab380..0fb4628b 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormRH.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormRH.java @@ -8,6 +8,7 @@ package analiseacidentestrabalho; import beans.Utilizador; import beans.AnaliseAcidente; +import com.evolute.utils.error.ErrorLogger; import com.sun.data.provider.RowKey; import com.sun.rave.web.ui.appbase.AbstractPageBean; import com.sun.rave.web.ui.component.Body; @@ -1309,7 +1310,7 @@ public class FormRH extends AbstractPageBean { { //lblActivos.setRendered(false); table1.setRendered(false); - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } try @@ -1324,7 +1325,7 @@ public class FormRH extends AbstractPageBean { { //lblActivos.setRendered(false); table2.setRendered(false); - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } try @@ -1339,7 +1340,7 @@ public class FormRH extends AbstractPageBean { { //lblActivos.setRendered(false); table3.setRendered(false); - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } fillAnoDropDown(); } @@ -1389,11 +1390,19 @@ public class FormRH extends AbstractPageBean { (javax.servlet.http.HttpSession) getExternalContext().getSession(true); session.invalidate(); } - catch(Exception ex){} + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } - try { - getExternalContext().redirect("Login.jsp"); - } catch(Exception e) {} + try + { + getExternalContext().redirect("Login.jsp"); + } + catch ( Exception e ) + { + ErrorLogger.logException( e ); + } //return "login"; return null; } @@ -1562,7 +1571,7 @@ public class FormRH extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } Integer ano = null; @@ -1624,7 +1633,7 @@ public class FormRH extends AbstractPageBean { table3.setRendered(false); txtSearchMsg.setRendered(true); txtSearchMsg.setText("Não foram encontrados registos para a sua pesquisa !"); - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } return null; @@ -1666,7 +1675,7 @@ public class FormRH extends AbstractPageBean { } catch(Exception ex) { - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } } @@ -1885,7 +1894,7 @@ public class FormRH extends AbstractPageBean { // } // catch(Exception ex) // { -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // } return null; } @@ -1963,6 +1972,7 @@ public class FormRH extends AbstractPageBean { table1.setRendered( false ); txtSearchMsg.setRendered( true ); txtSearchMsg.setText( "Não foram encontrados registos para a sua pesquisa !" ); + ErrorLogger.logException( e ); } return null; @@ -2014,6 +2024,7 @@ public class FormRH extends AbstractPageBean { table2.setRendered( false ); txtSearchMsg.setRendered( true ); txtSearchMsg.setText( "Não foram encontrados registos para a sua pesquisa !" ); + ErrorLogger.logException( e ); } return null; diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormSeguranca.java b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormSeguranca.java index 53fbcb7f..0792f5fa 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormSeguranca.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormSeguranca.java @@ -8,6 +8,7 @@ package analiseacidentestrabalho; import beans.Utilizador; import beans.AnaliseAcidente; +import com.evolute.utils.error.ErrorLogger; import com.sun.data.provider.RowKey; import com.sun.rave.web.ui.appbase.AbstractPageBean; import com.sun.rave.web.ui.component.Body; @@ -1332,7 +1333,7 @@ public class FormSeguranca extends AbstractPageBean { { //lblActivos.setRendered(false); table1.setRendered(false); - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } try @@ -1348,7 +1349,7 @@ public class FormSeguranca extends AbstractPageBean { { //lblActivos.setRendered(false); table2.setRendered(false); - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } try @@ -1363,7 +1364,7 @@ public class FormSeguranca extends AbstractPageBean { { //lblActivos.setRendered(false); table3.setRendered(false); - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } fillAnoDropDown(); } @@ -1420,7 +1421,7 @@ public class FormSeguranca extends AbstractPageBean { } catch(Exception ex) { - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } } @@ -1530,11 +1531,19 @@ public class FormSeguranca extends AbstractPageBean { (javax.servlet.http.HttpSession) getExternalContext().getSession(true); session.invalidate(); } - catch(Exception ex){} + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } - try { - getExternalContext().redirect("Login.jsp"); - } catch(Exception e) {} + try + { + getExternalContext().redirect("Login.jsp"); + } + catch(Exception e) + { + ErrorLogger.logException( e ); + } //return "login"; return null; } @@ -1620,6 +1629,7 @@ public class FormSeguranca extends AbstractPageBean { table1.setRendered( false ); txtSearchMsg.setRendered( true ); txtSearchMsg.setText( "Não foram encontrados registos para a sua pesquisa !" ); + ErrorLogger.logException( e ); } return null; @@ -1671,6 +1681,7 @@ public class FormSeguranca extends AbstractPageBean { table2.setRendered( false ); txtSearchMsg.setRendered( true ); txtSearchMsg.setText( "Não foram encontrados registos para a sua pesquisa !" ); + ErrorLogger.logException( e ); } return null; @@ -1690,7 +1701,7 @@ public class FormSeguranca extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } Integer ano = null; @@ -1744,16 +1755,14 @@ public class FormSeguranca extends AbstractPageBean { table3.setRendered(true); txtSearchMsg.setRendered(false); - getSessionBean1().getAnalisesConcluidasDataProvider().setList(concluidasList); - - + getSessionBean1().getAnalisesConcluidasDataProvider().setList(concluidasList); } catch(Exception ex) { table3.setRendered(false); txtSearchMsg.setRendered(true); txtSearchMsg.setText("Não foram encontrados registos para a sua pesquisa !"); - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } return null; @@ -2007,7 +2016,7 @@ public class FormSeguranca extends AbstractPageBean { // } // catch(Exception ex) // { -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // return null; // } return null; diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/GestaoUtilizadores.java b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/GestaoUtilizadores.java index b7b5fb28..c8bc6062 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/GestaoUtilizadores.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/GestaoUtilizadores.java @@ -7,6 +7,7 @@ package analiseacidentestrabalho; import beans.Utilizador; +import com.evolute.utils.error.ErrorLogger; import com.sun.data.provider.RowKey; import com.sun.rave.web.ui.appbase.AbstractPageBean; import com.sun.rave.web.ui.component.Body; @@ -38,7 +39,6 @@ import javax.faces.component.html.HtmlPanelGrid; import javax.faces.context.FacesContext; import javax.faces.event.ValueChangeEvent; import javax.servlet.http.HttpServletRequest; -import utils.JSFUtils; import utils.Utils; /** @@ -815,7 +815,7 @@ public class GestaoUtilizadores extends AbstractPageBean { } catch(Exception ex) { - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } String isDirRh = "n"; @@ -830,7 +830,7 @@ public class GestaoUtilizadores extends AbstractPageBean { } catch(Exception ex) { - //ex.printStackTrace(); + ErrorLogger.logException( ex ); } try @@ -840,7 +840,7 @@ public class GestaoUtilizadores extends AbstractPageBean { } catch(Exception ex) { - //ex.printStackTrace(); + ErrorLogger.logException( ex ); getSessionBean1().getUtilizadoresInactivosListDataProvider().setList(new ArrayList()); table1.setRendered(false); } @@ -896,9 +896,14 @@ public class GestaoUtilizadores extends AbstractPageBean { javax.servlet.http.HttpSession session = (javax.servlet.http.HttpSession) getExternalContext().getSession(true); session.invalidate(); - try { - getExternalContext().redirect("Login.jsp"); - } catch(Exception e) {} + try + { + getExternalContext().redirect("Login.jsp"); + } + catch ( Exception e ) + { + ErrorLogger.logException( e ); + } //return "login"; return null; @@ -1041,7 +1046,7 @@ public class GestaoUtilizadores extends AbstractPageBean { } catch(Exception ex) { - //ex.printStackTrace(); + ErrorLogger.logException( ex ); getSessionBean1().getUtilizadoresActivosListDataProvider().setList(new ArrayList()); } @@ -1052,7 +1057,7 @@ public class GestaoUtilizadores extends AbstractPageBean { } catch(Exception ex) { - //ex.printStackTrace(); + ErrorLogger.logException( ex ); getSessionBean1().getUtilizadoresInactivosListDataProvider().setList(new ArrayList()); } @@ -1196,7 +1201,7 @@ public class GestaoUtilizadores extends AbstractPageBean { // } // catch(Exception ex) // { -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // } return null; } diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/LoadImage.java b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/LoadImage.java index 7d194938..ea103fac 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/LoadImage.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/LoadImage.java @@ -6,6 +6,7 @@ */ package analiseacidentestrabalho; +import com.evolute.utils.error.ErrorLogger; import com.sun.rave.web.ui.appbase.AbstractPageBean; import com.sun.rave.web.ui.component.Body; import com.sun.rave.web.ui.component.Button; @@ -261,7 +262,7 @@ public class LoadImage extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } @@ -418,7 +419,7 @@ public class LoadImage extends AbstractPageBean { getSessionBean1().setImageName(justFileName); //getSessionBean1().setMsg("Ficheiro carregado !"); } catch (Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); getSessionBean1().setMsg("Não foi possivel carregar o ficheiro !"); return null; } diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Login.java b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Login.java index 341d0170..b5466741 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Login.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Login.java @@ -7,6 +7,7 @@ package analiseacidentestrabalho; import beans.Utilizador; +import com.evolute.utils.error.ErrorLogger; import com.sun.rave.web.ui.appbase.AbstractPageBean; import com.sun.rave.web.ui.component.Body; import com.sun.rave.web.ui.component.Button; @@ -22,15 +23,12 @@ import com.sun.rave.web.ui.component.TextField; import com.sun.rave.web.ui.model.Option; import db.AnalisesDataProvider; import db.UtilizadoresDataProvider; -import global.Global; import java.sql.Connection; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.GregorianCalendar; import javax.faces.FacesException; import javax.faces.component.html.HtmlPanelGrid; -import javax.faces.context.FacesContext; -import utils.JSFUtils; /** *
Page bean that corresponds to a similarly named JSP page. This @@ -455,7 +453,7 @@ public class Login extends AbstractPageBean { } catch(Exception e1) { - e1.printStackTrace(); + ErrorLogger.logException( e1 ); getSessionBean1().setMsg("Não tem permissão para entrar na aplicação !"); } } @@ -468,7 +466,7 @@ public class Login extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); getSessionBean1().setMsg("Utilizador inválido ! "); } } @@ -502,23 +500,25 @@ public class Login extends AbstractPageBean { private void connect() { - db.Db db = new db.Db(); - try - { - Connection connection = db.connect(); - } - catch(Exception ex) - { - getSessionBean1().setMsg("Erro na ligação à Base de Dados"); - //***** terminate session - try { - getExternalContext().redirect("faces/Erro.jsp"); - } catch(Exception e) { - // . . . handle exception . . . - e.printStackTrace(); - } - ex.printStackTrace(); - } + db.Db db = new db.Db(); + try + { + Connection connection = db.connect(); + } + catch(Exception ex) + { + getSessionBean1().setMsg("Erro na ligação à Base de Dados"); + //***** terminate session + try + { + getExternalContext().redirect("faces/Erro.jsp"); + } + catch ( Exception e ) + { + ErrorLogger.logException( e ); + } + ErrorLogger.logException( ex ); + } } private void initializeClock() @@ -571,7 +571,7 @@ public class Login extends AbstractPageBean { // } // catch(Exception ex) // { -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // } // try @@ -581,7 +581,7 @@ public class Login extends AbstractPageBean { // } // catch(Exception ex) // { -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // } AnalisesDataProvider adp = new AnalisesDataProvider(); @@ -591,7 +591,7 @@ public class Login extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } try @@ -600,7 +600,7 @@ public class Login extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } @@ -649,7 +649,7 @@ public class Login extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/NovoUtilizador.java b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/NovoUtilizador.java index 7a5c78ba..b00a1e86 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/NovoUtilizador.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/NovoUtilizador.java @@ -9,6 +9,7 @@ package analiseacidentestrabalho; import beans.Medico; import beans.Trabalhador; import beans.Utilizador; +import com.evolute.utils.error.ErrorLogger; import com.sun.data.provider.RowKey; import com.sun.rave.web.ui.appbase.AbstractPageBean; import com.sun.rave.web.ui.component.Body; @@ -1271,7 +1272,7 @@ public class NovoUtilizador extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } u.setFuncionario_hst_id((Integer) drpNomeHs.getSelected()); try @@ -1281,7 +1282,7 @@ public class NovoUtilizador extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } u.setCap(cap); @@ -1321,7 +1322,7 @@ public class NovoUtilizador extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } u.setMedico_id((Integer) drpNomeMed.getSelected()); //u.setNome(drpNomeMed.getLabel()); @@ -1335,7 +1336,7 @@ public class NovoUtilizador extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } u.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id()); u.setEstabelecimento((Integer) drpEstabelecimentoMed.getSelected()); @@ -1345,7 +1346,7 @@ public class NovoUtilizador extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } u.setResponsavel_loja("n"); getSessionBean1().setNewUser(u); @@ -1397,7 +1398,7 @@ public class NovoUtilizador extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } u = setUserTipo(u); @@ -1508,7 +1509,7 @@ public class NovoUtilizador extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } try @@ -1518,7 +1519,7 @@ public class NovoUtilizador extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } try @@ -1528,7 +1529,7 @@ public class NovoUtilizador extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } @@ -1628,7 +1629,7 @@ public class NovoUtilizador extends AbstractPageBean { getSessionBean1().setMsg("Trabalhador inexistente !"); getSessionBean1().getTrabalhadoresListDataProvider().setList(new ArrayList()); tblTrabalhadores.setStyleClass("hidden"); - ex.printStackTrace(); + ErrorLogger.logException( ex ); } return null; } @@ -1850,7 +1851,7 @@ public class NovoUtilizador extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } return u; } @@ -2012,7 +2013,7 @@ public class NovoUtilizador extends AbstractPageBean { // } // catch(Exception ex) // { -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // } return null; } diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/RecuperarPassword.java b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/RecuperarPassword.java index 2e2bdb38..249c2297 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/RecuperarPassword.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/RecuperarPassword.java @@ -7,6 +7,7 @@ package analiseacidentestrabalho; import beans.Utilizador; +import com.evolute.utils.error.ErrorLogger; import com.sun.rave.web.ui.appbase.AbstractPageBean; import com.sun.rave.web.ui.component.Body; import com.sun.rave.web.ui.component.Button; @@ -398,7 +399,7 @@ public class RecuperarPassword extends AbstractPageBean { catch(Exception ex) { getSessionBean1().setMsg("Erro no envio da password !"); - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } @@ -469,7 +470,7 @@ public class RecuperarPassword extends AbstractPageBean { // catch (Exception ex) // { // System.out.println("MAIL ERROR : " + ex.getMessage()); -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // } } diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/UtilizadorFields.java b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/UtilizadorFields.java index 46e67d74..87ff631f 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/UtilizadorFields.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/UtilizadorFields.java @@ -8,6 +8,7 @@ package analiseacidentestrabalho; import beans.Permissao; import beans.Utilizador; +import com.evolute.utils.error.ErrorLogger; import com.sun.rave.web.ui.appbase.AbstractPageBean; import com.sun.rave.web.ui.component.Body; import com.sun.rave.web.ui.component.Button; @@ -836,14 +837,18 @@ public class UtilizadorFields extends AbstractPageBean { getSessionBean1().setMsg("Utilizador eliminado!"); //return "gestao_utilizadores"; getSessionBean1().setUserDeleted(true); - try { + try + { getExternalContext().redirect("GestaoUtilizadores.jsp"); - } catch(Exception e) { + } + catch(Exception e) + { + ErrorLogger.logException( e ); } } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); getSessionBean1().setMsg("Erro na eliminação do utilizador!"); } } @@ -908,10 +913,17 @@ public class UtilizadorFields extends AbstractPageBean { (javax.servlet.http.HttpSession) getExternalContext().getSession(true); session.invalidate(); } - catch(Exception ex){} + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } try { - getExternalContext().redirect("Login.jsp"); - } catch(Exception e) {} + getExternalContext().redirect("Login.jsp"); + } + catch(Exception e) + { + ErrorLogger.logException( e ); + } return null; } @@ -966,7 +978,7 @@ public class UtilizadorFields extends AbstractPageBean { catch(Exception ex) { getSessionBean1().setMsg("Erro na criação do utilizador!"); - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } else if( getSessionBean1().getModoEdicaoUtilizador().matches("edit") ) @@ -980,7 +992,7 @@ public class UtilizadorFields extends AbstractPageBean { catch(Exception ex) { getSessionBean1().setMsg("Erro na actualização do utilizador"); - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } } @@ -1036,7 +1048,7 @@ public class UtilizadorFields extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } Utilizador u = getSessionBean1().getEditUser(); @@ -1060,7 +1072,7 @@ public class UtilizadorFields extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } drpEstabelecimentos.setSelected(u.getEstabelecimento_id()); @@ -1147,7 +1159,7 @@ public class UtilizadorFields extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } } @@ -1298,7 +1310,7 @@ public class UtilizadorFields extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } @@ -1461,7 +1473,10 @@ public class UtilizadorFields extends AbstractPageBean { } } } - catch(Exception ex){} + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } u.setResponsavel_loja("n"); try @@ -1474,7 +1489,10 @@ public class UtilizadorFields extends AbstractPageBean { } } } - catch(Exception ex){} + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } u.setPrimeiro_login("n"); UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); udp.updateUtilizador(u); @@ -1534,7 +1552,7 @@ public class UtilizadorFields extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } u.setCap( nu.getCap()); } @@ -1549,7 +1567,7 @@ public class UtilizadorFields extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } //u.setNumero_cedula( (String) stCedula.getText()); u.setNumero_cedula(nu.getNumero_cedula()); @@ -1628,7 +1646,7 @@ public class UtilizadorFields extends AbstractPageBean { // } // catch(Exception ex) // { -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // } return null; } diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/ViewAnaliseAcidenteTrabalho.java b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/ViewAnaliseAcidenteTrabalho.java index f6b1407c..e79722a7 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/ViewAnaliseAcidenteTrabalho.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/ViewAnaliseAcidenteTrabalho.java @@ -13,6 +13,7 @@ import beans.Medida; import beans.Utilizador; import beans.Acidentado; import beans.AnaliseAcidente; +import com.evolute.utils.error.ErrorLogger; import com.sun.rave.web.ui.appbase.AbstractPageBean; import com.sun.rave.web.ui.component.Body; import com.sun.rave.web.ui.component.Button; @@ -20,7 +21,6 @@ import com.sun.rave.web.ui.component.Form; import com.sun.rave.web.ui.component.Head; import com.sun.rave.web.ui.component.HiddenField; import com.sun.rave.web.ui.component.Html; -import com.sun.rave.web.ui.component.Hyperlink; import com.sun.rave.web.ui.component.ImageComponent; import com.sun.rave.web.ui.component.Link; import com.sun.rave.web.ui.component.Page; @@ -2221,7 +2221,7 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { } catch(Exception ex1) { - ex1.printStackTrace(); + ErrorLogger.logException( ex1 ); } } else if(u.getTipo().intValue() == Global.TIPO_UTILIZADOR_HS) @@ -2233,7 +2233,7 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { } catch(Exception ex1) { - ex1.printStackTrace(); + ErrorLogger.logException( ex1 ); } } @@ -2241,14 +2241,14 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { catch(Exception ex) { getSessionBean1().setMsg("Erro na eliminação da análise"); - ex.printStackTrace(); + ErrorLogger.logException( ex ); // try // { // getExternalContext().redirect("EditarQuestionario.jsp"); // } // catch(Exception ex1) // { -// ex1.printStackTrace(); +// ErrorLogger.logException( ex1 ); // } } } @@ -2515,7 +2515,10 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { java.util.Date ddate = new java.util.Date(a.getData_acidente().getTime()); stHeaderDate.setText(utils.Utils.dateToYYYYMMDD(ddate)); } - catch(Exception ex){}; + catch ( Exception ex ) + { + ErrorLogger.logException( ex ); + } } private void fillSIPRP(AnaliseAcidente a) @@ -2529,7 +2532,7 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } try { @@ -2539,7 +2542,7 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } @@ -2552,7 +2555,10 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { java.util.Date ddate = new java.util.Date(a.getData_nascimento().getTime()); stDataNascimento.setText(utils.Utils.dateToYYYYMMDD(ddate)); } - catch(Exception ex){}; + catch ( Exception ex ) + { + ErrorLogger.logException( ex ); + } stBI.setText(a.getBilhete_identidade()); stMorada.setText(a.getMorada()); String cod_postal1 = ""; @@ -2579,7 +2585,10 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { java.util.Date ddate = new java.util.Date(a.getData_admissao().getTime()); stDataAdmissao.setText(utils.Utils.dateToYYYYMMDD(ddate)); } - catch(Exception ex){}; + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } stFuncao.setText(a.getFuncao()); String turno_str = ""; if(a.getTurno().matches("m")) @@ -2610,7 +2619,7 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } try { @@ -2618,7 +2627,7 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } // try @@ -2636,7 +2645,7 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { // } // catch(Exception ex) // { -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // } txtTrabalhador.setText(a.getNome_acidentado()); @@ -2656,7 +2665,10 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { java.util.Date ddate = new java.util.Date(a.getData_acidente().getTime()); stDataAcidente1.setText(utils.Utils.dateToYYYYMMDD(ddate)); } - catch(Exception ex){}; + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } } if(a.getHora_acidente() == null) @@ -2677,7 +2689,10 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { { stHoraAcidente1.setText(utils.Utils.timeToHHMM(hour + ":" + minutes)); } - catch(Exception ex){} + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } } boolean booTurnoSeccaoLocal = false; @@ -2721,7 +2736,7 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); lblSeccao.setRendered(false); txtSeccao.setRendered(false); } @@ -2843,7 +2858,7 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); gridCausas.setRendered(false); } @@ -2971,7 +2986,7 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { catch(Exception ex) { System.out.println("IMAGES ERROR : " + ex.getMessage()); - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } @@ -3271,7 +3286,7 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } @@ -3310,7 +3325,7 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } @@ -3536,7 +3551,10 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { java.util.Date ddate = new java.util.Date(a.getData_aval_incapacidade().getTime()); st.setText(utils.Utils.dateToYYYYMMDD(ddate)); } - catch(Exception ex){}; + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } pg.getChildren().add(st); } @@ -3558,7 +3576,10 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { java.util.Date ddate = new java.util.Date(a.getData_rev_incapacidade().getTime()); st.setText(utils.Utils.dateToYYYYMMDD(ddate)); } - catch(Exception ex){}; + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } pg.getChildren().add(st); } @@ -3586,7 +3607,10 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { java.util.Date ddate = new java.util.Date(a.getPeriodo_incapacidade_de().getTime()); st.setText(utils.Utils.dateToYYYYMMDD(ddate)); } - catch(Exception ex){}; + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } pg.getChildren().add(st); st = new StaticText(); st.setId("stPeriodoIncapacidadeLbl2"); @@ -3603,7 +3627,10 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { java.util.Date ddate = new java.util.Date(a.getPeriodo_incapacidade_a().getTime()); st.setText(utils.Utils.dateToYYYYMMDD(ddate)); } - catch(Exception ex){}; + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } pg.getChildren().add(st); gridIncapacidade.getChildren().add(pg); } @@ -4181,7 +4208,10 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { java.util.Date ddate = new java.util.Date(a.getData_inicio_processo().getTime()); txtVer += utils.Utils.dateToYYYYMMDD(ddate) + "."; } - catch(Exception ex){}; + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } st.setText(txtVer); gridAssinaturasView.getChildren().add(st); } @@ -4199,7 +4229,10 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { java.util.Date ddate = new java.util.Date(a.getData_consolidacao().getTime()); txtVer += utils.Utils.dateToYYYYMMDD(ddate) + "."; } - catch(Exception ex){}; + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } st.setText(txtVer); gridAssinaturasView.getChildren().add(st); } @@ -4216,7 +4249,10 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { java.util.Date ddate = new java.util.Date(a.getData_assinatura_seg().getTime()); txtVer += utils.Utils.dateToYYYYMMDD(ddate) + "."; } - catch(Exception ex){}; + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } st.setText(txtVer); gridAssinaturasView.getChildren().add(st); } @@ -4233,7 +4269,10 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { java.util.Date ddate = new java.util.Date(a.getData_assinatura_rh().getTime()); txtVer += utils.Utils.dateToYYYYMMDD(ddate) + "."; } - catch(Exception ex){}; + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } st.setText(txtVer); gridAssinaturasView.getChildren().add(st); } @@ -4260,7 +4299,10 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { java.util.Date ddate = new java.util.Date(ac.getData_email_superior_hierarquico().getTime()); txtVer += " a " + utils.Utils.dateToYYYYMMDD(ddate); } - catch(Exception ex){}; + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } } } txtVer += "."; @@ -4271,7 +4313,7 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } HtmlPanelGrid grid = new HtmlPanelGrid(); @@ -4298,7 +4340,10 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { java.util.Date ddate = new java.util.Date(a.getData_assinatura_superior().getTime()); stData += utils.Utils.dateToYYYYMMDD(ddate); } - catch(Exception ex){}; + catch(Exception ex) + { + ErrorLogger.logException( ex ); + } String txt = "Assinado na Ficha de Análise de Acidente em papel por " + a.getNome_superior() + ", superior hierárquico / superior de "; txt += getSessionBean1().getAcidentado().getNome() + ", a " + stData; @@ -4334,7 +4379,7 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { } catch(Exception ex) { - + ErrorLogger.logException( ex ); } } @@ -4471,7 +4516,7 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { // } // catch(Exception ex) // { -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // } return null; } @@ -4496,7 +4541,7 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } // try @@ -4505,7 +4550,7 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { // } // catch(Exception ex) // { -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // } // // try @@ -4514,7 +4559,7 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { // } // catch(Exception ex) // { -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // } // // try @@ -4523,7 +4568,7 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { // } // catch(Exception ex) // { -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // } // // try @@ -4532,7 +4577,7 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { // } // catch(Exception ex) // { -// ex.printStackTrace(); +// ErrorLogger.logException( ex ); // } // // diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/db/Db.java b/trunk/AnaliseAcidentesTrabalho/src/java/db/Db.java index 167a1ca0..d79d237e 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/db/Db.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/db/Db.java @@ -9,6 +9,7 @@ package db; +import com.evolute.utils.error.ErrorLogger; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; @@ -20,16 +21,20 @@ import javax.servlet.http.HttpSession; * * @author lluis */ -public class Db { -// String connectionURL = "jdbc:postgresql://storage:5432/siprp_20100629"; //testes +public class Db +{ +// String connectionURL = "jdbc:postgresql://evoserver:5432/siprp_20100629"; //testes String connectionURL = "jdbc:postgresql://localhost:5436/siprp"; //real String User = "postgres"; String Pass = null; + + Connection connection = null; /** Creates a new instance of Db */ - public Db() { + public Db() + { } public Connection connect() throws Exception @@ -53,7 +58,7 @@ public class Db { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); return null; } } diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/db/Dblocal.java b/trunk/AnaliseAcidentesTrabalho/src/java/db/Dblocal.java index 2721d641..48bd3ece 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/db/Dblocal.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/db/Dblocal.java @@ -9,6 +9,7 @@ package db; +import com.evolute.utils.error.ErrorLogger; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; @@ -20,15 +21,20 @@ import javax.servlet.http.HttpSession; * * @author lluis */ -public class Dblocal { -// String connectionURL = "jdbc:postgresql://storage:5432/siprp_local_3_20100713"; //testes +public class Dblocal +{ +// String connectionURL = "jdbc:postgresql://evoserver:5432/siprp_local_3_20100713"; //testes String connectionURL = "jdbc:postgresql://localhost:5436/siprp_local_3"; - String User = "postgres"; + + String User = "postgres"; String Pass = null; + + Connection connection = null; /** Creates a new instance of Dblocal */ - public Dblocal() { + public Dblocal() + { } public Connection connect() throws Exception @@ -52,7 +58,7 @@ public class Dblocal { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); return null; } } diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/db/UtilizadoresDataProvider.java b/trunk/AnaliseAcidentesTrabalho/src/java/db/UtilizadoresDataProvider.java index e4c5a97d..9a94b54d 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/db/UtilizadoresDataProvider.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/db/UtilizadoresDataProvider.java @@ -13,6 +13,7 @@ import beans.Medico; import beans.Permissao; import beans.TecnicoSaude; import beans.Utilizador; +import com.evolute.utils.error.ErrorLogger; import com.sun.rave.web.ui.model.Option; import global.Global; import java.sql.ResultSet; @@ -49,7 +50,7 @@ public class UtilizadoresDataProvider { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); return new Integer(1); } } @@ -348,7 +349,7 @@ public class UtilizadoresDataProvider { } catch(Exception e) { - e.printStackTrace(); + ErrorLogger.logException( e ); } if(booDirRh.matches("y")) { @@ -391,6 +392,7 @@ public class UtilizadoresDataProvider { } catch(Exception ex) { + ErrorLogger.logException( ex ); return null; } } @@ -412,6 +414,7 @@ public class UtilizadoresDataProvider { } catch(Exception ex) { + ErrorLogger.logException( ex ); return null; } } @@ -504,7 +507,7 @@ public class UtilizadoresDataProvider { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); return new Integer(1); } } diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/global/Global.java b/trunk/AnaliseAcidentesTrabalho/src/java/global/Global.java index ca2f73f4..3193edce 100755 --- a/trunk/AnaliseAcidentesTrabalho/src/java/global/Global.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/global/Global.java @@ -11,6 +11,7 @@ package global; import beans.Utilizador; //import com.sun.org.apache.bcel.internal.generic.GETFIELD; +import com.evolute.utils.error.ErrorLogger; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -97,7 +98,7 @@ public class Global { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } @@ -160,7 +161,7 @@ public class Global { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } } diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/pdf/Pdf.java b/trunk/AnaliseAcidentesTrabalho/src/java/pdf/Pdf.java index 2c08a09c..a8c8a84c 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/pdf/Pdf.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/pdf/Pdf.java @@ -11,14 +11,13 @@ package pdf; import beans.Acidentado; import beans.AnaliseAcidente; -import com.lowagie.text.Chunk; +import com.evolute.utils.error.ErrorLogger; import com.lowagie.text.Document; import com.lowagie.text.Font; import com.lowagie.text.FontFactory; import com.lowagie.text.Paragraph; import com.lowagie.text.Rectangle; import com.lowagie.text.pdf.BaseFont; -import com.lowagie.text.pdf.PdfAction; import com.lowagie.text.pdf.PdfPCell; import com.lowagie.text.pdf.PdfPTable; import com.lowagie.text.pdf.PdfWriter; @@ -61,7 +60,7 @@ public class Pdf { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } document.close(); } @@ -85,7 +84,7 @@ public class Pdf { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } try { @@ -93,7 +92,7 @@ public class Pdf { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } Acidentado ac = null; @@ -104,7 +103,7 @@ public class Pdf { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); } //TableEvents event = new TableEvents(); diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/phaselistener/MainPhaseListener.java b/trunk/AnaliseAcidentesTrabalho/src/java/phaselistener/MainPhaseListener.java index 6f0c0c0a..da185266 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/phaselistener/MainPhaseListener.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/phaselistener/MainPhaseListener.java @@ -6,15 +6,14 @@ package phaselistener; import beans.Utilizador; -import global.Global; -import javax.faces.application.NavigationHandler; -import javax.faces.component.UIViewRoot; import javax.faces.context.FacesContext; import javax.faces.event.PhaseEvent; import javax.faces.event.PhaseId; import javax.faces.event.PhaseListener; -import javax.servlet.http.HttpServletRequest; import analiseacidentestrabalho.SessionBean1; +import com.evolute.utils.error.ErrorLogger; +import java.util.logging.Level; +import utils.AnaliseAcidentesTrabalhoLogger; import utils.JSFUtils; import utils.Logos; @@ -22,12 +21,32 @@ import utils.Logos; * * @author lluis */ -public class MainPhaseListener implements PhaseListener{ +public class MainPhaseListener implements PhaseListener +{ + private static Boolean loggerIsLoaded = Boolean.FALSE; + + static + { + try + { + if ( ! loggerIsLoaded ) + { + System.out.println( "\nInitializing AAT logger ..." ); + AnaliseAcidentesTrabalhoLogger.init(); + loggerIsLoaded = Boolean.TRUE; + } + } + catch ( Throwable e ) + { + e.printStackTrace( System.err ); + } + } + private boolean firstEntry = true; - public void afterPhase(PhaseEvent pe) { + public void afterPhase(PhaseEvent pe) + { - } public void beforePhase(PhaseEvent pe) { diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/utils/AnaliseAcidentesTrabalhoLogger.java b/trunk/AnaliseAcidentesTrabalho/src/java/utils/AnaliseAcidentesTrabalhoLogger.java new file mode 100644 index 00000000..deb63049 --- /dev/null +++ b/trunk/AnaliseAcidentesTrabalho/src/java/utils/AnaliseAcidentesTrabalhoLogger.java @@ -0,0 +1,40 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package utils; + +import com.evolute.utils.error.ErrorLogger; +import com.evolute.utils.error.LoggerProperties; +import com.evolute.utils.error.ProjectsEnum; +import com.evolute.utils.error.log4j.DBLogger; +import java.util.HashMap; +import java.util.Map; + +/** + * + * @author dneves + */ +public class AnaliseAcidentesTrabalhoLogger +{ + + private static String EVO_LOGGER_DB = "jdbc:postgresql://www.evolute.pt:5436/evo_logging?logUnclosedConnections=true&loginTimeout=5&socketTimeout=5&tcpKeepAlive=true"; + private static String EVO_LOGGER_USER = "evo_logger"; + private static String EVO_LOGGER_PASSWD = "2DD-rg2hLOG"; + + public static void init() + { + Map< LoggerProperties, String > map = new HashMap< LoggerProperties, String >(); + map.put( LoggerProperties.USERNAME, EVO_LOGGER_USER ); + map.put( LoggerProperties.PASSWORD, EVO_LOGGER_PASSWD ); + map.put( LoggerProperties.URL, EVO_LOGGER_DB ); + map.put( LoggerProperties.PROJECT, ProjectsEnum.ANALISE_ACIDENTES_TRABALHO.toString() ); + map.put( LoggerProperties.PROJECT_NAME, ProjectsEnum.ANALISE_ACIDENTES_TRABALHO.toString() ); + map.put( LoggerProperties.SOFTWARE_VERSION, "1" ); + map.put( LoggerProperties.PROJECT_VERSION, "1" ); + map.put( LoggerProperties.SOFTWARE_NAME, "SIPRP - Analise Acidentes Trabalho" ); + ErrorLogger.initializeLogger( new DBLogger( map ) ); + } + +} diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/utils/Logos.java b/trunk/AnaliseAcidentesTrabalho/src/java/utils/Logos.java index ff459e24..4d276357 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/utils/Logos.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/utils/Logos.java @@ -5,6 +5,7 @@ package utils; +import com.evolute.utils.error.ErrorLogger; import db.AnalisesDataProvider; import global.Global; import java.io.File; @@ -46,7 +47,7 @@ public class Logos { } catch(Exception ex) { - ex.printStackTrace(); + ErrorLogger.logException( ex ); return null; }