git-svn-id: https://svn.coded.pt/svn/SIPRP@1457 bb69d46d-e84e-40c8-a05a-06db0d633741

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Diogo Neves 15 years ago
parent a2cc9d2648
commit 1ca7f6ca56

@ -547,6 +547,8 @@ exists or setup the property manually. For example like this:
<copyfiles files="${file.reference.serializer-2.7.0.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.serializer-2.7.0.jar" todir="${dist.ear.dir}"/> <copyfiles files="${file.reference.serializer-2.7.0.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.serializer-2.7.0.jar" todir="${dist.ear.dir}"/>
<copyfiles files="${file.reference.commons-collections-3.1.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.commons-collections-3.1.jar" todir="${dist.ear.dir}"/> <copyfiles files="${file.reference.commons-collections-3.1.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.commons-collections-3.1.jar" todir="${dist.ear.dir}"/>
<copyfiles files="${file.reference.commons-lang-2.1.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.commons-lang-2.1.jar" todir="${dist.ear.dir}"/> <copyfiles files="${file.reference.commons-lang-2.1.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.commons-lang-2.1.jar" todir="${dist.ear.dir}"/>
<copyfiles files="${file.reference.commons-validator-1.3.1.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.commons-validator-1.3.1.jar" todir="${dist.ear.dir}"/>
<copyfiles files="${file.reference.jakarta-oro-2.0.8.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.jakarta-oro-2.0.8.jar" todir="${dist.ear.dir}"/>
<copyfiles files="${libs.jsf-runtime.classpath}" todir="${build.web.dir}/WEB-INF/lib"/> <copyfiles files="${libs.jsf-runtime.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${libs.jsfsupport-runtime.classpath}" todir="${build.web.dir}/WEB-INF/lib"/> <copyfiles files="${libs.jsfsupport-runtime.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${libs.webui-runtime.classpath}" todir="${build.web.dir}/WEB-INF/lib"/> <copyfiles files="${libs.webui-runtime.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
@ -556,7 +558,7 @@ exists or setup the property manually. For example like this:
<copyfiles files="${libs.jstl11.classpath}" todir="${build.web.dir}/WEB-INF/lib"/> <copyfiles files="${libs.jstl11.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
<mkdir dir="${build.web.dir}/META-INF"/> <mkdir dir="${build.web.dir}/META-INF"/>
<manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update"> <manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update">
<attribute name="Class-Path" value="${manifest.libs.jsf-designtime.classpath} ${manifest.libs.jsfsupport-designtime.classpath} ${manifest.libs.webui-designtime.classpath} ${manifest.libs.jdbcsupport-designtime.classpath} ${manifest.libs.theme-default.classpath} ${manifest.libs.jstl11.classpath} ${manifest.libs.rowset-ri.classpath} ${manifest.file.reference.activation.jar} ${manifest.file.reference.avalon-framework-4.2.0.jar} ${manifest.file.reference.iText-2.0.8.jar} ${manifest.file.reference.batik-all-1.7.jar} ${manifest.file.reference.fop.jar} ${manifest.file.reference.xmlgraphics-commons-1.3.1.jar} ${manifest.file.reference.jai_imageio.jar} ${manifest.file.reference.jdom.jar} ${manifest.file.reference.mail.jar} ${manifest.file.reference.postgresql-8.2-506.jdbc4.jar} ${manifest.file.reference.evolute.jar} ${manifest.file.reference.evologger.jar} ${manifest.file.reference.poi-3.5-beta6-20090622.jar} ${manifest.file.reference.poi-ooxml-3.5-beta6-20090622.jar} ${manifest.file.reference.xalan-2.7.0.jar} ${manifest.file.reference.commons-io-1.4.jar} ${manifest.file.reference.commons-logging-1.1.jar} ${manifest.file.reference.log4j-1.2.15.jar} ${manifest.file.reference.xercesImpl-2.7.1.jar} ${manifest.file.reference.xml-apis-1.3.04.jar} ${manifest.file.reference.xml-apis-ext-1.3.04.jar} ${manifest.file.reference.serializer-2.7.0.jar} ${manifest.file.reference.commons-collections-3.1.jar} ${manifest.file.reference.commons-lang-2.1.jar} "/> <attribute name="Class-Path" value="${manifest.libs.jsf-designtime.classpath} ${manifest.libs.jsfsupport-designtime.classpath} ${manifest.libs.webui-designtime.classpath} ${manifest.libs.jdbcsupport-designtime.classpath} ${manifest.libs.theme-default.classpath} ${manifest.libs.jstl11.classpath} ${manifest.libs.rowset-ri.classpath} ${manifest.file.reference.activation.jar} ${manifest.file.reference.avalon-framework-4.2.0.jar} ${manifest.file.reference.iText-2.0.8.jar} ${manifest.file.reference.batik-all-1.7.jar} ${manifest.file.reference.fop.jar} ${manifest.file.reference.xmlgraphics-commons-1.3.1.jar} ${manifest.file.reference.jai_imageio.jar} ${manifest.file.reference.jdom.jar} ${manifest.file.reference.mail.jar} ${manifest.file.reference.postgresql-8.2-506.jdbc4.jar} ${manifest.file.reference.evolute.jar} ${manifest.file.reference.evologger.jar} ${manifest.file.reference.poi-3.5-beta6-20090622.jar} ${manifest.file.reference.poi-ooxml-3.5-beta6-20090622.jar} ${manifest.file.reference.xalan-2.7.0.jar} ${manifest.file.reference.commons-io-1.4.jar} ${manifest.file.reference.commons-logging-1.1.jar} ${manifest.file.reference.log4j-1.2.15.jar} ${manifest.file.reference.xercesImpl-2.7.1.jar} ${manifest.file.reference.xml-apis-1.3.04.jar} ${manifest.file.reference.xml-apis-ext-1.3.04.jar} ${manifest.file.reference.serializer-2.7.0.jar} ${manifest.file.reference.commons-collections-3.1.jar} ${manifest.file.reference.commons-lang-2.1.jar} ${manifest.file.reference.commons-validator-1.3.1.jar} ${manifest.file.reference.jakarta-oro-2.0.8.jar} "/>
</manifest> </manifest>
</target> </target>
<target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir"> <target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir">
@ -591,6 +593,8 @@ exists or setup the property manually. For example like this:
<copyfiles files="${file.reference.serializer-2.7.0.jar}" todir="${build.web.dir}/WEB-INF/lib"/> <copyfiles files="${file.reference.serializer-2.7.0.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.commons-collections-3.1.jar}" todir="${build.web.dir}/WEB-INF/lib"/> <copyfiles files="${file.reference.commons-collections-3.1.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.commons-lang-2.1.jar}" todir="${build.web.dir}/WEB-INF/lib"/> <copyfiles files="${file.reference.commons-lang-2.1.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.commons-validator-1.3.1.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.jakarta-oro-2.0.8.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${libs.jsf-runtime.classpath}" todir="${build.web.dir}/WEB-INF/lib"/> <copyfiles files="${libs.jsf-runtime.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${libs.jsfsupport-runtime.classpath}" todir="${build.web.dir}/WEB-INF/lib"/> <copyfiles files="${libs.jsfsupport-runtime.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${libs.webui-runtime.classpath}" todir="${build.web.dir}/WEB-INF/lib"/> <copyfiles files="${libs.webui-runtime.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>

@ -1,8 +1,8 @@
build.xml.data.CRC32=2069b7a3 build.xml.data.CRC32=62908cce
build.xml.script.CRC32=97b5d0ef build.xml.script.CRC32=97b5d0ef
build.xml.stylesheet.CRC32=c0ebde35@1.15.2.1 build.xml.stylesheet.CRC32=c0ebde35@1.15.2.1
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=2069b7a3 nbproject/build-impl.xml.data.CRC32=62908cce
nbproject/build-impl.xml.script.CRC32=4c16c504 nbproject/build-impl.xml.script.CRC32=866cdffa
nbproject/build-impl.xml.stylesheet.CRC32=8ab4467e@1.15.2.1 nbproject/build-impl.xml.stylesheet.CRC32=8ab4467e@1.15.2.1

@ -27,11 +27,13 @@ file.reference.commons-collections-3.1.jar=lib/commons-collections-3.1.jar
file.reference.commons-io-1.4.jar=lib/commons-io-1.4.jar file.reference.commons-io-1.4.jar=lib/commons-io-1.4.jar
file.reference.commons-lang-2.1.jar=lib/commons-lang-2.1.jar file.reference.commons-lang-2.1.jar=lib/commons-lang-2.1.jar
file.reference.commons-logging-1.1.jar=lib/commons-logging-1.1.jar file.reference.commons-logging-1.1.jar=lib/commons-logging-1.1.jar
file.reference.commons-validator-1.3.1.jar=lib/commons-validator-1.3.1.jar
file.reference.evologger.jar=lib/evologger.jar file.reference.evologger.jar=lib/evologger.jar
file.reference.evolute.jar=lib/evolute.jar file.reference.evolute.jar=lib/evolute.jar
file.reference.fop.jar=lib/fop.jar file.reference.fop.jar=lib/fop.jar
file.reference.iText-2.0.8.jar=lib/iText-2.0.8.jar file.reference.iText-2.0.8.jar=lib/iText-2.0.8.jar
file.reference.jai_imageio.jar=lib/jai_imageio.jar file.reference.jai_imageio.jar=lib/jai_imageio.jar
file.reference.jakarta-oro-2.0.8.jar=lib/jakarta-oro-2.0.8.jar
file.reference.jdom.jar=lib/jdom.jar file.reference.jdom.jar=lib/jdom.jar
file.reference.log4j-1.2.15.jar=lib/log4j-1.2.15.jar file.reference.log4j-1.2.15.jar=lib/log4j-1.2.15.jar
file.reference.mail.jar=lib/mail.jar file.reference.mail.jar=lib/mail.jar
@ -80,7 +82,9 @@ javac.classpath=\
${file.reference.xml-apis-ext-1.3.04.jar}:\ ${file.reference.xml-apis-ext-1.3.04.jar}:\
${file.reference.serializer-2.7.0.jar}:\ ${file.reference.serializer-2.7.0.jar}:\
${file.reference.commons-collections-3.1.jar}:\ ${file.reference.commons-collections-3.1.jar}:\
${file.reference.commons-lang-2.1.jar} ${file.reference.commons-lang-2.1.jar}:\
${file.reference.commons-validator-1.3.1.jar}:\
${file.reference.jakarta-oro-2.0.8.jar}
# Space-separated list of extra javac options # Space-separated list of extra javac options
javac.compilerargs= javac.compilerargs=
javac.debug=true javac.debug=true

@ -131,6 +131,14 @@
<file>${file.reference.commons-lang-2.1.jar}</file> <file>${file.reference.commons-lang-2.1.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war> <path-in-war>WEB-INF/lib</path-in-war>
</library> </library>
<library>
<file>${file.reference.commons-validator-1.3.1.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<file>${file.reference.jakarta-oro-2.0.8.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
</web-module-libraries> </web-module-libraries>
<web-module-additional-libraries> <web-module-additional-libraries>
<library> <library>

@ -209,12 +209,12 @@ public class Acesso extends AbstractPageBean {
return null; return null;
} }
public String lnkLogout_action() { public String lnkLogout_action()
// TODO: Replace with your code {
FacesContext fc = getFacesContext(); FacesContext fc = getFacesContext();
try try
{ {
JSFUtils.logout(fc); JSFUtils.logout( fc );
} }
catch(Exception ex) catch(Exception ex)
{ {

@ -73,6 +73,7 @@ import javax.mail.*;
import javax.mail.util.ByteArrayDataSource; import javax.mail.util.ByteArrayDataSource;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.apache.commons.validator.EmailValidator;
import pagestate.AnaliseAcidenteTrabalhoState; import pagestate.AnaliseAcidenteTrabalhoState;
import pdf.Pdf; import pdf.Pdf;
import pdf.PdfGenerator; import pdf.PdfGenerator;
@ -6928,20 +6929,28 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
return (ApplicationBean1)getBean("ApplicationBean1"); return (ApplicationBean1)getBean("ApplicationBean1");
} }
public String lnkLogout_action() { public String lnkLogout_action()
{
// TODO: Replace with your code // TODO: Replace with your code
getSessionBean1().setIeBug(true); getSessionBean1().setIeBug( true );
try try
{ {
javax.servlet.http.HttpSession session = javax.servlet.http.HttpSession session =
(javax.servlet.http.HttpSession) getExternalContext().getSession(true); (javax.servlet.http.HttpSession) getExternalContext().getSession( true );
session.invalidate(); session.invalidate();
Utils.doLogout();
} }
catch(Exception ex){} catch ( Exception ex )
{
}
try { try
getExternalContext().redirect("Login.jsp"); {
} catch(Exception e) {} getExternalContext().redirect("Login.jsp");
}
catch( Exception e )
{
}
//return "login"; //return "login";
return null; return null;
} }
@ -10565,9 +10574,17 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
{ {
getSessionBean1().setSubmetido(true); getSessionBean1().setSubmetido(true);
AnaliseAcidente aa = create(a, ac); AnaliseAcidente aa = create(a, ac);
createImagesFolder(aa); createImagesFolder( aa );
sendMailToNextUser(a, new Integer(Global.ESTADO_RH1)); String errorMessage = "";
getSessionBean1().setMsg("A Ficha de An&aacute;lise de Acidente n&#186; " + aa.getAnalise_nr() + " foi enviada para a fase seguinte."); errorMessage += sendMailToNextUser(a, new Integer(Global.ESTADO_RH1));
if ( "".equals( errorMessage.trim() ) )
{
getSessionBean1().setMsg("A Ficha de An&aacute;lise de Acidente n&#186; " + aa.getAnalise_nr() + " foi enviada para a fase seguinte.");
}
else
{
getSessionBean1().setMsg( errorMessage );
}
} }
else else
{ {
@ -10657,19 +10674,28 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
getSessionBean1().setSubmetido(true); getSessionBean1().setSubmetido(true);
update(a, ac, recs, meds); update(a, ac, recs, meds);
//createImagesFolder(analiseId.toString()); //createImagesFolder(analiseId.toString());
updateImagesFolder(a); updateImagesFolder(a);
sendMailToNextUser(a, new Integer(novo_estado)); String errorMessage = "";
//envia email para responsavel hierarquico ao passar da Consolidacao para a Verificacao errorMessage += sendMailToNextUser(a, new Integer( novo_estado ) );
if(a.getEstado().intValue() == Global.ESTADO_ASSINATURA_SEG) //envia email para responsavel hierarquico ao passar da Consolidacao para a Verificacao
{ if ( a.getEstado().intValue() == Global.ESTADO_ASSINATURA_SEG )
sendEmailResponsavelHierarquico(a); {
} errorMessage += sendEmailResponsavelHierarquico( a );
else if(a.getEstado().intValue() == Global.ESTADO_CONCLUIDO) }
{ else if ( a.getEstado().intValue() == Global.ESTADO_CONCLUIDO )
sendEmailFimProcesso(a); {
sendEmailToRhFase4(a); errorMessage += sendEmailFimProcesso( a );
errorMessage += sendEmailToRhFase4( a );
} }
getSessionBean1().setMsg("A Ficha de An&aacute;lise de Acidente n&#186; " + a.getAnalise_nr() + " foi enviada para a fase seguinte.");
if ( "".equals( errorMessage.trim() ) )
{
getSessionBean1().setMsg("A Ficha de An&aacute;lise de Acidente n&#186; " + a.getAnalise_nr() + " foi enviada para a fase seguinte.");
}
else
{
getSessionBean1().setMsg( errorMessage );
}
} }
else else
{ {
@ -14106,8 +14132,10 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
// } // }
// } // }
private void sendMailToNextUser(AnaliseAcidente a, Integer estado) private String sendMailToNextUser( AnaliseAcidente a, Integer estado )
{ {
String errorMessage = "";
Integer tipo = null; Integer tipo = null;
String assunto = "Comunicação de Análise de Acidentes de Trabalho"; String assunto = "Comunicação de Análise de Acidentes de Trabalho";
@ -14167,10 +14195,18 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
try try
{ {
//sendEmail(u.getEmail(), Global.ENDERECO_ENVIO, assunto, texto_email); //sendEmail(u.getEmail(), Global.ENDERECO_ENVIO, assunto, texto_email);
sendEmailWithPdf(a, u.getEmail(), Global.ENDERECO_ENVIO, assunto, texto_email); sendEmailWithPdf( a, u.getEmail(), Global.ENDERECO_ENVIO, assunto, texto_email );
} }
catch(Exception ex1) catch(Exception ex1)
{ {
errorMessage += "Erro a enviar email para " + u.getEmail();
boolean isValid = EmailValidator.getInstance().isValid( u.getEmail() );
if ( ! isValid )
{
errorMessage += " : email inv&aacute;lido.";
}
errorMessage += "<br>";
ErrorLogger.logException( ex1 ); ErrorLogger.logException( ex1 );
System.out.println("MAIL ERROR : " + ex1.getMessage()); System.out.println("MAIL ERROR : " + ex1.getMessage());
} }
@ -14182,10 +14218,13 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
ErrorLogger.logException( ex ); ErrorLogger.logException( ex );
} }
return errorMessage;
} }
private void sendEmailResponsavelHierarquico(AnaliseAcidente a) private String sendEmailResponsavelHierarquico(AnaliseAcidente a)
{ {
String errorMessage = "";
Acidentado ac = getSessionBean1().getAcidentado(); Acidentado ac = getSessionBean1().getAcidentado();
String assunto = "Comunicação de Análise de Acidentes de Trabalho de " + ac.getNome(); String assunto = "Comunicação de Análise de Acidentes de Trabalho de " + ac.getNome();
@ -14208,79 +14247,103 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
texto_email += "<p style='text-align: justify; font-family: arial, sans-serif'>Cumprimentos.</p>"; texto_email += "<p style='text-align: justify; font-family: arial, sans-serif'>Cumprimentos.</p>";
try try
{ {
sendEmailWithPdf(a, ac.getEmail_superior_hierarquico(), Global.ENDERECO_ENVIO, assunto, texto_email ); sendEmailWithPdf( a, ac.getEmail_superior_hierarquico(), Global.ENDERECO_ENVIO, assunto, texto_email );
//sendEmail(ac.getEmail_superior_hierarquico(), Global.ENDERECO_ENVIO, assunto, texto_email); //sendEmail(ac.getEmail_superior_hierarquico(), Global.ENDERECO_ENVIO, assunto, texto_email);
} }
catch(Exception ex) catch(Exception ex)
{ {
errorMessage += "Error a enviar email para " + ac.getEmail_superior_hierarquico();
boolean isValid = EmailValidator.getInstance().isValid( ac.getEmail_superior_hierarquico() );
if ( ! isValid )
{
errorMessage += " : email inv&aacute;lido.";
}
errorMessage += "<br>";
ErrorLogger.logException( ex ); ErrorLogger.logException( ex );
} }
return errorMessage;
} }
private void sendEmailFimProcesso(AnaliseAcidente a) private String sendEmailFimProcesso( AnaliseAcidente a )
{ {
Acidentado ac = getSessionBean1().getAcidentado(); String errorMessage = "";
String assunto = "Fecho do Processo de Análise de Acidente de Trabalho de " + ac.getNome();
UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); Acidentado ac = getSessionBean1().getAcidentado();
ArrayList responsavelRh_list = udp.getResponsavelRhList( a.getEstabelecimento_id() ); String assunto = "Fecho do Processo de Análise de Acidente de Trabalho de " + ac.getNome();
if(responsavelRh_list != null) UtilizadoresDataProvider udp = new UtilizadoresDataProvider();
{ ArrayList responsavelRh_list = udp.getResponsavelRhList(a.getEstabelecimento_id());
ListIterator iter = responsavelRh_list.listIterator(); if (responsavelRh_list != null) {
while(iter.hasNext()) ListIterator iter = responsavelRh_list.listIterator();
{ while (iter.hasNext()) {
Utilizador u = (Utilizador) iter.next(); Utilizador u = (Utilizador) iter.next();
String texto_email = "<p style='text-align: justify; font-family: arial, sans-serif'>Exmo. (a) Senhor(a), " + u.getNome() + "</p>"; String texto_email = "<p style='text-align: justify; font-family: arial, sans-serif'>Exmo. (a) Senhor(a), " + u.getNome() + "</p>";
texto_email += "<p style='text-align: justify; font-family: arial, sans-serif'>Informamos que o processo de an&aacute;lise de acidente de trabalho n&#186; " + a.getAnalise_nr() + " se encontra finalizado, "; texto_email += "<p style='text-align: justify; font-family: arial, sans-serif'>Informamos que o processo de an&aacute;lise de acidente de trabalho n&#186; " + a.getAnalise_nr() + " se encontra finalizado, ";
texto_email += "pelo que solicitamos a sua impress&atilde;o e arquivamento em pasta pr&oacute;pria, juntamente com a participa&ccedil;&atilde;o de sinistro &agrave; seguradora.</p>"; texto_email += "pelo que solicitamos a sua impress&atilde;o e arquivamento em pasta pr&oacute;pria, juntamente com a participa&ccedil;&atilde;o de sinistro &agrave; seguradora.</p>";
texto_email += "<p style='text-align: justify; font-family: arial, sans-serif'>Caso pretenda qualquer esclarecimento, contacte-nos, por favor, atrav&eacute;s de acidentes.auchan@siprp.pt ou pelo telefone 213 504 540.</p>"; texto_email += "<p style='text-align: justify; font-family: arial, sans-serif'>Caso pretenda qualquer esclarecimento, contacte-nos, por favor, atrav&eacute;s de acidentes.auchan@siprp.pt ou pelo telefone 213 504 540.</p>";
texto_email += "<p style='text-align: justify; font-family: arial, sans-serif'>Os melhores cumprimentos.</p>"; texto_email += "<p style='text-align: justify; font-family: arial, sans-serif'>Os melhores cumprimentos.</p>";
texto_email += "<p style='text-align: justify; font-family: arial, sans-serif'>SIPRP </p>"; texto_email += "<p style='text-align: justify; font-family: arial, sans-serif'>SIPRP </p>";
try try
{ {
//sendEmail(u.getEmail(), Global.ENDERECO_ENVIO, assunto, texto_email); //sendEmail(u.getEmail(), Global.ENDERECO_ENVIO, assunto, texto_email);
sendEmailWithPdf(a, u.getEmail(), Global.ENDERECO_ENVIO, assunto, texto_email); sendEmailWithPdf(a, u.getEmail(), Global.ENDERECO_ENVIO, assunto, texto_email);
} }
catch(Exception ex) catch ( Exception ex )
{ {
ErrorLogger.logException( ex ); errorMessage += "Erro a enviar email para " + u.getEmail();
} boolean isValid = EmailValidator.getInstance().isValid( u.getEmail() );
} if ( ! isValid )
} {
} errorMessage += " : email inv&aacute;lido.";
}
errorMessage += "<br>";
ErrorLogger.logException( ex );
}
}
}
return errorMessage;
}
private void sendEmailToRhFase4(AnaliseAcidente a) private String sendEmailToRhFase4(AnaliseAcidente a) {
{ String errorMessage = "";
System.out.println("SEND EMAIL TO RH FASE 4");
Acidentado ac = getSessionBean1().getAcidentado(); System.out.println("SEND EMAIL TO RH FASE 4");
//String assunto = "SIPRP &#175; Fecho do Processo de An&aacute;lise de Acidente de Trabalho n&#186; " + a.getAnalise_nr() + " &#175; Ficheiro para Impress&atilde;o"; Acidentado ac = getSessionBean1().getAcidentado();
String assunto = "SIPRP - Fecho do Processo de Análise de Acidente de Trabalho nº " + a.getAnalise_nr() + " - Ficheiro para Impressão"; //String assunto = "SIPRP &#175; Fecho do Processo de An&aacute;lise de Acidente de Trabalho n&#186; " + a.getAnalise_nr() + " &#175; Ficheiro para Impress&atilde;o";
String assunto = "SIPRP - Fecho do Processo de Análise de Acidente de Trabalho nº " + a.getAnalise_nr() + " - Ficheiro para Impressão";
UtilizadoresDataProvider udp = new UtilizadoresDataProvider();
try UtilizadoresDataProvider udp = new UtilizadoresDataProvider();
{ try {
Utilizador urh = udp.getUtilizador(a.getRh_fase4()); Utilizador urh = udp.getUtilizador(a.getRh_fase4());
String texto_email = "<p style='text-align: justify; font-family: arial, sans-serif'>Exmo. (a) Senhor(a), </p>"; String texto_email = "<p style='text-align: justify; font-family: arial, sans-serif'>Exmo. (a) Senhor(a), </p>";
texto_email += "<p style='text-align: justify; font-family: arial, sans-serif'>Confirmamos que o processo de An&aacute;lise de Acidente de Trabalho n&#186 " + a.getAnalise_nr()+ " se encontra encerrado ap&oacute;s o preenchimento e valida&ccedil;&atilde;o de todos os intervenientes.</p>"; texto_email += "<p style='text-align: justify; font-family: arial, sans-serif'>Confirmamos que o processo de An&aacute;lise de Acidente de Trabalho n&#186 " + a.getAnalise_nr() + " se encontra encerrado ap&oacute;s o preenchimento e valida&ccedil;&atilde;o de todos os intervenientes.</p>";
texto_email += "<p style='text-align: justify; font-family: arial, sans-serif'>Sugerimos que imprima o ficheiro que enviamos em anexo e o junte &agrave; Participa&ccedil;&atilde;o de Sinistro &agrave; Seguradora para dar conhecimento ao M&eacute;dico do Trabalho do seu estabelecimento. Ap&oacute;s o seu conhecimento, aconselhamos que entregue uma c&oacute;pia da Ficha de An&aacute;lise de Acidente de Trabalho &agrave; equipa de Sa&uacute;de Ocupacional, para que esta a arquive no processo cl&iacute;nico do trabalhador antes de juntar toda a documenta&ccedil;&atilde;o no processo individual do colaborador nos Recursos Humanos.</p>"; texto_email += "<p style='text-align: justify; font-family: arial, sans-serif'>Sugerimos que imprima o ficheiro que enviamos em anexo e o junte &agrave; Participa&ccedil;&atilde;o de Sinistro &agrave; Seguradora para dar conhecimento ao M&eacute;dico do Trabalho do seu estabelecimento. Ap&oacute;s o seu conhecimento, aconselhamos que entregue uma c&oacute;pia da Ficha de An&aacute;lise de Acidente de Trabalho &agrave; equipa de Sa&uacute;de Ocupacional, para que esta a arquive no processo cl&iacute;nico do trabalhador antes de juntar toda a documenta&ccedil;&atilde;o no processo individual do colaborador nos Recursos Humanos.</p>";
texto_email += "<p style='text-align: justify; font-family: arial, sans-serif'>Agradecemos a sua colabora&ccedil;&atilde;o e ficamos ao dispor para qualquer esclarecimento atrav&eacute;s dos telefones 213 504 544 (Catarina Leonardo) ou 213 504 542 (S&oacute;nia Campos).</p>"; texto_email += "<p style='text-align: justify; font-family: arial, sans-serif'>Agradecemos a sua colabora&ccedil;&atilde;o e ficamos ao dispor para qualquer esclarecimento atrav&eacute;s dos telefones 213 504 544 (Catarina Leonardo) ou 213 504 542 (S&oacute;nia Campos).</p>";
texto_email += "<p style='text-align: justify; font-family: arial, sans-serif'>Os melhores cumprimentos,</p>"; texto_email += "<p style='text-align: justify; font-family: arial, sans-serif'>Os melhores cumprimentos,</p>";
texto_email += "<p style='text-align: justify; font-family: arial, sans-serif'>A equipa da SIPRP</p>"; texto_email += "<p style='text-align: justify; font-family: arial, sans-serif'>A equipa da SIPRP</p>";
try try
{ {
sendEmailWithPdf(a, urh.getEmail(), Global.ENDERECO_ENVIO, assunto, texto_email); sendEmailWithPdf(a, urh.getEmail(), Global.ENDERECO_ENVIO, assunto, texto_email);
} }
catch(Exception ex) catch (Exception ex)
{ {
ErrorLogger.logException( ex ); errorMessage += "Erro a enviar email para " + urh.getEmail();
System.out.println("EMAIL FASE 4 ERROR : " + ex.getMessage()); boolean isValid = EmailValidator.getInstance().isValid( urh.getEmail() );
} if ( ! isValid )
} {
catch(Exception ex) errorMessage += " : email inv&aacute;lido.";
{ }
ErrorLogger.logException( ex ); errorMessage += "<br>";
} ErrorLogger.logException(ex);
System.out.println("EMAIL FASE 4 ERROR : " + ex.getMessage());
}
} catch (Exception ex) {
ErrorLogger.logException(ex);
}
} return errorMessage;
}
// private void sendEmail(String emailTo, String emailFrom, String assunto, String texto_email) throws Exception // private void sendEmail(String emailTo, String emailFrom, String assunto, String texto_email) throws Exception
// { // {

@ -9,27 +9,17 @@ package analiseacidentestrabalho;
import com.sun.rave.web.ui.appbase.AbstractPageBean; import com.sun.rave.web.ui.appbase.AbstractPageBean;
import com.sun.rave.web.ui.component.Body; import com.sun.rave.web.ui.component.Body;
import com.sun.rave.web.ui.component.Button;
import com.sun.rave.web.ui.component.Form; import com.sun.rave.web.ui.component.Form;
import com.sun.rave.web.ui.component.Head; import com.sun.rave.web.ui.component.Head;
import com.sun.rave.web.ui.component.HiddenField; import com.sun.rave.web.ui.component.HiddenField;
import com.sun.rave.web.ui.component.Html; 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.Link;
import com.sun.rave.web.ui.component.Page; import com.sun.rave.web.ui.component.Page;
import com.sun.rave.web.ui.component.PanelGroup;
import com.sun.rave.web.ui.component.StaticText;
import com.sun.rave.web.ui.model.SingleSelectOptionsList; import com.sun.rave.web.ui.model.SingleSelectOptionsList;
import global.Global;
import java.io.File;
import java.util.Calendar;
import java.util.GregorianCalendar;
import javax.faces.FacesException; import javax.faces.FacesException;
import javax.faces.component.html.HtmlPanelGrid;
import javax.faces.event.ActionEvent; import javax.faces.event.ActionEvent;
import javax.faces.event.ValueChangeEvent; import javax.faces.event.ValueChangeEvent;
import javax.servlet.ServletContext; import utils.Utils;
/** /**
* <p>Page bean that corresponds to a similarly named JSP page. This * <p>Page bean that corresponds to a similarly named JSP page. This
@ -311,7 +301,7 @@ public class Dummy extends AbstractPageBean {
public String lnkLogout_action() { public String lnkLogout_action() {
// TODO: Replace with your code // TODO: Replace with your code
Utils.doLogout();
return null; return null;
} }

@ -32,6 +32,7 @@ import java.util.ArrayList;
import javax.faces.FacesException; import javax.faces.FacesException;
import javax.faces.component.html.HtmlPanelGrid; import javax.faces.component.html.HtmlPanelGrid;
import javax.faces.event.ValueChangeEvent; import javax.faces.event.ValueChangeEvent;
import utils.Utils;
/** /**
* <p>Page bean that corresponds to a similarly named JSP page. This * <p>Page bean that corresponds to a similarly named JSP page. This
@ -480,19 +481,27 @@ public class EnviarCorrecao extends AbstractPageBean {
return null; return null;
} }
public String lnkLogout_action() { public String lnkLogout_action()
// TODO: Replace with your code {
try try
{ {
javax.servlet.http.HttpSession session = javax.servlet.http.HttpSession session =
(javax.servlet.http.HttpSession) getExternalContext().getSession(true); (javax.servlet.http.HttpSession) getExternalContext().getSession(true);
session.invalidate(); session.invalidate();
Utils.doLogout();
} }
catch(Exception ex){} catch ( Exception ex )
try { {
getExternalContext().redirect("Login.jsp");
} catch(Exception e) {} }
try
{
getExternalContext().redirect( "Login.jsp" );
}
catch ( Exception e )
{
}
//return "login"; //return "login";
return null; return null;
} }

@ -34,6 +34,7 @@ import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import utils.Utils;
/** /**
* *
@ -385,6 +386,7 @@ public class EstatisticasProcesso extends AbstractPageBean
{ {
javax.servlet.http.HttpSession session = ( javax.servlet.http.HttpSession ) getExternalContext().getSession( true ); javax.servlet.http.HttpSession session = ( javax.servlet.http.HttpSession ) getExternalContext().getSession( true );
session.invalidate(); session.invalidate();
Utils.doLogout();
} }
catch( Exception ex ) catch( Exception ex )
{} {}

@ -977,19 +977,23 @@ public class FichaUtilizador extends AbstractPageBean {
return null; return null;
} }
public String lnkLogout_action() { public String lnkLogout_action()
// TODO: Replace with your code {
try try
{ {
javax.servlet.http.HttpSession session = javax.servlet.http.HttpSession session =
(javax.servlet.http.HttpSession) getExternalContext().getSession(true); (javax.servlet.http.HttpSession) getExternalContext().getSession(true);
session.invalidate(); session.invalidate();
Utils.doLogout();
} }
catch(Exception ex){} catch ( Exception ex )
{
}
try try
{ {
getExternalContext().redirect("Login.jsp"); getExternalContext().redirect( "Login.jsp" );
} }
catch ( Exception e ) catch ( Exception e )
{ {

@ -1090,14 +1090,14 @@ public class FormDirGerRh extends AbstractPageBean {
return "user"; return "user";
} }
public String lnkLogout_action() { public String lnkLogout_action()
// TODO: Replace with your code {
try try
{ {
javax.servlet.http.HttpSession session = javax.servlet.http.HttpSession session =
(javax.servlet.http.HttpSession) getExternalContext().getSession(true); (javax.servlet.http.HttpSession) getExternalContext().getSession(true);
session.invalidate(); session.invalidate();
Utils.doLogout();
} }
catch(Exception ex) catch(Exception ex)
{ {

@ -1101,14 +1101,14 @@ public class FormDirSiprp extends AbstractPageBean {
return "user"; return "user";
} }
public String lnkLogout_action() { public String lnkLogout_action()
// TODO: Replace with your code {
try try
{ {
javax.servlet.http.HttpSession session = javax.servlet.http.HttpSession session =
(javax.servlet.http.HttpSession) getExternalContext().getSession(true); (javax.servlet.http.HttpSession) getExternalContext().getSession(true);
session.invalidate(); session.invalidate();
Utils.doLogout();
} }
catch(Exception ex) catch(Exception ex)
{ {

@ -1158,14 +1158,14 @@ public class FormGestor extends AbstractPageBean {
} }
public String lnkLogout_action() { public String lnkLogout_action()
// TODO: Replace with your code {
try try
{ {
javax.servlet.http.HttpSession session = javax.servlet.http.HttpSession session =
(javax.servlet.http.HttpSession) getExternalContext().getSession(true); (javax.servlet.http.HttpSession) getExternalContext().getSession(true);
session.invalidate(); session.invalidate();
Utils.doLogout();
} }
catch(Exception ex) catch(Exception ex)
{ {

@ -1410,14 +1410,14 @@ public class FormHS extends AbstractPageBean {
return (RequestBean1)getBean("RequestBean1"); return (RequestBean1)getBean("RequestBean1");
} }
public String lnkLogout_action() { public String lnkLogout_action()
// TODO: Replace with your code {
try try
{ {
javax.servlet.http.HttpSession session = javax.servlet.http.HttpSession session =
(javax.servlet.http.HttpSession) getExternalContext().getSession(true); (javax.servlet.http.HttpSession) getExternalContext().getSession(true);
session.invalidate(); session.invalidate();
Utils.doLogout();
} }
catch(Exception ex) catch(Exception ex)
{ {

@ -1327,14 +1327,14 @@ public class FormMedico extends AbstractPageBean {
return "user"; return "user";
} }
public String lnkLogout_action() { public String lnkLogout_action()
// TODO: Replace with your code {
try try
{ {
javax.servlet.http.HttpSession session = javax.servlet.http.HttpSession session =
(javax.servlet.http.HttpSession) getExternalContext().getSession(true); (javax.servlet.http.HttpSession) getExternalContext().getSession(true);
session.invalidate(); session.invalidate();
Utils.doLogout();
} }
catch(Exception ex) catch(Exception ex)
{ {

@ -1381,29 +1381,29 @@ public class FormRH extends AbstractPageBean {
return (ApplicationBean1)getBean("ApplicationBean1"); return (ApplicationBean1)getBean("ApplicationBean1");
} }
public String lnkLogout_action() { public String lnkLogout_action()
// TODO: Replace with your code {
try try
{ {
javax.servlet.http.HttpSession session = javax.servlet.http.HttpSession session =
(javax.servlet.http.HttpSession) getExternalContext().getSession(true); (javax.servlet.http.HttpSession) getExternalContext().getSession(true);
session.invalidate(); session.invalidate();
Utils.doLogout();
} }
catch(Exception ex) catch ( Exception ex )
{ {
ErrorLogger.logException( ex ); ErrorLogger.logException( ex );
} }
try try
{ {
getExternalContext().redirect("Login.jsp"); getExternalContext().redirect( "Login.jsp" );
} }
catch ( Exception e ) catch ( Exception e )
{ {
ErrorLogger.logException( e ); ErrorLogger.logException( e );
} }
//return "login"; //return "login";
return null; return null;
} }

@ -1522,14 +1522,14 @@ public class FormSeguranca extends AbstractPageBean {
return (ApplicationBean1)getBean("ApplicationBean1"); return (ApplicationBean1)getBean("ApplicationBean1");
} }
public String lnkLogout_action() { public String lnkLogout_action()
// TODO: Replace with your code {
// Invalidate the current session
try try
{ {
javax.servlet.http.HttpSession session = javax.servlet.http.HttpSession session =
(javax.servlet.http.HttpSession) getExternalContext().getSession(true); (javax.servlet.http.HttpSession) getExternalContext().getSession(true);
session.invalidate(); session.invalidate();
Utils.doLogout();
} }
catch(Exception ex) catch(Exception ex)
{ {

@ -890,15 +890,16 @@ public class GestaoUtilizadores extends AbstractPageBean {
return "user"; return "user";
} }
public String lnkLogout_action() { public String lnkLogout_action()
// TODO: Replace with your code {
javax.servlet.http.HttpSession session = javax.servlet.http.HttpSession session =
(javax.servlet.http.HttpSession) getExternalContext().getSession(true); (javax.servlet.http.HttpSession) getExternalContext().getSession( true );
session.invalidate(); session.invalidate();
Utils.doLogout();
try try
{ {
getExternalContext().redirect("Login.jsp"); getExternalContext().redirect( "Login.jsp" );
} }
catch ( Exception e ) catch ( Exception e )
{ {

@ -7,9 +7,8 @@
package analiseacidentestrabalho; package analiseacidentestrabalho;
import com.sun.rave.web.ui.appbase.AbstractFragmentBean; import com.sun.rave.web.ui.appbase.AbstractFragmentBean;
import com.sun.rave.web.ui.component.StaticText;
import javax.faces.FacesException; import javax.faces.FacesException;
import javax.faces.component.html.HtmlPanelGrid; import utils.Utils;
/** /**
* <p>Fragment bean that corresponds to a similarly named JSP page * <p>Fragment bean that corresponds to a similarly named JSP page
@ -123,8 +122,9 @@ public class Header extends AbstractFragmentBean {
return null; return null;
} }
public String lnkLogout_action() { public String lnkLogout_action()
// TODO: Replace with your code {
Utils.doLogout();
return null; return null;
} }
} }

@ -24,6 +24,7 @@ import java.io.File;
import javax.faces.FacesException; import javax.faces.FacesException;
import javax.faces.component.html.HtmlPanelGrid; import javax.faces.component.html.HtmlPanelGrid;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import utils.Utils;
/** /**
* <p>Page bean that corresponds to a similarly named JSP page. This * <p>Page bean that corresponds to a similarly named JSP page. This
@ -332,9 +333,9 @@ public class LoadImage extends AbstractPageBean {
return (SessionBean1)getBean("SessionBean1"); return (SessionBean1)getBean("SessionBean1");
} }
public String lnkLogout_action() { public String lnkLogout_action()
// TODO: Replace with your code {
Utils.doLogout();
return null; return null;
} }

@ -29,6 +29,7 @@ import java.util.Calendar;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import javax.faces.FacesException; import javax.faces.FacesException;
import javax.faces.component.html.HtmlPanelGrid; import javax.faces.component.html.HtmlPanelGrid;
import utils.Utils;
/** /**
* <p>Page bean that corresponds to a similarly named JSP page. This * <p>Page bean that corresponds to a similarly named JSP page. This
@ -368,6 +369,8 @@ public class Login extends AbstractPageBean {
{ {
//if(u.getOwner_id().intValue() == 0 ) //if(u.getOwner_id().intValue() == 0 )
Utils.doLogin( u );
//Login Ok ! //Login Ok !
// if(u.getPrimeiro_login().matches("y") || mustChangePassword(u)) // if(u.getPrimeiro_login().matches("y") || mustChangePassword(u))
if(u.getPrimeiro_login().matches("y") ) if(u.getPrimeiro_login().matches("y") )

@ -1191,20 +1191,28 @@ public class NovoUtilizador extends AbstractPageBean {
} }
public String lnkLogout_action() { public String lnkLogout_action()
// TODO: Replace with your code {
try try
{ {
javax.servlet.http.HttpSession session = javax.servlet.http.HttpSession session =
(javax.servlet.http.HttpSession) getExternalContext().getSession(true); (javax.servlet.http.HttpSession) getExternalContext().getSession(true);
session.invalidate(); session.invalidate();
Utils.doLogout();
} }
catch(Exception ex){} catch ( Exception ex )
{
try { }
getExternalContext().redirect("Login.jsp");
} catch(Exception e) {} try
{
getExternalContext().redirect( "Login.jsp" );
}
catch ( Exception e )
{
}
//return "login"; //return "login";
return null; return null;

@ -904,20 +904,21 @@ public class UtilizadorFields extends AbstractPageBean {
return null; return null;
} }
public String lnkLogout_action() { public String lnkLogout_action()
// TODO: Replace with your code {
try try
{ {
javax.servlet.http.HttpSession session = javax.servlet.http.HttpSession session =
(javax.servlet.http.HttpSession) getExternalContext().getSession(true); (javax.servlet.http.HttpSession) getExternalContext().getSession(true);
session.invalidate(); session.invalidate();
Utils.doLogout();
} }
catch(Exception ex) catch(Exception ex)
{ {
ErrorLogger.logException( ex ); ErrorLogger.logException( ex );
} }
try { try
{
getExternalContext().redirect("Login.jsp"); getExternalContext().redirect("Login.jsp");
} }
catch(Exception e) catch(Exception e)

@ -2292,27 +2292,29 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean {
return (ApplicationBean1)getBean("ApplicationBean1"); return (ApplicationBean1)getBean("ApplicationBean1");
} }
public String lnkLogout_action() { public String lnkLogout_action()
// TODO: Replace with your code {
if ( getSessionBean1().isLoggedIn() )
if (getSessionBean1().isLoggedIn()) { {
// try {
// getExternalContext().redirect("Login.jsp");
// } catch(Exception e) {}
try try
{ {
javax.servlet.http.HttpSession session = javax.servlet.http.HttpSession session =
(javax.servlet.http.HttpSession) getExternalContext().getSession(true); (javax.servlet.http.HttpSession) getExternalContext().getSession(true);
session.invalidate(); session.invalidate();
Utils.doLogout();
} }
catch(Exception ex){} catch ( Exception ex )
{
} }
}
try { try
getExternalContext().redirect("Login.jsp"); {
} catch(Exception e) {} getExternalContext().redirect( "Login.jsp" );
}
catch ( Exception e )
{
}
//return "login"; //return "login";
return null; return null;
} }

@ -9,11 +9,14 @@
package beans; package beans;
import java.io.Serializable;
/** /**
* *
* @author lluis * @author lluis
*/ */
public class Acidentado { public class Acidentado implements Serializable
{
private Integer id; private Integer id;
private String nome; private String nome;
private java.sql.Date data_nascimento; private java.sql.Date data_nascimento;

@ -23,7 +23,7 @@ import javax.servlet.http.HttpSession;
*/ */
public class Db public class Db
{ {
// String connectionURL = "jdbc:postgresql://evoserver:5432/siprp_20100629"; //testes // String connectionURL = "jdbc:postgresql://evoserver:5432/siprp_20100813"; //testes
String connectionURL = "jdbc:postgresql://localhost:5436/siprp"; //real String connectionURL = "jdbc:postgresql://localhost:5436/siprp"; //real
String User = "postgres"; String User = "postgres";

@ -23,7 +23,7 @@ import javax.servlet.http.HttpSession;
*/ */
public class Dblocal public class Dblocal
{ {
// String connectionURL = "jdbc:postgresql://evoserver:5432/siprp_local_3_20100713"; //testes // String connectionURL = "jdbc:postgresql://evoserver:5432/siprp_local_3_20100813"; //testes
String connectionURL = "jdbc:postgresql://localhost:5436/siprp_local_3"; String connectionURL = "jdbc:postgresql://localhost:5436/siprp_local_3";
String User = "postgres"; String User = "postgres";

@ -94,6 +94,7 @@ public class JSFUtils {
ExternalContext ectx = fc.getCurrentInstance().getExternalContext(); ExternalContext ectx = fc.getCurrentInstance().getExternalContext();
HttpSession session = (HttpSession) ectx.getSession(false); HttpSession session = (HttpSession) ectx.getSession(false);
session.invalidate(); session.invalidate();
Utils.doLogout();
} }
public static void navigateTo(FacesContext fc, String outcome) public static void navigateTo(FacesContext fc, String outcome)

@ -9,6 +9,9 @@
package utils; package utils;
import beans.Utilizador;
import com.evolute.utils.Singleton;
import com.evolute.utils.error.ErrorLogger;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
@ -381,5 +384,23 @@ public class Utils {
Date date = (Date)formatter.parse(ttime); Date date = (Date)formatter.parse(ttime);
return formatter.format(date); return formatter.format(date);
} }
public static void doLogin( Utilizador u )
{
if ( u != null )
{
Singleton.setInstance( Singleton.USERNAME, u.getLogin() );
}
else
{
ErrorLogger.logException( new Exception( "Utils.doLogin() : Utilizador is null !" ) );
}
}
public static void doLogout()
{
Singleton.setInstance( Singleton.USERNAME, null );
}
} }

Loading…
Cancel
Save