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

lxbfYeaa
Diogo Neves 14 years ago
parent c616c936be
commit 68eff15d48

Binary file not shown.

@ -564,13 +564,13 @@ exists or setup the property manually. For example like this:
<copyfiles files="${file.reference.richfaces-api-3.3.3.Final.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.richfaces-api-3.3.3.Final.jar" todir="${dist.ear.dir}"/>
<copyfiles files="${file.reference.richfaces-impl-3.3.3.Final.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.richfaces-impl-3.3.3.Final.jar" todir="${dist.ear.dir}"/>
<copyfiles files="${file.reference.richfaces-ui-3.3.3.Final.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.richfaces-ui-3.3.3.Final.jar" todir="${dist.ear.dir}"/>
<copyfiles files="${file.reference.oro-2.0.8.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.oro-2.0.8.jar" todir="${dist.ear.dir}"/>
<copyfiles files="${file.reference.tomahawk12-1.1.10.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.tomahawk12-1.1.10.jar" todir="${dist.ear.dir}"/>
<copyfiles files="${file.reference.commons-el-1.0.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.commons-el-1.0.jar" todir="${dist.ear.dir}"/>
<copyfiles files="${file.reference.tomahawk-1.1.10.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.tomahawk-1.1.10.jar" todir="${dist.ear.dir}"/>
<copyfiles files="${file.reference.xmlParserAPIs-2.0.2.jar}" iftldtodir="${build.web.dir}/WEB-INF" manifestproperty="manifest.file.reference.xmlParserAPIs-2.0.2.jar" todir="${dist.ear.dir}"/>
<copyfiles files="${libs.exceptionhandler-runtime.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.jsf12.classpath} ${manifest.libs.jstl11.classpath} ${manifest.libs.jsf12-support.classpath} ${manifest.libs.woodstock-components.classpath} ${manifest.libs.woodstock-theme-default.classpath} ${manifest.file.reference.activation.jar} ${manifest.file.reference.ashwood-2.0.jar} ${manifest.file.reference.avalon-framework-4.2.0.jar} ${manifest.file.reference.batik-all-1.7.jar} ${manifest.file.reference.commons-beanutils-1.8.3.jar} ${manifest.file.reference.commons-codec-1.3.jar} ${manifest.file.reference.commons-collections-3.1.jar} ${manifest.file.reference.commons-digester-1.8.jar} ${manifest.file.reference.commons-fileupload-1.2.1.jar} ${manifest.file.reference.commons-httpclient-3.1.jar} ${manifest.file.reference.commons-io-1.4.jar} ${manifest.file.reference.commons-lang-2.4.jar} ${manifest.file.reference.commons-logging-1.1.1.jar} ${manifest.file.reference.commons-validator-1.3.1.jar} ${manifest.file.reference.cursos.jar} ${manifest.file.reference.dom4j-1.6.1.jar} ${manifest.file.reference.evologger.jar} ${manifest.file.reference.evolute.jar} ${manifest.file.reference.fop.jar} ${manifest.file.reference.jai_imageio.jar} ${manifest.file.reference.jdbcappender.jar} ${manifest.file.reference.jdom.jar} ${manifest.file.reference.log4j-1.2.15.jar} ${manifest.file.reference.mail.jar-1} ${manifest.file.reference.org.springframework.beans-3.0.0.jar} ${manifest.file.reference.org.springframework.context-3.0.0.jar} ${manifest.file.reference.org.springframework.core-3.0.0.jar} ${manifest.file.reference.postgresql-9.0-801.jdbc4.jar} ${manifest.file.reference.serializer-2.7.0.jar} ${manifest.file.reference.shst.jar} ${manifest.file.reference.spring-ws-core-1.5.9.jar} ${manifest.file.reference.spring-ws-core-tiger-1.5.9.jar} ${manifest.file.reference.spring-ws-support-1.5.9.jar} ${manifest.file.reference.spring-xml-1.5.9.jar} ${manifest.file.reference.truelicense.jar} ${manifest.file.reference.xalan-2.7.0.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.xmlgraphics-commons-1.3.1.jar} ${manifest.file.reference.richfaces-api-3.3.3.Final.jar} ${manifest.file.reference.richfaces-impl-3.3.3.Final.jar} ${manifest.file.reference.richfaces-ui-3.3.3.Final.jar} ${manifest.file.reference.oro-2.0.8.jar} ${manifest.file.reference.tomahawk12-1.1.10.jar} ${manifest.file.reference.xmlParserAPIs-2.0.2.jar} "/>
<attribute name="Class-Path" value="${manifest.libs.jsf12.classpath} ${manifest.libs.jstl11.classpath} ${manifest.libs.jsf12-support.classpath} ${manifest.libs.woodstock-components.classpath} ${manifest.libs.woodstock-theme-default.classpath} ${manifest.file.reference.activation.jar} ${manifest.file.reference.ashwood-2.0.jar} ${manifest.file.reference.avalon-framework-4.2.0.jar} ${manifest.file.reference.batik-all-1.7.jar} ${manifest.file.reference.commons-beanutils-1.8.3.jar} ${manifest.file.reference.commons-codec-1.3.jar} ${manifest.file.reference.commons-collections-3.1.jar} ${manifest.file.reference.commons-digester-1.8.jar} ${manifest.file.reference.commons-fileupload-1.2.1.jar} ${manifest.file.reference.commons-httpclient-3.1.jar} ${manifest.file.reference.commons-io-1.4.jar} ${manifest.file.reference.commons-lang-2.4.jar} ${manifest.file.reference.commons-logging-1.1.1.jar} ${manifest.file.reference.commons-validator-1.3.1.jar} ${manifest.file.reference.cursos.jar} ${manifest.file.reference.dom4j-1.6.1.jar} ${manifest.file.reference.evologger.jar} ${manifest.file.reference.evolute.jar} ${manifest.file.reference.fop.jar} ${manifest.file.reference.jai_imageio.jar} ${manifest.file.reference.jdbcappender.jar} ${manifest.file.reference.jdom.jar} ${manifest.file.reference.log4j-1.2.15.jar} ${manifest.file.reference.mail.jar-1} ${manifest.file.reference.org.springframework.beans-3.0.0.jar} ${manifest.file.reference.org.springframework.context-3.0.0.jar} ${manifest.file.reference.org.springframework.core-3.0.0.jar} ${manifest.file.reference.postgresql-9.0-801.jdbc4.jar} ${manifest.file.reference.serializer-2.7.0.jar} ${manifest.file.reference.shst.jar} ${manifest.file.reference.spring-ws-core-1.5.9.jar} ${manifest.file.reference.spring-ws-core-tiger-1.5.9.jar} ${manifest.file.reference.spring-ws-support-1.5.9.jar} ${manifest.file.reference.spring-xml-1.5.9.jar} ${manifest.file.reference.truelicense.jar} ${manifest.file.reference.xalan-2.7.0.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.xmlgraphics-commons-1.3.1.jar} ${manifest.file.reference.richfaces-api-3.3.3.Final.jar} ${manifest.file.reference.richfaces-impl-3.3.3.Final.jar} ${manifest.file.reference.richfaces-ui-3.3.3.Final.jar} ${manifest.file.reference.commons-el-1.0.jar} ${manifest.file.reference.tomahawk-1.1.10.jar} ${manifest.file.reference.xmlParserAPIs-2.0.2.jar} "/>
</manifest>
</target>
<target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir">
@ -622,8 +622,8 @@ exists or setup the property manually. For example like this:
<copyfiles files="${file.reference.richfaces-api-3.3.3.Final.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.richfaces-impl-3.3.3.Final.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.richfaces-ui-3.3.3.Final.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.oro-2.0.8.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.tomahawk12-1.1.10.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.commons-el-1.0.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.tomahawk-1.1.10.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.xmlParserAPIs-2.0.2.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${libs.exceptionhandler-runtime.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
</target>

@ -1,8 +1,8 @@
build.xml.data.CRC32=19ca635b
build.xml.data.CRC32=bcd9760d
build.xml.script.CRC32=50b8b881
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=19ca635b
nbproject/build-impl.xml.script.CRC32=75fcbdeb
nbproject/build-impl.xml.data.CRC32=bcd9760d
nbproject/build-impl.xml.script.CRC32=65855de9
nbproject/build-impl.xml.stylesheet.CRC32=8ab4467e@1.15.2.1

@ -30,6 +30,7 @@ file.reference.commons-beanutils-1.8.3.jar=lib/commons-beanutils-1.8.3.jar
file.reference.commons-codec-1.3.jar=lib/commons-codec-1.3.jar
file.reference.commons-collections-3.1.jar=lib/commons-collections-3.1.jar
file.reference.commons-digester-1.8.jar=lib/commons-digester-1.8.jar
file.reference.commons-el-1.0.jar=lib/myfaces/commons-el-1.0.jar
file.reference.commons-fileupload-1.2.1.jar=lib/commons-fileupload-1.2.1.jar
file.reference.commons-httpclient-3.1.jar=lib/commons-httpclient-3.1.jar
file.reference.commons-io-1.4.jar=lib/commons-io-1.4.jar
@ -49,7 +50,6 @@ file.reference.mail.jar-1=lib/mail.jar
file.reference.org.springframework.beans-3.0.0.jar=lib/org.springframework.beans-3.0.0.jar
file.reference.org.springframework.context-3.0.0.jar=lib/org.springframework.context-3.0.0.jar
file.reference.org.springframework.core-3.0.0.jar=lib/org.springframework.core-3.0.0.jar
file.reference.oro-2.0.8.jar=lib/myfaces/oro-2.0.8.jar
file.reference.postgresql-9.0-801.jdbc4.jar=lib/postgresql-9.0-801.jdbc4.jar
file.reference.richfaces-api-3.3.3.Final.jar=lib/richfaces/richfaces-api-3.3.3.Final.jar
file.reference.richfaces-impl-3.3.3.Final.jar=lib/richfaces/richfaces-impl-3.3.3.Final.jar
@ -60,7 +60,7 @@ file.reference.spring-ws-core-1.5.9.jar=lib/spring-ws-core-1.5.9.jar
file.reference.spring-ws-core-tiger-1.5.9.jar=lib/spring-ws-core-tiger-1.5.9.jar
file.reference.spring-ws-support-1.5.9.jar=lib/spring-ws-support-1.5.9.jar
file.reference.spring-xml-1.5.9.jar=lib/spring-xml-1.5.9.jar
file.reference.tomahawk12-1.1.10.jar=lib/myfaces/tomahawk12-1.1.10.jar
file.reference.tomahawk-1.1.10.jar=lib/myfaces/tomahawk-1.1.10.jar
file.reference.truelicense.jar=lib/truelicense.jar
file.reference.xalan-2.7.0.jar=lib/xalan-2.7.0.jar
file.reference.xercesImpl-2.7.1.jar=lib/xercesImpl-2.7.1.jar
@ -122,8 +122,8 @@ javac.classpath=\
${file.reference.richfaces-api-3.3.3.Final.jar}:\
${file.reference.richfaces-impl-3.3.3.Final.jar}:\
${file.reference.richfaces-ui-3.3.3.Final.jar}:\
${file.reference.oro-2.0.8.jar}:\
${file.reference.tomahawk12-1.1.10.jar}:\
${file.reference.commons-el-1.0.jar}:\
${file.reference.tomahawk-1.1.10.jar}:\
${file.reference.xmlParserAPIs-2.0.2.jar}
# Space-separated list of extra javac options
javac.compilerargs=

@ -200,11 +200,11 @@
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<file>${file.reference.oro-2.0.8.jar}</file>
<file>${file.reference.commons-el-1.0.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>
<file>${file.reference.tomahawk12-1.1.10.jar}</file>
<file>${file.reference.tomahawk-1.1.10.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library>

@ -24,6 +24,11 @@ public class Mail
private final String BCC_1 = "departamentotecnico@siprp.pt";
public void send( String emailTo, String emailFrom, MailNextPhase nextPhase ) throws Exception
{
send( emailTo, emailFrom, nextPhase.getSubject(), nextPhase.getBody() );
}
public void send( String emailTo, String emailFrom, String assunto, String texto_email )
throws Exception
{

@ -0,0 +1,133 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package mail;
import db.entidades.PlanoActuacao;
/**
*
* @author dneves
*/
public interface MailNextPhase
{
public String getSubject();
public String getBody();
public class SIPRP_TO_RESPONSAVEL_SEGURANCA implements MailNextPhase
{
private final PlanoActuacao p;
public SIPRP_TO_RESPONSAVEL_SEGURANCA( PlanoActuacao p )
{
this.p = p;
}
@Override
public String getSubject()
{
return "Plano de Actuação da Avaliação de Riscos de " + p.getData_visita_str() + " - " + p.getNome_estabelecimento();
}
@Override
public String getBody()
{
// String mail_text = "<p>Exmo. (a) Senhor (a),</p>";
// mail_text += "<p>Encontra-se dispon&iacute;vel em www.siprp.com o Plano de Actua&ccedil;&atilde;o referente &agrave; auditoria de Avalia&ccedil;&atilde;o de Riscos Laborais realizada no passado dia " + p.getData_visita_str() + " para que possa efectuar o seu preenchimento.</p>";
// mail_text += "<p>Recordamos que disp&otilde;e de duas semanas para efectuar o seu preenchimento e passar o respectivo processo para a fase seguinte, ou seja, para o respons&aacute;vel pelo seu estabelecimento.</p>";
// mail_text += "<p>Caso tenha alguma d&uacute;vida ou necessite de qualquer esclarecimento, contacte, por favor, a &aacute;rea t&eacute;cnica da SIPRP atrav&eacute;s do telefone 213 504 540.</p>";
// mail_text += "<p>Cumprimentos,</p>";
// mail_text += "<p>A equipa da SIPRP</p>";
// mail_text += "<p><center><b>Por favor n&atilde;o responda a esta mensagem, dado tratar-se de um e-mail autom&aacute;tico</b></center></p>";
// return mail_text;
String body = "";
body += "<p>Exmo. (a) Senhor (a),</p>";
body += "<p>Encontra-se dispon&iacute;vel em <a>www.siprp.com</a> o Plano de Actua&ccedil;&atilde;o referente &agrave; auditoria de Avalia&ccedil;&atilde;o de Riscos Laborais realizada no passado dia " + p.getData_visita_str() + " para que possa efectuar o seu preenchimento.</p>";
body += "<p>Recordamos que disp&otilde;e de 30 dias para efectuar o seu preenchimento e passar o respectivo processo para a fase seguinte, ou seja, para o respons&aacute;vel pelo seu estabelecimento.</p>";
body += "<p>Caso tenha alguma d&uacute;vida ou necessite de qualquer esclarecimento, contacte, por favor, a &aacute;rea t&eacute;cnica da SIPRP atrav&eacute;s do telefone 213 504 540.</p>";
body += "<p>Cumprimentos,</p>";
body += "<p>A equipa da SIPRP</p>";
return body;
}
}
public class RESPONSAVEL_SEGURANCA_TO_DIRECTOR_LOJA implements MailNextPhase
{
private final PlanoActuacao p;
public RESPONSAVEL_SEGURANCA_TO_DIRECTOR_LOJA( PlanoActuacao p )
{
this.p = p;
}
@Override
public String getSubject()
{
return "Plano de Actuação da Avaliação de Riscos de " + p.getData_visita_str();
}
@Override
public String getBody()
{
// String mail_text = "<p>Exmo. (a) Senhor (a),</p>";
// mail_text += "<p>Encontra-se dispon&iacute;vel em <a>www.siprp.com</a> o Plano de Actua&ccedil;&atilde;o referente &agrave; auditoria de ";
// mail_text += "Avalia&ccedil;&atilde;o de Riscos Laborais realizada no passado dia " + p.getData_visita_str() + " para que possa ";
// mail_text += "validar a informa&ccedil;&atilde;o preenchida.</p>";
// mail_text += "<p>Cumprimentos.</p>";
// mail_text += "<p><center><b>Por favor n&atilde;o responda a esta mensagem, dado tratar-se de um e-mail autom&aacute;tico</b></center></p>";
// return mail_text;
String body = "";
body += "<p>Exmo. (a) Senhor (a),</p>";
body += "<p>Encontra-se dispon&iacute;vel em <a>www.siprp.com</a> o Plano de Actua&ccedil;&atilde;o referente &agrave; auditoria de Avalia&ccedil;&atilde;o de Riscos Laborais realizada no passado dia " + p.getData_visita_str() + " para que possa validar a informa&ccedil;&atilde;o preenchida.</p>";
body += "<p>Recordamos que disp&otilde;e de 15 dias para efectuar o seu preenchimento e passar o respectivo processo para a fase seguinte, ou seja, para a Direc&ccedil;&atilde;o Nacional de Segurança.</p>";
body += "<p>Caso tenha alguma d&uacute;vida ou necessite de qualquer esclarecimento, contacte, por favor, a &aacute;rea t&eacute;cnica da SIPRP atrav&eacute;s do telefone 213 504 540.</p>";
body += "<p>Cumprimentos,</p>";
body += "<p>A equipa da SIPRP</p>";
return body;
}
}
public class DIRECTOR_LOJA_TO_DIRECTOR_NACIONAL_SEGURANCA implements MailNextPhase
{
private final PlanoActuacao p;
public DIRECTOR_LOJA_TO_DIRECTOR_NACIONAL_SEGURANCA( PlanoActuacao p )
{
this.p = p;
}
@Override
public String getSubject()
{
return "Plano de Actuação da Avaliação de Riscos de " + p.getData_visita_str() + " - " + p.getNome_estabelecimento();
}
@Override
public String getBody()
{
// String mail_text = "<p>Exmo. Senhor Silvestre Machado,</p>";
// mail_text += "<p>Encontra-se dispon&iacute;vel em www.siprp.com o Plano de Actua&ccedil;&atilde;o referente &agrave; auditoria de Avalia&ccedil;&atilde;o de Riscos Laborais realizada no passado dia " + p.getData_visita_str() + " para que o possa validar.</p>";
// mail_text += "<p>Cumprimentos.</p>";
// mail_text += "<p><center><b>Por favor n&atilde;o responda a esta mensagem, dado tratar-se de um e-mail autom&aacute;tico</b></center></p>";
// return mail_text;
String body = "";
body += "<p>Exmo. (a) Senhor (a),</p>";
body += "<p>Encontra-se dispon&iacute;vel em <a>www.siprp.com</a> o Plano de Actua&ccedil;&atilde;o referente &agrave; auditoria de Avalia&ccedil;&atilde;o de Riscos Laborais realizada no passado dia " + p.getData_visita_str() + " para que possa validar a informa&ccedil;&atilde;o preenchida.</p>";
body += "<p>Recordamos que disp&otilde;e de 15 dias para efectuar o seu preenchimento e passar o respectivo processo para a fase seguinte, ou seja, verifica&ccedil;&atilde;o por parte da SIPRP.</p>";
body += "<p>Caso tenha alguma d&uacute;vida ou necessite de qualquer esclarecimento, contacte, por favor, a &aacute;rea t&eacute;cnica da SIPRP atrav&eacute;s do telefone 213 504 540.</p>";
body += "<p>Cumprimentos,</p>";
body += "<p>A equipa da SIPRP</p>";
return body;
}
}
}

@ -24,7 +24,7 @@ import utils.PlanosActuacaoLogger;
*
* @author dneves
*/
public class ContextListener implements ServletContextListener
public class PAContextListener implements ServletContextListener
{
private static final int IMPORT_INTERVAL = 300;
@ -32,6 +32,7 @@ public class ContextListener implements ServletContextListener
private TimedEvent importEvent = null;
@Override
public void contextInitialized( ServletContextEvent sce )
{
startedTime = System.currentTimeMillis();
@ -73,6 +74,7 @@ public class ContextListener implements ServletContextListener
System.out.println( "\nScheduling Import Event ... " );
importEvent = new TimedEvent()
{
@Override
public void executeAction() throws Exception
{
try
@ -90,6 +92,7 @@ public class ContextListener implements ServletContextListener
System.out.println( "\tExecuting Import each " + ( IMPORT_INTERVAL / 60 ) + " minutes." );
}
@Override
public void contextDestroyed( ServletContextEvent sce )
{
System.out.println( "\ncontextDestroyed() : " );

@ -29,10 +29,11 @@ import utils.Logos;
*
* @author lluis
*/
public class MainPhaseListener implements PhaseListener
public class PAMainPhaseListener implements PhaseListener
{
private boolean firstEntry = true;
@Override
public void afterPhase( PhaseEvent pe )
{
if ( pe.getPhaseId() == PhaseId.RENDER_RESPONSE )
@ -43,6 +44,7 @@ public class MainPhaseListener implements PhaseListener
}
}
@Override
public void beforePhase(PhaseEvent event)
{
if ( event.getPhaseId() == PhaseId.RENDER_RESPONSE )
@ -190,6 +192,7 @@ public class MainPhaseListener implements PhaseListener
// }
// }
@Override
public PhaseId getPhaseId()
{
return PhaseId.ANY_PHASE;

@ -13,7 +13,7 @@ import javax.servlet.http.HttpSessionListener;
*
* @author dneves
*/
public class SessionListener implements HttpSessionListener
public class PASessionListener implements HttpSessionListener
{
@Override

@ -46,6 +46,8 @@ import javax.faces.event.ActionEvent;
import javax.faces.event.MethodExpressionActionListener;
import javax.faces.event.ValueChangeEvent;
import mail.Mail;
import mail.MailNextPhase;
import mail.MailNextPhase.RESPONSAVEL_SEGURANCA_TO_DIRECTOR_LOJA;
import org.richfaces.component.html.HtmlCalendar;
import pagination.Pagina;
import pagination.Pagination;
@ -2093,27 +2095,22 @@ public class EditarPlano extends AbstractPageBean
}
break;
case Global.FASE_DIR_LOJA_VALIDACAO :
case Global.FASE_DIR_LOJA_VALIDACAO : // RS para DL
{
tipo_utilizador = Global.DIRECTOR_LOJA;
assunto = "Plano de Actuação da Avaliação de Riscos de " + p.getData_visita_str();
mail_text = "<p>Exmo. (a) Senhor (a),</p>";
mail_text += "<p>Encontra-se dispon&iacute;vel em <a>www.siprp.com</a> o Plano de Actua&ccedil;&atilde;o referente &agrave; auditoria de ";
mail_text += "Avalia&ccedil;&atilde;o de Riscos Laborais realizada no passado dia " + p.getData_visita_str() + " para que possa ";
mail_text += "validar a informa&ccedil;&atilde;o preenchida.</p>";
mail_text += "<p>Cumprimentos.</p>";
mail_text += "<p><center><b>Por favor n&atilde;o responda a esta mensagem, dado tratar-se de um e-mail autom&aacute;tico</b></center></p>";
MailNextPhase nextPhase = new RESPONSAVEL_SEGURANCA_TO_DIRECTOR_LOJA( p );
assunto = nextPhase.getSubject();
mail_text = nextPhase.getBody();
break;
case Global.FASE_DNS_PARECER :
}
case Global.FASE_DNS_PARECER : // DL para DNS
{
tipo_utilizador = Global.DIRECTOR_NACIONAL_SEGURANCA;
assunto = "Plano de Actuação da Avaliação de Riscos de " + p.getData_visita_str() + " - " + p.getNome_estabelecimento();
mail_text = "<p>Exmo. Senhor Silvestre Machado,</p>";
mail_text += "<p>Encontra-se dispon&iacute;vel em www.siprp.com o Plano de Actua&ccedil;&atilde;o referente &agrave; auditoria de Avalia&ccedil;&atilde;o de Riscos Laborais realizada no passado dia " + p.getData_visita_str() + " para que o possa validar.</p>";
mail_text += "<p>Cumprimentos.</p>";
mail_text += "<p><center><b>Por favor n&atilde;o responda a esta mensagem, dado tratar-se de um e-mail autom&aacute;tico</b></center></p>";
MailNextPhase nextPhase = new MailNextPhase.DIRECTOR_LOJA_TO_DIRECTOR_NACIONAL_SEGURANCA( p );
assunto = nextPhase.getSubject();
mail_text = nextPhase.getBody();
break;
}
case Global.FASE_SIPRP_CONCLUSAO :
tipo_utilizador = Global.TECNICO_HS;
assunto = "Plano de Actuação da Avaliação de Riscos de " + p.getData_visita_str() + " - " + p.getNome_estabelecimento();

@ -323,7 +323,7 @@ public class EnviarCorrecao extends AbstractPageBean
int tipo_utilizador = 0;
switch( fase )
{
case Global.FASE_SEGURANCA_PREENCHIMENTO :
case Global.FASE_SEGURANCA_PREENCHIMENTO : // enviar para correccao para responsavel de seguranca
tipo_utilizador = Global.RESPONSAVEL_SEGURANCA;
assunto = "Plano de Actuação da Avaliação de Riscos de " + p.getData_visita_str() + " - Pedido de Correcção";
mail_text = "<p>Exmo. (a) Senhor (a),</p>";
@ -335,7 +335,7 @@ public class EnviarCorrecao extends AbstractPageBean
mail_text += "<p><center><b>Por favor n&atilde;o responda a esta mensagem, dado tratar-se de um e-mail autom&aacute;tico</b></center></p>";
break;
case Global.FASE_DIR_LOJA_VALIDACAO :
case Global.FASE_DIR_LOJA_VALIDACAO : // enviar para correccao para director de loja
tipo_utilizador = Global.DIRECTOR_LOJA;
assunto = "Plano de Actuação da Avaliação de Riscos de " + p.getData_visita_str() + " - Pedido de Correcção";
mail_text = "<p>Exmo. (a) Senhor (a),</p>";

@ -22,6 +22,8 @@ import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import mail.Mail;
import mail.MailNextPhase;
import mail.MailNextPhase.SIPRP_TO_RESPONSAVEL_SEGURANCA;
import shst.data.outer.HsRelatorioData;
import shst.data.provider.PlanoActuacaoDataProvider;
import static com.evolute.utils.strings.UnicodeLatin1Map.*;
@ -32,16 +34,9 @@ import static com.evolute.utils.strings.UnicodeLatin1Map.*;
*/
public class PlanosActuacao
{
//PlanosDataProvider pdp = new PlanosDataProvider();
// CreatePlanosDataProvider cpdp = new CreatePlanosDataProvider();
//RelatoriosDataProvider rdp;
private List< PlanoActuacao > planosList;
private List< Date > planosOnlineList;
// PlanoActuacaoDAO pa = new PlanoActuacaoDAO();
//DB
public PlanosActuacao()
{
@ -312,28 +307,9 @@ public class PlanosActuacao
{
createMedidas( r.getId(), r.getMedidas() );
}
// if(r.getValores() != null)
// {
// createValores(r.getId(), r.getValores());
// }
}
}
// private void createValores(Integer risco_id, List<Valor> valores) throws Exception
// {
// for(Valor v : valores)
// {
// v.setRisco_id(risco_id);
// v.setId(pdp.createValor(v));
// if(v.getMedidas() != null)
// {
// createMedidas(v.getId(), v.getMedidas());
// }
//
// }
// }
private void createMedidas(Integer risco_id, List<Medida> medidas) throws Exception
{
CreatePlanosDataProvider cpdp = CreatePlanosDataProvider.getInstance();
@ -360,117 +336,56 @@ public class PlanosActuacao
cpdp.createPostoTrabalho( p );
}
}
// private void showPlano(PlanoActuacao p)
// {
// System.out.println("================================================");
// System.out.println("PLANO : " + p.getData_visita_str() + " | " + p.getDescricao() + " | " + p.getFase_nome() + " | " + p.getNome_estabelecimento());
// showAreas(p.getAreas());
// System.out.println("================================================");
// }
// private void showAreas(List<Area> areas)
// {
// for(Area a : areas)
// {
// System.out.println(" " + a.getDescricao());
// showRiscos(a.getRiscos());
// }
// }
// private void showRiscos(List<Risco> riscos)
// {
// for(Risco r : riscos)
// {
// System.out.println(" " + r.getDescricao());
// showValores(r.getValores());
// }
// }
// private void showValores(List<Valor> valores)
// {
// for(Valor v : valores)
// {
// System.out.println(" " + v.getValor());
// showMedidas(v.getMedidas());
// }
// }
// private void showMedidas(List<Medida> medidas)
// {
// for(Medida m : medidas)
// {
// System.out.println(" " + m.getDescricao());
// showPostos(m.getPostos());
// }
// }
// private void showPostos(List<PostoTrabalho> postos)
// {
// for(PostoTrabalho p : postos)
// {
// System.out.println(" " + p.getDescricao());
// }
// }
private void enviarMail( PlanoActuacao p )
{
String assunto = "";
String mail_text = "";
MailNextPhase nextPhase = null;
int fase = p.getFase().intValue();
int tipo_utilizador = 0;
switch(fase)
switch ( fase )
{
case Global.FASE_SEGURANCA_PREENCHIMENTO :
case Global.FASE_SEGURANCA_PREENCHIMENTO : // SIPRP para RS
tipo_utilizador = Global.RESPONSAVEL_SEGURANCA;
assunto = "Plano de Actuação da Avaliação de Riscos de " + p.getData_visita_str() + " - " + p.getNome_estabelecimento();
mail_text = "<p>Exmo. (a) Senhor (a),</p>";
mail_text += "<p>Encontra-se dispon&iacute;vel em www.siprp.com o Plano de Actua&ccedil;&atilde;o referente &agrave; auditoria de Avalia&ccedil;&atilde;o de Riscos Laborais realizada no passado dia " + p.getData_visita_str() + " para que possa efectuar o seu preenchimento.</p>";
mail_text += "<p>Recordamos que disp&otilde;e de duas semanas para efectuar o seu preenchimento e passar o respectivo processo para a fase seguinte, ou seja, para o respons&aacute;vel pelo seu estabelecimento.</p>";
mail_text += "<p>Caso tenha alguma d&uacute;vida ou necessite de qualquer esclarecimento, contacte, por favor, a &aacute;rea t&eacute;cnica da SIPRP atrav&eacute;s do telefone 213 504 540.</p>";
mail_text += "<p>Cumprimentos,</p>";
mail_text += "<p>A equipa da SIPRP</p>";
mail_text += "<p><center><b>Por favor n&atilde;o responda a esta mensagem, dado tratar-se de um e-mail autom&aacute;tico</b></center></p>";
nextPhase = new SIPRP_TO_RESPONSAVEL_SEGURANCA( p );
break;
}
String responsavel_loja = "n";
if(tipo_utilizador == Global.RESPONSAVEL_SEGURANCA)
{
responsavel_loja = "y";
}
try
{
Mail mail = new Mail();
UtilizadoresDataProvider udp = UtilizadoresDataProvider.getInstance();
List< Utilizador > list = udp.getUtilizadoresListByTipo( tipo_utilizador, responsavel_loja, p.getEstabelecimento_id() );
ListIterator iter = list.listIterator();
while ( iter.hasNext() )
{
Utilizador u = ( Utilizador ) iter.next();
System.out.println( "\t\tUSER MAIL NEXT FASE : " + u.getLogin() + " ; " + u.getEmail() );
try
{
mail.send( u.getEmail(), Mail.ENDERECO_ENVIO, assunto, mail_text );
System.out.println( "\t\t\tEMAIL ENVIADO !!" );
}
catch(Exception ex1)
{
ErrorLogger.logException( ex1 );
System.out.println("\t\t\tMAIL ERROR : " + ex1.getMessage());
}
if ( nextPhase != null )
{
String responsavel_loja = "n";
if ( tipo_utilizador == Global.RESPONSAVEL_SEGURANCA )
{
responsavel_loja = "y";
}
try
{
Mail mail = new Mail();
}
}
catch ( Exception ex )
{
ErrorLogger.logException( ex );
}
UtilizadoresDataProvider udp = UtilizadoresDataProvider.getInstance();
List< Utilizador > list = udp.getUtilizadoresListByTipo( tipo_utilizador, responsavel_loja, p.getEstabelecimento_id() );
ListIterator iter = list.listIterator();
while ( iter.hasNext() )
{
Utilizador u = ( Utilizador ) iter.next();
System.out.println( "\t\tUSER MAIL NEXT FASE : " + u.getLogin() + " ; " + u.getEmail() );
try
{
mail.send( u.getEmail(), Mail.ENDERECO_ENVIO, nextPhase );
System.out.println( "\t\t\tEMAIL ENVIADO !!" );
}
catch ( Exception ex1 )
{
ErrorLogger.logException( ex1 );
System.out.println("\t\t\tMAIL ERROR : " + ex1.getMessage());
}
}
}
catch ( Exception ex )
{
ErrorLogger.logException( ex );
}
}
}
}

@ -13,7 +13,7 @@
</locale-config>
</application>
<lifecycle>
<phase-listener>phaselistener.MainPhaseListener</phase-listener>
<phase-listener>phaselistener.PAMainPhaseListener</phase-listener>
</lifecycle>
<managed-bean>
<managed-bean-name>SessionBean1</managed-bean-name>

@ -151,10 +151,10 @@
</jsp-config>
<listener>
<listener-class>phaselistener.ContextListener</listener-class>
<listener-class>phaselistener.PAContextListener</listener-class>
</listener>
<listener>
<listener-class>phaselistener.SessionListener</listener-class>
<listener-class>phaselistener.PASessionListener</listener-class>
</listener>
<!-- <security-constraint>

Loading…
Cancel
Save