diff --git a/trunk/AnaliseAcidentesTrabalho/build.xml b/trunk/AnaliseAcidentesTrabalho/build.xml index eb87f66d..749e498d 100644 --- a/trunk/AnaliseAcidentesTrabalho/build.xml +++ b/trunk/AnaliseAcidentesTrabalho/build.xml @@ -21,15 +21,15 @@ -post-compile-test: called after javac compilation of JUnit tests -pre-compile-test-single: called before javac compilation of single JUnit test -post-compile-test-single: called after javac compilation of single JUunit test - -pre-dist: called before archive building - -post-dist: called after archive building + -pre-dist: called before jar building + -post-dist: called after jar building -post-clean: called after cleaning build products -pre-run-deploy: called before deploying -post-run-deploy: called after deploying Example of pluging an obfuscator after the compilation could look like - + @@ -45,7 +45,7 @@ init-macrodef-javac: defines macro for javac compilation init-macrodef-junit: defines macro for junit execution init-macrodef-debug: defines macro for class debugging - do-dist: archive building + do-dist: jar archive building run: execution of project javadoc-build: javadoc generation diff --git a/trunk/AnaliseAcidentesTrabalho/nbproject/ant-deploy.xml b/trunk/AnaliseAcidentesTrabalho/nbproject/ant-deploy.xml index a6f1480c..bcfeee44 100644 --- a/trunk/AnaliseAcidentesTrabalho/nbproject/ant-deploy.xml +++ b/trunk/AnaliseAcidentesTrabalho/nbproject/ant-deploy.xml @@ -12,7 +12,7 @@ + classpath="${tomcat.home}/server/lib/catalina-ant.jar"/> @@ -21,7 +21,7 @@ + classpath="${tomcat.home}/server/lib/catalina-ant.jar"/> diff --git a/trunk/AnaliseAcidentesTrabalho/nbproject/build-impl.xml b/trunk/AnaliseAcidentesTrabalho/nbproject/build-impl.xml index fcec977e..c08bb76a 100644 --- a/trunk/AnaliseAcidentesTrabalho/nbproject/build-impl.xml +++ b/trunk/AnaliseAcidentesTrabalho/nbproject/build-impl.xml @@ -17,9 +17,9 @@ - cleanup --> - + - + @@ -27,21 +27,25 @@ - + - + - + - - + + + + + + @@ -82,29 +86,23 @@ - - - - - - - - + - - + + - - - + + + + @@ -112,28 +110,12 @@ - - - - - - - - - - - - - - - - - + Must set src.dir Must set test.src.dir Must set build.dir @@ -158,17 +140,17 @@ - - - - + + + + - + - + @@ -176,18 +158,18 @@ - + - + - + - + @@ -197,17 +179,17 @@ - + - + - + - + @@ -216,10 +198,10 @@ - - + + - + @@ -227,42 +209,24 @@ - + - + - - - - - - - - - - - - - - - - - - - - + - - - - + + + - - + + + + @@ -270,10 +234,9 @@ - + - @@ -283,70 +246,66 @@ - - + + - - + + - + - + - + - + - + - - - - - + + + + + - - - - - + + - - - - + + + - + - - - + + + @@ -354,19 +313,19 @@ - + - + Must select some files in the IDE or set javac.includes - + @@ -374,39 +333,35 @@ - - + + - + - + - - - + - + Must select some files in the IDE or set javac.jsp.includes - + - + - - - + @@ -423,146 +378,144 @@ - - - - - - - - - - - - - - - - + + - - + + - - + + - - + + - - - - + + + + - - - - - + + + - - + + - - - + + + + + - - + + - + - + - + - - - + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + - + @@ -582,11 +535,9 @@ - - - - - + + + @@ -594,15 +545,15 @@ - - + + - + - - + + @@ -610,14 +561,14 @@ - + - + - + @@ -652,7 +603,7 @@ - + Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable. @@ -662,54 +613,54 @@ - + Must select one file in the IDE or set run.class - - + + - + - + - + - - + + - + Must select one file in the IDE or set debug.class - - + + Must set fix.includes - + - + - + - + @@ -720,23 +671,23 @@ - + - + - + - - + + @@ -745,14 +696,14 @@ - + - + Must select some files in the IDE or set javac.includes - + @@ -765,85 +716,75 @@ - + - + - + - + Some tests failed; see details above. - - - - + + + + - + Must select some files in the IDE or set test.includes - + Some tests failed; see details above. - + - + Must select one file in the IDE or set test.class - - - - - - - - - - - + - - + + - - + + - + - - - + + + - + - + - - + + - - + + diff --git a/trunk/AnaliseAcidentesTrabalho/nbproject/genfiles.properties b/trunk/AnaliseAcidentesTrabalho/nbproject/genfiles.properties index 69ab9568..6d4fc5d8 100644 --- a/trunk/AnaliseAcidentesTrabalho/nbproject/genfiles.properties +++ b/trunk/AnaliseAcidentesTrabalho/nbproject/genfiles.properties @@ -1,8 +1,8 @@ -build.xml.data.CRC32=344e64b2 -build.xml.script.CRC32=82e52d07 -build.xml.stylesheet.CRC32=cfd7ba16 +build.xml.data.CRC32=9736285c +build.xml.script.CRC32=ab1471e9 +build.xml.stylesheet.CRC32=95be3570 # 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=344e64b2 -nbproject/build-impl.xml.script.CRC32=e5818321 -nbproject/build-impl.xml.stylesheet.CRC32=723dd8e7 +nbproject/build-impl.xml.data.CRC32=9736285c +nbproject/build-impl.xml.script.CRC32=8213162e +nbproject/build-impl.xml.stylesheet.CRC32=ac43bae1 diff --git a/trunk/AnaliseAcidentesTrabalho/nbproject/project.properties b/trunk/AnaliseAcidentesTrabalho/nbproject/project.properties index 11c1345a..bb85d001 100644 --- a/trunk/AnaliseAcidentesTrabalho/nbproject/project.properties +++ b/trunk/AnaliseAcidentesTrabalho/nbproject/project.properties @@ -19,11 +19,16 @@ dist.ear.war=${dist.dir}/${war.ear.name} dist.javadoc.dir=${dist.dir}/javadoc dist.war=${dist.dir}/${war.name} file.reference.activation.jar=jars/activation.jar +file.reference.avalon-framework-4.2.0.jar=lib/avalon-framework-4.2.0.jar +file.reference.batik.jar=lib/batik.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.jdom.jar=lib/jdom.jar file.reference.mail.jar=jars/mail.jar file.reference.postgresql-8.2-506.jdbc4.jar=jars/postgresql-8.2-506.jdbc4.jar j2ee.platform=1.4 -j2ee.server.type=Tomcat60 +j2ee.server.type=Tomcat55 jar.compress=false javac.classpath=\ ${libs.jsf-designtime.classpath}:\ @@ -36,7 +41,12 @@ javac.classpath=\ ${file.reference.mail.jar}:\ ${file.reference.postgresql-8.2-506.jdbc4.jar}:\ ${libs.rowset-ri.classpath}:\ - ${file.reference.iText-2.0.8.jar} + ${file.reference.iText-2.0.8.jar}:\ + ${file.reference.evolute.jar}:\ + ${file.reference.fop.jar}:\ + ${file.reference.jdom.jar}:\ + ${file.reference.avalon-framework-4.2.0.jar}:\ + ${file.reference.batik.jar} # Space-separated list of extra javac options javac.compilerargs= javac.debug=true diff --git a/trunk/AnaliseAcidentesTrabalho/nbproject/project.xml b/trunk/AnaliseAcidentesTrabalho/nbproject/project.xml index 4cc696f4..bad63696 100644 --- a/trunk/AnaliseAcidentesTrabalho/nbproject/project.xml +++ b/trunk/AnaliseAcidentesTrabalho/nbproject/project.xml @@ -11,7 +11,7 @@ ${libs.jsf-designtime.classpath} WEB-INF/lib - + ${libs.jsfsupport-designtime.classpath} WEB-INF/lib @@ -19,7 +19,7 @@ ${libs.webui-designtime.classpath} WEB-INF/lib - + ${libs.jdbcsupport-designtime.classpath} WEB-INF/lib @@ -43,7 +43,7 @@ ${file.reference.postgresql-8.2-506.jdbc4.jar} WEB-INF/lib - + ${libs.rowset-ri.classpath} WEB-INF/lib @@ -51,13 +51,33 @@ ${file.reference.iText-2.0.8.jar} WEB-INF/lib + + ${file.reference.evolute.jar} + WEB-INF/lib + + + ${file.reference.fop.jar} + WEB-INF/lib + + + ${file.reference.jdom.jar} + WEB-INF/lib + + + ${file.reference.avalon-framework-4.2.0.jar} + WEB-INF/lib + + + ${file.reference.batik.jar} + WEB-INF/lib + ${libs.jsf-runtime.classpath} WEB-INF/lib - + ${libs.jsfsupport-runtime.classpath} WEB-INF/lib @@ -65,7 +85,7 @@ ${libs.webui-runtime.classpath} WEB-INF/lib - + ${libs.jdbcsupport-runtime.classpath} WEB-INF/lib diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/AnaliseAcidenteTrabalho.java b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/AnaliseAcidenteTrabalho.java index 39ea02cc..2abfcb01 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/AnaliseAcidenteTrabalho.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/AnaliseAcidenteTrabalho.java @@ -45,6 +45,7 @@ import java.util.Calendar; import java.util.Date; import java.util.ListIterator; import java.util.Properties; +import javax.activation.DataHandler; import javax.faces.FacesException; import javax.faces.FactoryFinder; import javax.faces.application.ApplicationFactory; @@ -13983,6 +13984,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean { private void sendEmailToRhFase4(AnaliseAcidente a) { + System.out.println("SEND EMAIL TO RH FASE 4"); 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"; @@ -14003,6 +14005,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean { catch(Exception ex) { ex.printStackTrace(); + System.out.println("EMAIL FASE 4 ERROR : " + ex.getMessage()); } } catch(Exception ex) @@ -14093,7 +14096,42 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean { private void sendEmailWithPdf(AnaliseAcidente a, String emailTo, String emailFrom, String assunto, String texto_email) throws Exception { - PdfGenerator pdf = new PdfGenerator(a); + System.out.println("SEND EMAIL WITH PDF"); + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + Utilizador ut = udp.getUtilizador(a.getTecnico_saude_id()); + Utilizador um = udp.getUtilizador(a.getMedico_id()); + AnalisesDataProvider adp = new AnalisesDataProvider(); + Acidentado ac = adp.getAcidentado(a.getAcidentado_id()); + Estabelecimento e = new Estabelecimento(); + e.setId(a.getEstabelecimento_id()); + e.setNome(adp.getEstabelecimentoNome(a.getEstabelecimento_id())); + Seccao s = adp.getSeccao(a.getSeccao_id()); + Causa c = adp.getCausa(a.getCausas()); + ArrayList recList = adp.getRecomendacoesByAnalise(a.getId()); + Recomendacao[] recArray = new Recomendacao[recList.size()]; + ListIterator iter = recList.listIterator(); + int i = 0; + while(iter.hasNext()) + { + Recomendacao rec = (Recomendacao) iter.next(); + recArray[i] = rec; + i++; + } + //Recomendacao recArray[] = (Recomendacao)recList.toArray(); + ArrayList medList = adp.getMedidasByAnalise(a.getId()); + //Medida medArray[] = (Medida)medList.toArray(); + Medida[] medArray = new Medida[medList.size()]; + iter = medList.listIterator(); + i = 0; + while(iter.hasNext()) + { + Medida med = (Medida) iter.next(); + medArray[i] = med; + i++; + } + + PdfGenerator pdf = new PdfGenerator(Global.IMAGE_FOLDER, e, ut, um, a, ac, s, recArray, medArray, c); + ByteArrayDataSource ds = new ByteArrayDataSource(pdf.generatePdf(), "application/pdf"); Properties props = new Properties(); @@ -14124,14 +14162,16 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean { multipart.addBodyPart(msgBodyPart); MimeBodyPart pdfPart = new MimeBodyPart(); - pdfPart.setContent(ds,"application/pdf"); + //pdfPart.setContent(ds,"application/pdf"); + pdfPart.setDataHandler(new DataHandler(ds)); pdfPart.setHeader("Content-Transfer-Encoding","base64"); pdfPart.setHeader("Content-Disposition","attachment"); - pdfPart.setFileName("AnaliseAcidente" + a.getAnalise_nr()); + String pdfname = "Analise" + a.getAnalise_nr(); + pdfPart.setFileName(pdfname); multipart.addBodyPart(pdfPart,1); msg.setContent(multipart); Transport.send(msg); - System.out.println("Email Enviado !!!! "); + System.out.println("Email Enviado !!!! " + emailTo); } public String butImprimir_action() { diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/db/Db.java b/trunk/AnaliseAcidentesTrabalho/src/java/db/Db.java index a0386180..9580e032 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/db/Db.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/db/Db.java @@ -21,8 +21,8 @@ import javax.servlet.http.HttpSession; * @author lluis */ public class Db { - String connectionURL = "jdbc:postgresql://storage:5432/siprp"; //testes - //String connectionURL = "jdbc:postgresql://localhost:5436/siprp"; //real + //String connectionURL = "jdbc:postgresql://storage:5432/siprp"; //testes + String connectionURL = "jdbc:postgresql://localhost:5436/siprp"; //real String User = "postgres"; String Pass = null; Connection connection = null; diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/db/Dblocal.java b/trunk/AnaliseAcidentesTrabalho/src/java/db/Dblocal.java index a58cd70b..35445a1f 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/db/Dblocal.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/db/Dblocal.java @@ -21,8 +21,8 @@ import javax.servlet.http.HttpSession; * @author lluis */ public class Dblocal { - String connectionURL = "jdbc:postgresql://storage:5432/siprp_local"; //testes - //String connectionURL = "jdbc:postgresql://localhost:5436/siprp_local_3"; + //String connectionURL = "jdbc:postgresql://storage:5432/siprp_local"; //testes + String connectionURL = "jdbc:postgresql://localhost:5436/siprp_local_3"; String User = "postgres"; String Pass = null; Connection connection = null; diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/pdf/PdfGenerator.java b/trunk/AnaliseAcidentesTrabalho/src/java/pdf/PdfGenerator.java index 877f02b3..cb993b0f 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/pdf/PdfGenerator.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/pdf/PdfGenerator.java @@ -41,7 +41,8 @@ public class PdfGenerator protected final Causa causa; protected final URL urlSiprp; protected final URL urlAuchan; - protected Vector imagens = new Vector(); + //protected Vector imagens = new Vector(); + protected Vector imagens = new Vector(); public static void main( String args[] ) throws Exception