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.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-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.jsfsupport-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"/>
<mkdir dir="${build.web.dir}/META-INF"/>
<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>
</target>
<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.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-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.jsfsupport-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.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.
# 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.script.CRC32=4c16c504
nbproject/build-impl.xml.data.CRC32=62908cce
nbproject/build-impl.xml.script.CRC32=866cdffa
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-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-validator-1.3.1.jar=lib/commons-validator-1.3.1.jar
file.reference.evologger.jar=lib/evologger.jar
file.reference.evolute.jar=lib/evolute.jar
file.reference.fop.jar=lib/fop.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.jakarta-oro-2.0.8.jar=lib/jakarta-oro-2.0.8.jar
file.reference.jdom.jar=lib/jdom.jar
file.reference.log4j-1.2.15.jar=lib/log4j-1.2.15.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.serializer-2.7.0.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
javac.compilerargs=
javac.debug=true

@ -131,6 +131,14 @@
<file>${file.reference.commons-lang-2.1.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</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-additional-libraries>
<library>

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

@ -73,6 +73,7 @@ import javax.mail.*;
import javax.mail.util.ByteArrayDataSource;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.validator.EmailValidator;
import pagestate.AnaliseAcidenteTrabalhoState;
import pdf.Pdf;
import pdf.PdfGenerator;
@ -6928,20 +6929,28 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
return (ApplicationBean1)getBean("ApplicationBean1");
}
public String lnkLogout_action() {
public String lnkLogout_action()
{
// TODO: Replace with your code
getSessionBean1().setIeBug(true);
getSessionBean1().setIeBug( true );
try
{
javax.servlet.http.HttpSession session =
(javax.servlet.http.HttpSession) getExternalContext().getSession(true);
(javax.servlet.http.HttpSession) getExternalContext().getSession( true );
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 null;
}
@ -10565,9 +10574,17 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
{
getSessionBean1().setSubmetido(true);
AnaliseAcidente aa = create(a, ac);
createImagesFolder(aa);
sendMailToNextUser(a, new Integer(Global.ESTADO_RH1));
getSessionBean1().setMsg("A Ficha de An&aacute;lise de Acidente n&#186; " + aa.getAnalise_nr() + " foi enviada para a fase seguinte.");
createImagesFolder( aa );
String errorMessage = "";
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
{
@ -10658,18 +10675,27 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
update(a, ac, recs, meds);
//createImagesFolder(analiseId.toString());
updateImagesFolder(a);
sendMailToNextUser(a, new Integer(novo_estado));
//envia email para responsavel hierarquico ao passar da Consolidacao para a Verificacao
if(a.getEstado().intValue() == Global.ESTADO_ASSINATURA_SEG)
{
sendEmailResponsavelHierarquico(a);
}
else if(a.getEstado().intValue() == Global.ESTADO_CONCLUIDO)
{
sendEmailFimProcesso(a);
sendEmailToRhFase4(a);
String errorMessage = "";
errorMessage += sendMailToNextUser(a, new Integer( novo_estado ) );
//envia email para responsavel hierarquico ao passar da Consolidacao para a Verificacao
if ( a.getEstado().intValue() == Global.ESTADO_ASSINATURA_SEG )
{
errorMessage += sendEmailResponsavelHierarquico( a );
}
else if ( a.getEstado().intValue() == Global.ESTADO_CONCLUIDO )
{
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
{
@ -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;
String assunto = "Comunicação de Análise de Acidentes de Trabalho";
@ -14167,10 +14195,18 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
try
{
//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)
{
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 );
System.out.println("MAIL ERROR : " + ex1.getMessage());
}
@ -14182,10 +14218,13 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
ErrorLogger.logException( ex );
}
return errorMessage;
}
private void sendEmailResponsavelHierarquico(AnaliseAcidente a)
{
private String sendEmailResponsavelHierarquico(AnaliseAcidente a)
{
String errorMessage = "";
Acidentado ac = getSessionBean1().getAcidentado();
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>";
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);
}
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 );
}
return errorMessage;
}
private void sendEmailFimProcesso(AnaliseAcidente a)
{
Acidentado ac = getSessionBean1().getAcidentado();
String assunto = "Fecho do Processo de Análise de Acidente de Trabalho de " + ac.getNome();
UtilizadoresDataProvider udp = new UtilizadoresDataProvider();
ArrayList responsavelRh_list = udp.getResponsavelRhList( a.getEstabelecimento_id() );
if(responsavelRh_list != null)
{
ListIterator iter = responsavelRh_list.listIterator();
while(iter.hasNext())
{
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>";
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 += "<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'>SIPRP </p>";
try
{
//sendEmail(u.getEmail(), Global.ENDERECO_ENVIO, assunto, texto_email);
private String sendEmailFimProcesso( AnaliseAcidente a )
{
String errorMessage = "";
Acidentado ac = getSessionBean1().getAcidentado();
String assunto = "Fecho do Processo de Análise de Acidente de Trabalho de " + ac.getNome();
UtilizadoresDataProvider udp = new UtilizadoresDataProvider();
ArrayList responsavelRh_list = udp.getResponsavelRhList(a.getEstabelecimento_id());
if (responsavelRh_list != null) {
ListIterator iter = responsavelRh_list.listIterator();
while (iter.hasNext()) {
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>";
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 += "<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'>SIPRP </p>";
try
{
//sendEmail(u.getEmail(), Global.ENDERECO_ENVIO, assunto, texto_email);
sendEmailWithPdf(a, u.getEmail(), Global.ENDERECO_ENVIO, assunto, texto_email);
}
catch(Exception ex)
{
ErrorLogger.logException( ex );
}
}
}
}
}
catch ( Exception 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 );
}
}
}
private void sendEmailToRhFase4(AnaliseAcidente a)
{
System.out.println("SEND EMAIL TO RH FASE 4");
Acidentado ac = getSessionBean1().getAcidentado();
//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";
return errorMessage;
}
UtilizadoresDataProvider udp = new UtilizadoresDataProvider();
try
{
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>";
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'>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'>A equipa da SIPRP</p>";
try
{
sendEmailWithPdf(a, urh.getEmail(), Global.ENDERECO_ENVIO, assunto, texto_email);
}
catch(Exception ex)
{
ErrorLogger.logException( ex );
System.out.println("EMAIL FASE 4 ERROR : " + ex.getMessage());
}
}
catch(Exception ex)
{
ErrorLogger.logException( ex );
}
private String sendEmailToRhFase4(AnaliseAcidente a) {
String errorMessage = "";
System.out.println("SEND EMAIL TO RH FASE 4");
Acidentado ac = getSessionBean1().getAcidentado();
//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 {
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>";
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'>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'>A equipa da SIPRP</p>";
try
{
sendEmailWithPdf(a, urh.getEmail(), Global.ENDERECO_ENVIO, assunto, texto_email);
}
catch (Exception ex)
{
errorMessage += "Erro a enviar email para " + urh.getEmail();
boolean isValid = EmailValidator.getInstance().isValid( urh.getEmail() );
if ( ! isValid )
{
errorMessage += " : email inv&aacute;lido.";
}
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
// {

@ -9,27 +9,17 @@ package analiseacidentestrabalho;
import com.sun.rave.web.ui.appbase.AbstractPageBean;
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.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;
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 global.Global;
import java.io.File;
import java.util.Calendar;
import java.util.GregorianCalendar;
import javax.faces.FacesException;
import javax.faces.component.html.HtmlPanelGrid;
import javax.faces.event.ActionEvent;
import javax.faces.event.ValueChangeEvent;
import javax.servlet.ServletContext;
import utils.Utils;
/**
* <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() {
// TODO: Replace with your code
Utils.doLogout();
return null;
}

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

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

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

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

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

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

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

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

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

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

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

@ -24,6 +24,7 @@ import java.io.File;
import javax.faces.FacesException;
import javax.faces.component.html.HtmlPanelGrid;
import javax.servlet.ServletContext;
import utils.Utils;
/**
* <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");
}
public String lnkLogout_action() {
// TODO: Replace with your code
public String lnkLogout_action()
{
Utils.doLogout();
return null;
}

@ -29,6 +29,7 @@ import java.util.Calendar;
import java.util.GregorianCalendar;
import javax.faces.FacesException;
import javax.faces.component.html.HtmlPanelGrid;
import utils.Utils;
/**
* <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 )
Utils.doLogin( u );
//Login Ok !
// if(u.getPrimeiro_login().matches("y") || mustChangePassword(u))
if(u.getPrimeiro_login().matches("y") )

@ -1191,20 +1191,28 @@ public class NovoUtilizador extends AbstractPageBean {
}
public String lnkLogout_action() {
// TODO: Replace with your code
public String lnkLogout_action()
{
try
{
javax.servlet.http.HttpSession session =
(javax.servlet.http.HttpSession) getExternalContext().getSession(true);
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 null;

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

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

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

@ -23,7 +23,7 @@ import javax.servlet.http.HttpSession;
*/
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 User = "postgres";

@ -23,7 +23,7 @@ import javax.servlet.http.HttpSession;
*/
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 User = "postgres";

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

@ -9,6 +9,9 @@
package utils;
import beans.Utilizador;
import com.evolute.utils.Singleton;
import com.evolute.utils.error.ErrorLogger;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
@ -382,4 +385,22 @@ public class Utils {
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