diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/build.xml b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/build.xml new file mode 100644 index 00000000..749e498d --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/build.xml @@ -0,0 +1,66 @@ + + + + + + Builds, tests, and runs the project AnaliseAcidentesTrabalho. + + + diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/catalog.xml b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/catalog.xml new file mode 100644 index 00000000..e69de29b diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/jars/activation.jar b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/jars/activation.jar new file mode 100755 index 00000000..589b6749 Binary files /dev/null and b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/jars/activation.jar differ diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/jars/mail.jar b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/jars/mail.jar new file mode 100755 index 00000000..e6f70832 Binary files /dev/null and b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/jars/mail.jar differ diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/jars/postgresql-8.0-315.jdbc3.jar b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/jars/postgresql-8.0-315.jdbc3.jar new file mode 100755 index 00000000..777b3040 Binary files /dev/null and b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/jars/postgresql-8.0-315.jdbc3.jar differ diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/jars/postgresql-8.1-407.jdbc3.jar b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/jars/postgresql-8.1-407.jdbc3.jar new file mode 100755 index 00000000..ddf17862 Binary files /dev/null and b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/jars/postgresql-8.1-407.jdbc3.jar differ diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/jars/postgresql-8.2-506.jdbc4.jar b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/jars/postgresql-8.2-506.jdbc4.jar new file mode 100644 index 00000000..260a95eb Binary files /dev/null and b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/jars/postgresql-8.2-506.jdbc4.jar differ diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/nbproject/ant-deploy.xml b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/nbproject/ant-deploy.xml new file mode 100644 index 00000000..bcfeee44 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/nbproject/ant-deploy.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/nbproject/build-impl.xml b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/nbproject/build-impl.xml new file mode 100644 index 00000000..cb545f8d --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/nbproject/build-impl.xml @@ -0,0 +1,736 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set build.web.dir + Must set build.generated.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.war + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.jsp.includes + + + + + + + + + + + + + + + + + + + + Must select a file in the IDE or set jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable. + + + Launching ${browse.url} + + + + + + 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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + 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/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/nbproject/genfiles.properties b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/nbproject/genfiles.properties new file mode 100644 index 00000000..05622b2a --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=f9aca309 +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=f9aca309 +nbproject/build-impl.xml.script.CRC32=39ccfd31 +nbproject/build-impl.xml.stylesheet.CRC32=ac43bae1 diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/nbproject/project.properties b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/nbproject/project.properties new file mode 100644 index 00000000..fff16ec3 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/nbproject/project.properties @@ -0,0 +1,85 @@ +build.classes.dir=${build.web.dir}/WEB-INF/classes +build.classes.excludes=**/*.java,**/*.form +build.dir=build +build.ear.classes.dir=${build.ear.web.dir}/WEB-INF/classes +build.ear.web.dir=${build.dir}/ear-module +build.generated.dir=${build.dir}/generated +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +build.web.dir=${build.dir}/web +build.web.excludes=${build.classes.excludes} +client.urlPart= +compile.jsps=false +conf.dir=${source.root}/conf +creator=3.0 +debug.classpath=${javac.classpath}:${build.classes.dir}:${build.ear.classes.dir} +debug.test.classpath=\ + ${run.test.classpath} +display.browser=true +dist.dir=dist +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.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=Tomcat55 +jar.compress=false +javac.classpath=\ + ${libs.jsf-designtime.classpath}:\ + ${libs.jsfsupport-designtime.classpath}:\ + ${libs.webui-designtime.classpath}:\ + ${libs.jdbcsupport-designtime.classpath}:\ + ${libs.theme-default.classpath}:\ + ${libs.jstl11.classpath}:\ + ${file.reference.activation.jar}:\ + ${file.reference.mail.jar}:\ + ${file.reference.postgresql-8.2-506.jdbc4.jar} +# Space-separated list of extra javac options +javac.compilerargs= +javac.debug=true +javac.deprecation=false +javac.source=1.4 +javac.target=1.4 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir}:\ + ${libs.junit.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding= +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.preview=true +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +jspcompilation.classpath=${jspc.classpath}:${javac.classpath} +lib.dir=${web.docbase.dir}/WEB-INF/lib +platform.active=default_platform +resource.dir=setup +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +# Space-separated list of JVM arguments used when running class with main method +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): +runmain.jvmargs= +source.root=src +src.dir=${source.root}/java +test.src.dir=test +war.content.additional=\ + ${libs.jsf-runtime.classpath}:\ + ${libs.jsfsupport-runtime.classpath}:\ + ${libs.webui-runtime.classpath}:\ + ${libs.jdbcsupport-runtime.classpath}:\ + ${libs.exceptionhandler-runtime.classpath}:\ + ${libs.theme-default.classpath}:\ + ${libs.jstl11.classpath} +war.ear.name=AnaliseAcidentesTrabalho.war +war.name=AnaliseAcidentesTrabalho.war +war.package=true +web.docbase.dir=web diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/nbproject/project.xml b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/nbproject/project.xml new file mode 100644 index 00000000..4164ef85 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/nbproject/project.xml @@ -0,0 +1,79 @@ + + + org.netbeans.modules.web.project + + + + AnaliseAcidentesTrabalho + 1.6 + + + ${libs.jsf-designtime.classpath} + + + ${libs.jsfsupport-designtime.classpath} + + + ${libs.webui-designtime.classpath} + + + ${libs.jdbcsupport-designtime.classpath} + + + ${libs.theme-default.classpath} + + + ${libs.jstl11.classpath} + + + ${file.reference.activation.jar} + WEB-INF/lib + + + ${file.reference.mail.jar} + WEB-INF/lib + + + ${file.reference.postgresql-8.2-506.jdbc4.jar} + WEB-INF/lib + + + + + ${libs.jsf-runtime.classpath} + WEB-INF/lib + + + ${libs.jsfsupport-runtime.classpath} + WEB-INF/lib + + + ${libs.webui-runtime.classpath} + WEB-INF/lib + + + ${libs.jdbcsupport-runtime.classpath} + WEB-INF/lib + + + ${libs.exceptionhandler-runtime.classpath} + WEB-INF/lib + + + ${libs.theme-default.classpath} + WEB-INF/lib + + + ${libs.jstl11.classpath} + WEB-INF/lib + + + + + + + + + + + diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/conf/MANIFEST.MF b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/conf/MANIFEST.MF new file mode 100644 index 00000000..59499bce --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/conf/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/AnaliseAcidente.java b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/AnaliseAcidente.java new file mode 100644 index 00000000..d44d858a --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/AnaliseAcidente.java @@ -0,0 +1,214 @@ +/* + * AnaliseAcidente.java + * + * Created on September 20, 2007, 1:34 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package analiseacidentestrabalho; + +import java.sql.Date; + +/** + * + * @author lluis + */ +public class AnaliseAcidente { + private Integer id; + private Integer nr; + private Date data_acidente; + private Integer trabalhador_id; + private String nome_acidentado; + private Integer estabelecimento_id; + private Integer estado; + + private String morada; + private String telefone; + private Integer horas_turno; + private String seccao; + private String local_trabalho; + private String tarefa; + private String substancias; + private String superior_hierarquico; + private String condicoes; + private String testemunhas; + private String causas; + private String descricao; + private String conclusoes; + private String accoes; + + /** Creates a new instance of AnaliseAcidente */ + public AnaliseAcidente() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Date getData_acidente() { + return data_acidente; + } + + public void setData_acidente(Date data_acidente) { + this.data_acidente = data_acidente; + } + + public Integer getTrabalhador_id() { + return trabalhador_id; + } + + public void setTrabalhador_id(Integer trabalhador_id) { + this.trabalhador_id = trabalhador_id; + } + + public Integer getEstado() { + return estado; + } + + public void setEstado(Integer estado) { + this.estado = estado; + } + + public String getNome_acidentado() { + return nome_acidentado; + } + + public void setNome_acidentado(String nome_acidentado) { + this.nome_acidentado = nome_acidentado; + } + + public Integer getEstabelecimento_id() { + return estabelecimento_id; + } + + public void setEstabelecimento_id(Integer estabelecimento_id) { + this.estabelecimento_id = estabelecimento_id; + } + + public Integer getNr() { + return nr; + } + + public void setNr(Integer nr) { + this.nr = nr; + } + + public String getMorada() { + return morada; + } + + public void setMorada(String morada) { + this.morada = morada; + } + + public String getTelefone() { + return telefone; + } + + public void setTelefone(String telefone) { + this.telefone = telefone; + } + + public Integer getHoras_turno() { + return horas_turno; + } + + public void setHoras_turno(Integer horas_turno) { + this.horas_turno = horas_turno; + } + + public String getSeccao() { + return seccao; + } + + public void setSeccao(String seccao) { + this.seccao = seccao; + } + + public String getLocal_trabalho() { + return local_trabalho; + } + + public void setLocal_trabalho(String local_trabalho) { + this.local_trabalho = local_trabalho; + } + + public String getTarefa() { + return tarefa; + } + + public void setTarefa(String tarefa) { + this.tarefa = tarefa; + } + + public String getSubstancias() { + return substancias; + } + + public void setSubstancias(String substancias) { + this.substancias = substancias; + } + + public String getSuperior_hierarquico() { + return superior_hierarquico; + } + + public void setSuperior_hierarquico(String superior_hierarquico) { + this.superior_hierarquico = superior_hierarquico; + } + + public String getCondicoes() { + return condicoes; + } + + public void setCondicoes(String condicoes) { + this.condicoes = condicoes; + } + + public String getTestemunhas() { + return testemunhas; + } + + public void setTestemunhas(String testemunhas) { + this.testemunhas = testemunhas; + } + + public String getCausas() { + return causas; + } + + public void setCausas(String causas) { + this.causas = causas; + } + + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } + + public String getConclusoes() { + return conclusoes; + } + + public void setConclusoes(String conclusoes) { + this.conclusoes = conclusoes; + } + + public String getAccoes() { + return accoes; + } + + public void setAccoes(String accoes) { + this.accoes = accoes; + } + +} diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/AnaliseAcidenteTrabalho.java b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/AnaliseAcidenteTrabalho.java new file mode 100644 index 00000000..58dc8fe7 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/AnaliseAcidenteTrabalho.java @@ -0,0 +1,2075 @@ +/* + * AnaliseAcidenteTrabalho.java + * + * Created on September 28, 2007, 3:56 PM + * Copyright lluis + */ +package analiseacidentestrabalho; + +import com.sun.data.provider.RowKey; +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.DropDown; +import com.sun.rave.web.ui.component.Form; +import com.sun.rave.web.ui.component.Head; +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.ImageHyperlink; +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.component.Table; +import com.sun.rave.web.ui.component.TableColumn; +import com.sun.rave.web.ui.component.TableRowGroup; +import com.sun.rave.web.ui.component.TextArea; +import com.sun.rave.web.ui.component.TextField; +import db.AnalisesDataProvider; +import db.TrabalhadoresListDataProvider; +import java.io.File; +import java.util.ArrayList; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import pagestate.AnaliseAcidenteTrabalhoState; + +/** + *

Page bean that corresponds to a similarly named JSP page. This + * class contains component definitions (and initialization code) for + * all components that you have defined on this page, as well as + * lifecycle methods and event handlers where you may add behavior + * to respond to incoming events.

+ */ +public class AnaliseAcidenteTrabalho extends AbstractPageBean { + // + private int __placeholder; + + /** + *

Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.

+ */ + private void _init() throws Exception { + } + + private Page page1 = new Page(); + + public Page getPage1() { + return page1; + } + + public void setPage1(Page p) { + this.page1 = p; + } + + private Html html1 = new Html(); + + public Html getHtml1() { + return html1; + } + + public void setHtml1(Html h) { + this.html1 = h; + } + + private Head head1 = new Head(); + + public Head getHead1() { + return head1; + } + + public void setHead1(Head h) { + this.head1 = h; + } + + private Link link1 = new Link(); + + public Link getLink1() { + return link1; + } + + public void setLink1(Link l) { + this.link1 = l; + } + + private Body body1 = new Body(); + + public Body getBody1() { + return body1; + } + + public void setBody1(Body b) { + this.body1 = b; + } + + private Form form1 = new Form(); + + public Form getForm1() { + return form1; + } + + public void setForm1(Form f) { + this.form1 = f; + } + + private HtmlPanelGrid gridBase1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridBase1() { + return gridBase1; + } + + public void setGridBase1(HtmlPanelGrid hpg) { + this.gridBase1 = hpg; + } + + private HtmlPanelGrid gridLayout1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridLayout1() { + return gridLayout1; + } + + public void setGridLayout1(HtmlPanelGrid hpg) { + this.gridLayout1 = hpg; + } + + private HtmlPanelGrid gridPanel1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel1() { + return gridPanel1; + } + + public void setGridPanel1(HtmlPanelGrid hpg) { + this.gridPanel1 = hpg; + } + + private PanelGroup groupPanel1 = new PanelGroup(); + + public PanelGroup getGroupPanel1() { + return groupPanel1; + } + + public void setGroupPanel1(PanelGroup pg) { + this.groupPanel1 = pg; + } + + private ImageComponent image1 = new ImageComponent(); + + public ImageComponent getImage1() { + return image1; + } + + public void setImage1(ImageComponent ic) { + this.image1 = ic; + } + + private ImageComponent image2 = new ImageComponent(); + + public ImageComponent getImage2() { + return image2; + } + + public void setImage2(ImageComponent ic) { + this.image2 = ic; + } + + private PanelGroup groupPanel2 = new PanelGroup(); + + public PanelGroup getGroupPanel2() { + return groupPanel2; + } + + public void setGroupPanel2(PanelGroup pg) { + this.groupPanel2 = pg; + } + + private StaticText lblUser = new StaticText(); + + public StaticText getLblUser() { + return lblUser; + } + + public void setLblUser(StaticText st) { + this.lblUser = st; + } + + private StaticText staticText1 = new StaticText(); + + public StaticText getStaticText1() { + return staticText1; + } + + public void setStaticText1(StaticText st) { + this.staticText1 = st; + } + + private Hyperlink lnkChangePassword = new Hyperlink(); + + public Hyperlink getLnkChangePassword() { + return lnkChangePassword; + } + + public void setLnkChangePassword(Hyperlink h) { + this.lnkChangePassword = h; + } + + private StaticText staticText2 = new StaticText(); + + public StaticText getStaticText2() { + return staticText2; + } + + public void setStaticText2(StaticText st) { + this.staticText2 = st; + } + + private Hyperlink lnkLogout = new Hyperlink(); + + public Hyperlink getLnkLogout() { + return lnkLogout; + } + + public void setLnkLogout(Hyperlink h) { + this.lnkLogout = h; + } + + private StaticText staticText3 = new StaticText(); + + public StaticText getStaticText3() { + return staticText3; + } + + public void setStaticText3(StaticText st) { + this.staticText3 = st; + } + + private HtmlPanelGrid gridMsg = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridMsg() { + return gridMsg; + } + + public void setGridMsg(HtmlPanelGrid hpg) { + this.gridMsg = hpg; + } + + private StaticText txtMsg = new StaticText(); + + public StaticText getTxtMsg() { + return txtMsg; + } + + public void setTxtMsg(StaticText st) { + this.txtMsg = st; + } + + private HtmlPanelGrid gridCabecalho = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridCabecalho() { + return gridCabecalho; + } + + public void setGridCabecalho(HtmlPanelGrid hpg) { + this.gridCabecalho = hpg; + } + + private HtmlPanelGrid gridPanel2 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel2() { + return gridPanel2; + } + + public void setGridPanel2(HtmlPanelGrid hpg) { + this.gridPanel2 = hpg; + } + + private StaticText lblEmpresa1 = new StaticText(); + + public StaticText getLblEmpresa1() { + return lblEmpresa1; + } + + public void setLblEmpresa1(StaticText st) { + this.lblEmpresa1 = st; + } + + private StaticText txtEmpresa = new StaticText(); + + public StaticText getTxtEmpresa() { + return txtEmpresa; + } + + public void setTxtEmpresa(StaticText st) { + this.txtEmpresa = st; + } + + private StaticText staticText4 = new StaticText(); + + public StaticText getStaticText4() { + return staticText4; + } + + public void setStaticText4(StaticText st) { + this.staticText4 = st; + } + + private StaticText txtEstabelecimento = new StaticText(); + + public StaticText getTxtEstabelecimento() { + return txtEstabelecimento; + } + + public void setTxtEstabelecimento(StaticText st) { + this.txtEstabelecimento = st; + } + + private StaticText txtTrabalhador = new StaticText(); + + public StaticText getTxtTrabalhador() { + return txtTrabalhador; + } + + public void setTxtTrabalhador(StaticText st) { + this.txtTrabalhador = st; + } + + private HtmlPanelGrid gridTrabalhadores = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridTrabalhadores() { + return gridTrabalhadores; + } + + public void setGridTrabalhadores(HtmlPanelGrid hpg) { + this.gridTrabalhadores = hpg; + } + + private HtmlPanelGrid gridPanel3 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel3() { + return gridPanel3; + } + + public void setGridPanel3(HtmlPanelGrid hpg) { + this.gridPanel3 = hpg; + } + + private StaticText staticText5 = new StaticText(); + + public StaticText getStaticText5() { + return staticText5; + } + + public void setStaticText5(StaticText st) { + this.staticText5 = st; + } + + private HtmlPanelGrid gridPanel4 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel4() { + return gridPanel4; + } + + public void setGridPanel4(HtmlPanelGrid hpg) { + this.gridPanel4 = hpg; + } + + private Table table1 = new Table(); + + public Table getTable1() { + return table1; + } + + public void setTable1(Table t) { + this.table1 = t; + } + + private TableRowGroup tableRowGroup1 = new TableRowGroup(); + + public TableRowGroup getTableRowGroup1() { + return tableRowGroup1; + } + + public void setTableRowGroup1(TableRowGroup trg) { + this.tableRowGroup1 = trg; + } + + private TableColumn tableColumn1 = new TableColumn(); + + public TableColumn getTableColumn1() { + return tableColumn1; + } + + public void setTableColumn1(TableColumn tc) { + this.tableColumn1 = tc; + } + + private Hyperlink lnkNome1 = new Hyperlink(); + + public Hyperlink getLnkNome1() { + return lnkNome1; + } + + public void setLnkNome1(Hyperlink h) { + this.lnkNome1 = h; + } + + private TableColumn tableColumn2 = new TableColumn(); + + public TableColumn getTableColumn2() { + return tableColumn2; + } + + public void setTableColumn2(TableColumn tc) { + this.tableColumn2 = tc; + } + + private Hyperlink lnkDataNascimento1 = new Hyperlink(); + + public Hyperlink getLnkDataNascimento1() { + return lnkDataNascimento1; + } + + public void setLnkDataNascimento1(Hyperlink h) { + this.lnkDataNascimento1 = h; + } + + private StaticText txtSearchMsg = new StaticText(); + + public StaticText getTxtSearchMsg() { + return txtSearchMsg; + } + + public void setTxtSearchMsg(StaticText st) { + this.txtSearchMsg = st; + } + + private HtmlPanelGrid gridSiprp = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridSiprp() { + return gridSiprp; + } + + public void setGridSiprp(HtmlPanelGrid hpg) { + this.gridSiprp = hpg; + } + + private HtmlPanelGrid gridPanel5 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel5() { + return gridPanel5; + } + + public void setGridPanel5(HtmlPanelGrid hpg) { + this.gridPanel5 = hpg; + } + + private StaticText staticText6 = new StaticText(); + + public StaticText getStaticText6() { + return staticText6; + } + + public void setStaticText6(StaticText st) { + this.staticText6 = st; + } + + private HtmlPanelGrid gridPanel6 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel6() { + return gridPanel6; + } + + public void setGridPanel6(HtmlPanelGrid hpg) { + this.gridPanel6 = hpg; + } + + private HtmlPanelGrid gridPanel7 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel7() { + return gridPanel7; + } + + public void setGridPanel7(HtmlPanelGrid hpg) { + this.gridPanel7 = hpg; + } + + private StaticText staticText7 = new StaticText(); + + public StaticText getStaticText7() { + return staticText7; + } + + public void setStaticText7(StaticText st) { + this.staticText7 = st; + } + + private StaticText staticText8 = new StaticText(); + + public StaticText getStaticText8() { + return staticText8; + } + + public void setStaticText8(StaticText st) { + this.staticText8 = st; + } + + private StaticText staticText9 = new StaticText(); + + public StaticText getStaticText9() { + return staticText9; + } + + public void setStaticText9(StaticText st) { + this.staticText9 = st; + } + + private PanelGroup groupPanel3 = new PanelGroup(); + + public PanelGroup getGroupPanel3() { + return groupPanel3; + } + + public void setGroupPanel3(PanelGroup pg) { + this.groupPanel3 = pg; + } + + private DropDown dropDown1 = new DropDown(); + + public DropDown getDropDown1() { + return dropDown1; + } + + public void setDropDown1(DropDown dd) { + this.dropDown1 = dd; + } + + private StaticText staticText10 = new StaticText(); + + public StaticText getStaticText10() { + return staticText10; + } + + public void setStaticText10(StaticText st) { + this.staticText10 = st; + } + + private StaticText txtCap = new StaticText(); + + public StaticText getTxtCap() { + return txtCap; + } + + public void setTxtCap(StaticText st) { + this.txtCap = st; + } + + private StaticText staticText11 = new StaticText(); + + public StaticText getStaticText11() { + return staticText11; + } + + public void setStaticText11(StaticText st) { + this.staticText11 = st; + } + + private PanelGroup groupPanel4 = new PanelGroup(); + + public PanelGroup getGroupPanel4() { + return groupPanel4; + } + + public void setGroupPanel4(PanelGroup pg) { + this.groupPanel4 = pg; + } + + private DropDown dropDown2 = new DropDown(); + + public DropDown getDropDown2() { + return dropDown2; + } + + public void setDropDown2(DropDown dd) { + this.dropDown2 = dd; + } + + private StaticText staticText12 = new StaticText(); + + public StaticText getStaticText12() { + return staticText12; + } + + public void setStaticText12(StaticText st) { + this.staticText12 = st; + } + + private StaticText txtCedula = new StaticText(); + + public StaticText getTxtCedula() { + return txtCedula; + } + + public void setTxtCedula(StaticText st) { + this.txtCedula = st; + } + + private HtmlPanelGrid gridAcidentado = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridAcidentado() { + return gridAcidentado; + } + + public void setGridAcidentado(HtmlPanelGrid hpg) { + this.gridAcidentado = hpg; + } + + private HtmlPanelGrid gridPanel8 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel8() { + return gridPanel8; + } + + public void setGridPanel8(HtmlPanelGrid hpg) { + this.gridPanel8 = hpg; + } + + private StaticText staticText13 = new StaticText(); + + public StaticText getStaticText13() { + return staticText13; + } + + public void setStaticText13(StaticText st) { + this.staticText13 = st; + } + + private HtmlPanelGrid gridPanel9 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel9() { + return gridPanel9; + } + + public void setGridPanel9(HtmlPanelGrid hpg) { + this.gridPanel9 = hpg; + } + + private HtmlPanelGrid gridPanel10 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel10() { + return gridPanel10; + } + + public void setGridPanel10(HtmlPanelGrid hpg) { + this.gridPanel10 = hpg; + } + + private StaticText staticText14 = new StaticText(); + + public StaticText getStaticText14() { + return staticText14; + } + + public void setStaticText14(StaticText st) { + this.staticText14 = st; + } + + private StaticText txtNomeAcidentado = new StaticText(); + + public StaticText getTxtNomeAcidentado() { + return txtNomeAcidentado; + } + + public void setTxtNomeAcidentado(StaticText st) { + this.txtNomeAcidentado = st; + } + + private StaticText staticText15 = new StaticText(); + + public StaticText getStaticText15() { + return staticText15; + } + + public void setStaticText15(StaticText st) { + this.staticText15 = st; + } + + private StaticText txtDataNascimento = new StaticText(); + + public StaticText getTxtDataNascimento() { + return txtDataNascimento; + } + + public void setTxtDataNascimento(StaticText st) { + this.txtDataNascimento = st; + } + + private StaticText staticText16 = new StaticText(); + + public StaticText getStaticText16() { + return staticText16; + } + + public void setStaticText16(StaticText st) { + this.staticText16 = st; + } + + private TextField txtHorasTurno = new TextField(); + + public TextField getTxtHorasTurno() { + return txtHorasTurno; + } + + public void setTxtHorasTurno(TextField tf) { + this.txtHorasTurno = tf; + } + + private StaticText staticText17 = new StaticText(); + + public StaticText getStaticText17() { + return staticText17; + } + + public void setStaticText17(StaticText st) { + this.staticText17 = st; + } + + private TextField txtSeccao = new TextField(); + + public TextField getTxtSeccao() { + return txtSeccao; + } + + public void setTxtSeccao(TextField tf) { + this.txtSeccao = tf; + } + + private StaticText staticText18 = new StaticText(); + + public StaticText getStaticText18() { + return staticText18; + } + + public void setStaticText18(StaticText st) { + this.staticText18 = st; + } + + private TextField txtLocal = new TextField(); + + public TextField getTxtLocal() { + return txtLocal; + } + + public void setTxtLocal(TextField tf) { + this.txtLocal = tf; + } + + private HtmlPanelGrid gridPanel11 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel11() { + return gridPanel11; + } + + public void setGridPanel11(HtmlPanelGrid hpg) { + this.gridPanel11 = hpg; + } + + private StaticText staticText19 = new StaticText(); + + public StaticText getStaticText19() { + return staticText19; + } + + public void setStaticText19(StaticText st) { + this.staticText19 = st; + } + + private TextField txtTarefa = new TextField(); + + public TextField getTxtTarefa() { + return txtTarefa; + } + + public void setTxtTarefa(TextField tf) { + this.txtTarefa = tf; + } + + private HtmlPanelGrid gridPanel12 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel12() { + return gridPanel12; + } + + public void setGridPanel12(HtmlPanelGrid hpg) { + this.gridPanel12 = hpg; + } + + private StaticText staticText20 = new StaticText(); + + public StaticText getStaticText20() { + return staticText20; + } + + public void setStaticText20(StaticText st) { + this.staticText20 = st; + } + + private TextField txtSubstancias = new TextField(); + + public TextField getTxtSubstancias() { + return txtSubstancias; + } + + public void setTxtSubstancias(TextField tf) { + this.txtSubstancias = tf; + } + + private HtmlPanelGrid gridPanel13 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel13() { + return gridPanel13; + } + + public void setGridPanel13(HtmlPanelGrid hpg) { + this.gridPanel13 = hpg; + } + + private StaticText staticText21 = new StaticText(); + + public StaticText getStaticText21() { + return staticText21; + } + + public void setStaticText21(StaticText st) { + this.staticText21 = st; + } + + private TextField txtSuperior = new TextField(); + + public TextField getTxtSuperior() { + return txtSuperior; + } + + public void setTxtSuperior(TextField tf) { + this.txtSuperior = tf; + } + + private HtmlPanelGrid gridPanel14 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel14() { + return gridPanel14; + } + + public void setGridPanel14(HtmlPanelGrid hpg) { + this.gridPanel14 = hpg; + } + + private StaticText staticText22 = new StaticText(); + + public StaticText getStaticText22() { + return staticText22; + } + + public void setStaticText22(StaticText st) { + this.staticText22 = st; + } + + private TextField txtCondicoes = new TextField(); + + public TextField getTxtCondicoes() { + return txtCondicoes; + } + + public void setTxtCondicoes(TextField tf) { + this.txtCondicoes = tf; + } + + private HtmlPanelGrid gridPanel15 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel15() { + return gridPanel15; + } + + public void setGridPanel15(HtmlPanelGrid hpg) { + this.gridPanel15 = hpg; + } + + private StaticText staticText23 = new StaticText(); + + public StaticText getStaticText23() { + return staticText23; + } + + public void setStaticText23(StaticText st) { + this.staticText23 = st; + } + + private TextField txtTestemunhas = new TextField(); + + public TextField getTxtTestemunhas() { + return txtTestemunhas; + } + + public void setTxtTestemunhas(TextField tf) { + this.txtTestemunhas = tf; + } + + private HtmlPanelGrid gridPanel16 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel16() { + return gridPanel16; + } + + public void setGridPanel16(HtmlPanelGrid hpg) { + this.gridPanel16 = hpg; + } + + private StaticText staticText24 = new StaticText(); + + public StaticText getStaticText24() { + return staticText24; + } + + public void setStaticText24(StaticText st) { + this.staticText24 = st; + } + + private TextField txtCausas = new TextField(); + + public TextField getTxtCausas() { + return txtCausas; + } + + public void setTxtCausas(TextField tf) { + this.txtCausas = tf; + } + + private HtmlPanelGrid gridPanel17 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel17() { + return gridPanel17; + } + + public void setGridPanel17(HtmlPanelGrid hpg) { + this.gridPanel17 = hpg; + } + + private StaticText staticText25 = new StaticText(); + + public StaticText getStaticText25() { + return staticText25; + } + + public void setStaticText25(StaticText st) { + this.staticText25 = st; + } + + private TextField txtDescricao = new TextField(); + + public TextField getTxtDescricao() { + return txtDescricao; + } + + public void setTxtDescricao(TextField tf) { + this.txtDescricao = tf; + } + + private HtmlPanelGrid gridPanel18 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel18() { + return gridPanel18; + } + + public void setGridPanel18(HtmlPanelGrid hpg) { + this.gridPanel18 = hpg; + } + + private HtmlPanelGrid gridPanel19 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel19() { + return gridPanel19; + } + + public void setGridPanel19(HtmlPanelGrid hpg) { + this.gridPanel19 = hpg; + } + + private StaticText staticText26 = new StaticText(); + + public StaticText getStaticText26() { + return staticText26; + } + + public void setStaticText26(StaticText st) { + this.staticText26 = st; + } + + private Button butImagem = new Button(); + + public Button getButImagem() { + return butImagem; + } + + public void setButImagem(Button b) { + this.butImagem = b; + } + + private HtmlPanelGrid gridImages = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridImages() { + return gridImages; + } + + public void setGridImages(HtmlPanelGrid hpg) { + this.gridImages = hpg; + } + + private HtmlPanelGrid gridPanel20 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel20() { + return gridPanel20; + } + + public void setGridPanel20(HtmlPanelGrid hpg) { + this.gridPanel20 = hpg; + } + + private StaticText staticText27 = new StaticText(); + + public StaticText getStaticText27() { + return staticText27; + } + + public void setStaticText27(StaticText st) { + this.staticText27 = st; + } + + private TextArea txtConclusoes = new TextArea(); + + public TextArea getTxtConclusoes() { + return txtConclusoes; + } + + public void setTxtConclusoes(TextArea ta) { + this.txtConclusoes = ta; + } + + private HtmlPanelGrid gridPanel21 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel21() { + return gridPanel21; + } + + public void setGridPanel21(HtmlPanelGrid hpg) { + this.gridPanel21 = hpg; + } + + private StaticText staticText28 = new StaticText(); + + public StaticText getStaticText28() { + return staticText28; + } + + public void setStaticText28(StaticText st) { + this.staticText28 = st; + } + + private TextArea txtAccoes = new TextArea(); + + public TextArea getTxtAccoes() { + return txtAccoes; + } + + public void setTxtAccoes(TextArea ta) { + this.txtAccoes = ta; + } + + private HtmlPanelGrid gridPanel22 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel22() { + return gridPanel22; + } + + public void setGridPanel22(HtmlPanelGrid hpg) { + this.gridPanel22 = hpg; + } + + private Button butCancelar = new Button(); + + public Button getButCancelar() { + return butCancelar; + } + + public void setButCancelar(Button b) { + this.butCancelar = b; + } + + //
+ private String IMAGE_URL = "/resources/images"; + + private PanelGroup groupPanel5 = new PanelGroup(); + + public PanelGroup getGroupPanel5() { + return groupPanel5; + } + + public void setGroupPanel5(PanelGroup pg) { + this.groupPanel5 = pg; + } + + private Button butGravar = new Button(); + + public Button getButGravar() { + return butGravar; + } + + public void setButGravar(Button b) { + this.butGravar = b; + } + + private Button butEnviar = new Button(); + + public Button getButEnviar() { + return butEnviar; + } + + public void setButEnviar(Button b) { + this.butEnviar = b; + } + + private Hyperlink lnkLblTrabalhador = new Hyperlink(); + + public Hyperlink getLnkLblTrabalhador() { + return lnkLblTrabalhador; + } + + public void setLnkLblTrabalhador(Hyperlink h) { + this.lnkLblTrabalhador = h; + } + /** + *

Construct a new Page bean instance.

+ */ + public AnaliseAcidenteTrabalho() { + } + + /** + *

Callback method that is called whenever a page is navigated to, + * either directly via a URL, or indirectly via page navigation. + * Customize this method to acquire resources that will be needed + * for event handlers and lifecycle methods, whether or not this + * page is performing post back processing.

+ * + *

Note that, if the current request is a postback, the property + * values of the components do not represent any + * values submitted with this request. Instead, they represent the + * property values that were saved for this view when it was rendered.

+ */ + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + // + // Initialize automatically managed components + // *Note* - this logic should NOT be modified + try { + _init(); + } catch (Exception e) { + log("AnaliseAcidenteTrabalho Initialization Failure", e); + throw e instanceof FacesException ? (FacesException) e: new FacesException(e); + } + + // + // Perform application initialization that must complete + // *after* managed components are initialized + // TODO - add your own initialization code here + + if (!getSessionBean1().isLoggedIn()) { + try { + getExternalContext().redirect("Login.jsp"); + } catch(Exception e) { + // . . . handle exception . . . + } + } + + HttpServletRequest request = (HttpServletRequest) getExternalContext().getRequest(); + String referer = request.getRequestURI(); + String pageFrom = getPageFrom(referer); + if(!pageFrom.matches("AnaliseAcidenteTrabalho.jsp")) + { + if(pageFrom.matches("LoadImage.jsp")) + { + restorePageState(); + fillImages(); + } + else + { + lblUser.setText( getSessionBean1().getCurrentUser().getLogin() ); + if(getSessionBean1().getCurrentAnalise() == null) // new analise + { + getSessionBean1().setAcidentado(null); // Here ????? + lnkLblTrabalhador.setDisabled(true); + lnkLblTrabalhador.setStyleClass(""); + initializePage(); + } + else // edit analise + { + fillPage(); + lnkLblTrabalhador.setDisabled(false); + lnkLblTrabalhador.setStyleClass("labelTrabalhador"); + gridTrabalhadores.setRendered(false); + } + + } + } + } + + /** + *

Callback method that is called after the component tree has been + * restored, but before any event processing takes place. This method + * will only be called on a postback request that + * is processing a form submit. Customize this method to allocate + * resources that will be required in your event handlers.

+ */ + public void preprocess() { + } + + /** + *

Callback method that is called just before rendering takes place. + * This method will only be called for the page that + * will actually be rendered (and not, for example, on a page that + * handled a postback and then navigated to a different page). Customize + * this method to allocate resources that will be required for rendering + * this page.

+ */ + public void prerender() { + txtMsg.setText(getSessionBean1().getMsg()); + getSessionBean1().setMsg(""); + } + + /** + *

Callback method that is called after rendering is completed for + * this request, if init() was called (regardless of whether + * or not this was the page that was actually rendered). Customize this + * method to release resources acquired in the init(), + * preprocess(), or prerender() methods (or + * acquired during execution of an event handler).

+ */ + public void destroy() { + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1)getBean("RequestBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1)getBean("SessionBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1)getBean("ApplicationBean1"); + } + + public String lnkLogout_action() { + // TODO: Replace with your code + + javax.servlet.http.HttpSession session = + (javax.servlet.http.HttpSession) getExternalContext().getSession(true); + session.invalidate(); + return "login"; + } + + + private void initializePage() + { + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + txtEstabelecimento.setText(adp.getEstabelecimentoNome(getSessionBean1().getCurrentUser().getEstabelecimento_id())); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + fillTrabalhadoresTable(); + } + + private void fillTrabalhadoresTable() + { + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + //lblActivos.setRendered(true); + table1.setRendered(true); + + ArrayList trabalhadoresList = adp.getTrabalhadoresListByEstabelecimento(getSessionBean1().getCurrentUser().getEstabelecimento_id()); + getSessionBean1().getTrabalhadoresListDataProvider().setList(trabalhadoresList); + } + catch(Exception ex) + { + //lblActivos.setRendered(false); + table1.setRendered(false); + ex.printStackTrace(); + } + } + + private String fillPage() + { + AnaliseAcidente a = getSessionBean1().getCurrentAnalise(); + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + txtEstabelecimento.setText(adp.getEstabelecimentoNome(a.getEstabelecimento_id())); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + try + { + Trabalhador t = adp.getTrabalhador(a.getTrabalhador_id()); + txtDataNascimento.setText(t.getData_nascimento()); + getSessionBean1().setAcidentado(t); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + txtTrabalhador.setText(a.getNome_acidentado()); + txtNomeAcidentado.setText(a.getNome_acidentado()); + txtHorasTurno.setText(a.getHoras_turno().toString()); + txtSeccao.setText(a.getSeccao()); + txtLocal.setText(a.getLocal_trabalho()); + txtTarefa.setText(a.getTarefa()); + txtSubstancias.setText(a.getSubstancias()); + txtSuperior.setText(a.getSuperior_hierarquico()); + txtCondicoes.setText(a.getCondicoes()); + txtTestemunhas.setText(a.getTestemunhas()); + txtCausas.setText(a.getCausas()); + txtDescricao.setText(a.getDescricao()); + txtConclusoes.setText(a.getConclusoes()); + txtAccoes.setText(a.getAccoes()); + + //fill images + ServletContext theApplicationsServletContext = + (ServletContext) this.getExternalContext().getContext(); + String imageFileFolder = theApplicationsServletContext.getRealPath(IMAGE_URL + "/" + getSessionBean1().getCurrentAnalise().getId()); + try + { + File f = new File(imageFileFolder); + + if(f.exists()) + { + File images[] = f.listFiles(); + + for(int i=0;i 99) + { + getSessionBean1().setMsg("As horas turno devem ser entre 0 e 99 !"); + return false; + } + } + catch(Exception ex) + { + getSessionBean1().setMsg("As horas turno devem ser um valor numérico !"); + return false; + } + } + return true; + } + + private void createImagesFolder(String folderName) + { + ServletContext theApplicationsServletContext = + (ServletContext) this.getExternalContext().getContext(); + String imageFileFolder = theApplicationsServletContext.getRealPath(IMAGE_URL + "/" + folderName); + try + { + String imageFileFolderTmp = theApplicationsServletContext.getRealPath(IMAGE_URL + "/tmp" + getSessionBean1().getCurrentUser().getLogin()); + File f = new File(imageFileFolderTmp); + if( f.exists() ) + { + File folder = new File(imageFileFolder); + folder.mkdir(); + + File files[] = f.listFiles(); + + for(int i=0;iApplication scope data bean for your application. Create properties + * here to represent cached data that should be made available to all users + * and pages in the application.

+ * + *

An instance of this class will be created for you automatically, + * the first time your application evaluates a value binding expression + * or method binding expression that references a managed bean using + * this class.

+ */ +public class ApplicationBean1 extends AbstractApplicationBean { + // + private int __placeholder; + + /** + *

Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.

+ */ + private void _init() throws Exception { + } + //
+ + /** + *

Construct a new application data bean instance.

+ */ + public ApplicationBean1() { + } + + /** + *

This method is called when this bean is initially added to + * application scope. Typically, this occurs as a result of evaluating + * a value binding or method binding expression, which utilizes the + * managed bean facility to instantiate this bean and store it into + * application scope.

+ * + *

You may customize this method to initialize and cache application wide + * data values (such as the lists of valid options for dropdown list + * components), or to allocate resources that are required for the + * lifetime of the application.

+ */ + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + // + // Initialize automatically managed components + // *Note* - this logic should NOT be modified + try { + _init(); + } catch (Exception e) { + log("ApplicationBean1 Initialization Failure", e); + throw e instanceof FacesException ? (FacesException) e: new FacesException(e); + } + + // + // Perform application initialization that must complete + // *after* managed components are initialized + // TODO - add your own initialization code here + } + + /** + *

This method is called when this bean is removed from + * application scope. Typically, this occurs as a result of + * the application being shut down by its owning container.

+ * + *

You may customize this method to clean up resources allocated + * during the execution of the init() method, or + * at any later time during the lifetime of the application.

+ */ + public void destroy() { + } + + /** + *

Return an appropriate character encoding based on the + * Locale defined for the current JavaServer Faces + * view. If no more suitable encoding can be found, return + * "UTF-8" as a general purpose default.

+ * + *

The default implementation uses the implementation from + * our superclass, AbstractApplicationBean.

+ */ + public String getLocaleCharacterEncoding() { + return super.getLocaleCharacterEncoding(); + } +} diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Bundle.properties b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Bundle.properties new file mode 100644 index 00000000..13e936fe --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Bundle.properties @@ -0,0 +1 @@ +# Sample ResourceBundle properties file diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Dummy.java b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Dummy.java new file mode 100644 index 00000000..26653e04 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Dummy.java @@ -0,0 +1,263 @@ +/* + * Dummy.java + * + * Created on September 19, 2007, 10:56 AM + * Copyright lluis + */ +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.DropDown; +import com.sun.rave.web.ui.component.Form; +import com.sun.rave.web.ui.component.Head; +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.ImageHyperlink; +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.component.TextArea; +import com.sun.rave.web.ui.component.TextField; +import com.sun.rave.web.ui.component.Upload; +import com.sun.rave.web.ui.model.SingleSelectOptionsList; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; + +/** + *

Page bean that corresponds to a similarly named JSP page. This + * class contains component definitions (and initialization code) for + * all components that you have defined on this page, as well as + * lifecycle methods and event handlers where you may add behavior + * to respond to incoming events.

+ */ +public class Dummy extends AbstractPageBean { + // + private int __placeholder; + + /** + *

Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.

+ */ + private void _init() throws Exception { + } + + private Page page1 = new Page(); + + public Page getPage1() { + return page1; + } + + public void setPage1(Page p) { + this.page1 = p; + } + + private Html html1 = new Html(); + + public Html getHtml1() { + return html1; + } + + public void setHtml1(Html h) { + this.html1 = h; + } + + private Head head1 = new Head(); + + public Head getHead1() { + return head1; + } + + public void setHead1(Head h) { + this.head1 = h; + } + + private Link link1 = new Link(); + + public Link getLink1() { + return link1; + } + + public void setLink1(Link l) { + this.link1 = l; + } + + private Body body1 = new Body(); + + public Body getBody1() { + return body1; + } + + public void setBody1(Body b) { + this.body1 = b; + } + + private Form form1 = new Form(); + + public Form getForm1() { + return form1; + } + + public void setForm1(Form f) { + this.form1 = f; + } + + private HtmlPanelGrid gridPanel3 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel3() { + return gridPanel3; + } + + public void setGridPanel3(HtmlPanelGrid hpg) { + this.gridPanel3 = hpg; + } + + private TextField txtIn = new TextField(); + + public TextField getTxtIn() { + return txtIn; + } + + public void setTxtIn(TextField tf) { + this.txtIn = tf; + } + + private Button button1 = new Button(); + + public Button getButton1() { + return button1; + } + + public void setButton1(Button b) { + this.button1 = b; + } + + private StaticText staticText1 = new StaticText(); + + public StaticText getStaticText1() { + return staticText1; + } + + public void setStaticText1(StaticText st) { + this.staticText1 = st; + } + + private Hyperlink lnkLblTrabalhador = new Hyperlink(); + + public Hyperlink getLnkLblTrabalhador() { + return lnkLblTrabalhador; + } + + public void setLnkLblTrabalhador(Hyperlink h) { + this.lnkLblTrabalhador = h; + } + + //
+ + /** + *

Construct a new Page bean instance.

+ */ + public Dummy() { + } + + /** + *

Callback method that is called whenever a page is navigated to, + * either directly via a URL, or indirectly via page navigation. + * Customize this method to acquire resources that will be needed + * for event handlers and lifecycle methods, whether or not this + * page is performing post back processing.

+ * + *

Note that, if the current request is a postback, the property + * values of the components do not represent any + * values submitted with this request. Instead, they represent the + * property values that were saved for this view when it was rendered.

+ */ + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + // + // Initialize automatically managed components + // *Note* - this logic should NOT be modified + try { + _init(); + } catch (Exception e) { + log("Dummy Initialization Failure", e); + throw e instanceof FacesException ? (FacesException) e: new FacesException(e); + } + + // + // Perform application initialization that must complete + // *after* managed components are initialized + // TODO - add your own initialization code here + } + + /** + *

Callback method that is called after the component tree has been + * restored, but before any event processing takes place. This method + * will only be called on a postback request that + * is processing a form submit. Customize this method to allocate + * resources that will be required in your event handlers.

+ */ + public void preprocess() { + } + + /** + *

Callback method that is called just before rendering takes place. + * This method will only be called for the page that + * will actually be rendered (and not, for example, on a page that + * handled a postback and then navigated to a different page). Customize + * this method to allocate resources that will be required for rendering + * this page.

+ */ + public void prerender() { + txtIn.setText("OLA"); + } + + /** + *

Callback method that is called after rendering is completed for + * this request, if init() was called (regardless of whether + * or not this was the page that was actually rendered). Customize this + * method to release resources acquired in the init(), + * preprocess(), or prerender() methods (or + * acquired during execution of an event handler).

+ */ + public void destroy() { + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1)getBean("RequestBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1)getBean("SessionBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1)getBean("ApplicationBean1"); + } + + public String button1_action() { + // TODO: Process the button click action. Return value is a navigation + // case name where null will return to the same page. + System.out.println("TEXT : " + txtIn.getText().toString()); + return null; + } +} + diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Erro.java b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Erro.java new file mode 100644 index 00000000..66aa2dc1 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Erro.java @@ -0,0 +1,239 @@ +/* + * Error.java + * + * Created on September 19, 2007, 5:21 PM + * Copyright lluis + */ +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.Form; +import com.sun.rave.web.ui.component.Head; +import com.sun.rave.web.ui.component.Html; +import com.sun.rave.web.ui.component.Link; +import com.sun.rave.web.ui.component.Page; +import com.sun.rave.web.ui.component.StaticText; +import com.sun.rave.web.ui.component.TextField; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; + +/** + *

Page bean that corresponds to a similarly named JSP page. This + * class contains component definitions (and initialization code) for + * all components that you have defined on this page, as well as + * lifecycle methods and event handlers where you may add behavior + * to respond to incoming events.

+ */ +public class Erro extends AbstractPageBean { + // + private int __placeholder; + + /** + *

Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.

+ */ + private void _init() throws Exception { + } + + private Page page1 = new Page(); + + public Page getPage1() { + return page1; + } + + public void setPage1(Page p) { + this.page1 = p; + } + + private Html html1 = new Html(); + + public Html getHtml1() { + return html1; + } + + public void setHtml1(Html h) { + this.html1 = h; + } + + private Head head1 = new Head(); + + public Head getHead1() { + return head1; + } + + public void setHead1(Head h) { + this.head1 = h; + } + + private Link link1 = new Link(); + + public Link getLink1() { + return link1; + } + + public void setLink1(Link l) { + this.link1 = l; + } + + private Body body1 = new Body(); + + public Body getBody1() { + return body1; + } + + public void setBody1(Body b) { + this.body1 = b; + } + + private Form form1 = new Form(); + + public Form getForm1() { + return form1; + } + + public void setForm1(Form f) { + this.form1 = f; + } + + private HtmlPanelGrid gridPanel1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel1() { + return gridPanel1; + } + + public void setGridPanel1(HtmlPanelGrid hpg) { + this.gridPanel1 = hpg; + } + + private HtmlPanelGrid gridPanel2 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel2() { + return gridPanel2; + } + + public void setGridPanel2(HtmlPanelGrid hpg) { + this.gridPanel2 = hpg; + } + + private StaticText txtCab = new StaticText(); + + public StaticText getTxtCab() { + return txtCab; + } + + public void setTxtCab(StaticText st) { + this.txtCab = st; + } + + private StaticText txtMsg = new StaticText(); + + public StaticText getTxtMsg() { + return txtMsg; + } + + public void setTxtMsg(StaticText st) { + this.txtMsg = st; + } + + //
+ + /** + *

Construct a new Page bean instance.

+ */ + public Erro() { + } + + /** + *

Callback method that is called whenever a page is navigated to, + * either directly via a URL, or indirectly via page navigation. + * Customize this method to acquire resources that will be needed + * for event handlers and lifecycle methods, whether or not this + * page is performing post back processing.

+ * + *

Note that, if the current request is a postback, the property + * values of the components do not represent any + * values submitted with this request. Instead, they represent the + * property values that were saved for this view when it was rendered.

+ */ + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + // + // Initialize automatically managed components + // *Note* - this logic should NOT be modified + try { + _init(); + } catch (Exception e) { + log("Error Initialization Failure", e); + throw e instanceof FacesException ? (FacesException) e: new FacesException(e); + } + + // + // Perform application initialization that must complete + // *after* managed components are initialized + // TODO - add your own initialization code here + } + + /** + *

Callback method that is called after the component tree has been + * restored, but before any event processing takes place. This method + * will only be called on a postback request that + * is processing a form submit. Customize this method to allocate + * resources that will be required in your event handlers.

+ */ + public void preprocess() { + } + + /** + *

Callback method that is called just before rendering takes place. + * This method will only be called for the page that + * will actually be rendered (and not, for example, on a page that + * handled a postback and then navigated to a different page). Customize + * this method to allocate resources that will be required for rendering + * this page.

+ */ + public void prerender() { + txtMsg.setText( getSessionBean1().getMsg() ); + getSessionBean1().setMsg(""); + System.out.println("ERROR PAGE"); + } + + /** + *

Callback method that is called after rendering is completed for + * this request, if init() was called (regardless of whether + * or not this was the page that was actually rendered). Customize this + * method to release resources acquired in the init(), + * preprocess(), or prerender() methods (or + * acquired during execution of an event handler).

+ */ + public void destroy() { + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1)getBean("ApplicationBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1)getBean("RequestBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1)getBean("SessionBean1"); + } +} + diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Footer.java b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Footer.java new file mode 100644 index 00000000..52f9e49d --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Footer.java @@ -0,0 +1,152 @@ +/* + * Footer.java + * + * Created on September 19, 2007, 10:57 AM + * Copyright lluis + */ +package analiseacidentestrabalho; + +import com.sun.rave.web.ui.appbase.AbstractFragmentBean; +import com.sun.rave.web.ui.component.ImageComponent; +import com.sun.rave.web.ui.component.PanelGroup; +import com.sun.rave.web.ui.component.StaticText; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; + +/** + *

Fragment bean that corresponds to a similarly named JSP page + * fragment. This class contains component definitions (and initialization + * code) for all components that you have defined on this fragment, as well as + * lifecycle methods and event handlers where you may add behavior + * to respond to incoming events.

+ */ +public class Footer extends AbstractFragmentBean { + // + private int __placeholder; + + /** + *

Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.

+ */ + private void _init() throws Exception { + } + + private HtmlPanelGrid gridPanel1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel1() { + return gridPanel1; + } + + public void setGridPanel1(HtmlPanelGrid hpg) { + this.gridPanel1 = hpg; + } + + private PanelGroup groupPanel1 = new PanelGroup(); + + public PanelGroup getGroupPanel1() { + return groupPanel1; + } + + public void setGroupPanel1(PanelGroup pg) { + this.groupPanel1 = pg; + } + + private StaticText staticText1 = new StaticText(); + + public StaticText getStaticText1() { + return staticText1; + } + + public void setStaticText1(StaticText st) { + this.staticText1 = st; + } + + private StaticText staticText2 = new StaticText(); + + public StaticText getStaticText2() { + return staticText2; + } + + public void setStaticText2(StaticText st) { + this.staticText2 = st; + } + + private ImageComponent image1 = new ImageComponent(); + + public ImageComponent getImage1() { + return image1; + } + + public void setImage1(ImageComponent ic) { + this.image1 = ic; + } + //
+ + public Footer() { + } + + /** + *

Callback method that is called whenever a page containing + * this page fragment is navigated to, either directly via a URL, + * or indirectly via page navigation. Override this method to acquire + * resources that will be needed for event handlers and lifecycle methods.

+ * + *

The default implementation does nothing.

+ */ + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + + // + // Initialize automatically managed components + // *Note* - this logic should NOT be modified + try { + _init(); + } catch (Exception e) { + log("Page1 Initialization Failure", e); + throw e instanceof FacesException ? (FacesException) e: new FacesException(e); + } + + // + // Perform application initialization that must complete + // *after* managed components are initialized + // TODO - add your own initialization code here + } + + /** + *

Callback method that is called after rendering is completed for + * this request, if init() was called. Override this + * method to release resources acquired in the init() + * resources that will be needed for event handlers and lifecycle methods.

+ * + *

The default implementation does nothing.

+ */ + public void destroy() { + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1)getBean("RequestBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1)getBean("SessionBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1)getBean("ApplicationBean1"); + } +} diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormHS.java b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormHS.java new file mode 100644 index 00000000..2041d12f --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/FormHS.java @@ -0,0 +1,1232 @@ +/* + * FormHS.java + * + * Created on October 1, 2007, 1:43 PM + * Copyright lluis + */ +package analiseacidentestrabalho; + +import com.sun.data.provider.RowKey; +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.DropDown; +import com.sun.rave.web.ui.component.Form; +import com.sun.rave.web.ui.component.Head; +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.component.Table; +import com.sun.rave.web.ui.component.TableColumn; +import com.sun.rave.web.ui.component.TableRowGroup; +import com.sun.rave.web.ui.component.TextField; +import com.sun.rave.web.ui.model.Option; +import db.AnalisesActualDataProvider; +import db.AnalisesDataProvider; +import db.AnalisesSeguimentoDataProvider; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.GregorianCalendar; +import java.util.ListIterator; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; +import javax.faces.event.ValueChangeEvent; +import javax.servlet.http.HttpServletRequest; + +/** + *

Page bean that corresponds to a similarly named JSP page. This + * class contains component definitions (and initialization code) for + * all components that you have defined on this page, as well as + * lifecycle methods and event handlers where you may add behavior + * to respond to incoming events.

+ */ +public class FormHS extends AbstractPageBean { + // + private int __placeholder; + + /** + *

Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.

+ */ + private void _init() throws Exception { + } + + private Page page1 = new Page(); + + public Page getPage1() { + return page1; + } + + public void setPage1(Page p) { + this.page1 = p; + } + + private Html html1 = new Html(); + + public Html getHtml1() { + return html1; + } + + public void setHtml1(Html h) { + this.html1 = h; + } + + private Head head1 = new Head(); + + public Head getHead1() { + return head1; + } + + public void setHead1(Head h) { + this.head1 = h; + } + + private Link link1 = new Link(); + + public Link getLink1() { + return link1; + } + + public void setLink1(Link l) { + this.link1 = l; + } + + private Body body1 = new Body(); + + public Body getBody1() { + return body1; + } + + public void setBody1(Body b) { + this.body1 = b; + } + + private Form form1 = new Form(); + + public Form getForm1() { + return form1; + } + + public void setForm1(Form f) { + this.form1 = f; + } + + private HtmlPanelGrid gridBase1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridBase1() { + return gridBase1; + } + + public void setGridBase1(HtmlPanelGrid hpg) { + this.gridBase1 = hpg; + } + + private HtmlPanelGrid gridLayout1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridLayout1() { + return gridLayout1; + } + + public void setGridLayout1(HtmlPanelGrid hpg) { + this.gridLayout1 = hpg; + } + + private HtmlPanelGrid gridPanel1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel1() { + return gridPanel1; + } + + public void setGridPanel1(HtmlPanelGrid hpg) { + this.gridPanel1 = hpg; + } + + private PanelGroup groupPanel1 = new PanelGroup(); + + public PanelGroup getGroupPanel1() { + return groupPanel1; + } + + public void setGroupPanel1(PanelGroup pg) { + this.groupPanel1 = pg; + } + + private ImageComponent image1 = new ImageComponent(); + + public ImageComponent getImage1() { + return image1; + } + + public void setImage1(ImageComponent ic) { + this.image1 = ic; + } + + private ImageComponent image2 = new ImageComponent(); + + public ImageComponent getImage2() { + return image2; + } + + public void setImage2(ImageComponent ic) { + this.image2 = ic; + } + + private PanelGroup groupPanel2 = new PanelGroup(); + + public PanelGroup getGroupPanel2() { + return groupPanel2; + } + + public void setGroupPanel2(PanelGroup pg) { + this.groupPanel2 = pg; + } + + private StaticText lblUser = new StaticText(); + + public StaticText getLblUser() { + return lblUser; + } + + public void setLblUser(StaticText st) { + this.lblUser = st; + } + + private StaticText staticText1 = new StaticText(); + + public StaticText getStaticText1() { + return staticText1; + } + + public void setStaticText1(StaticText st) { + this.staticText1 = st; + } + + private Hyperlink lnkChangePassword1 = new Hyperlink(); + + public Hyperlink getLnkChangePassword1() { + return lnkChangePassword1; + } + + public void setLnkChangePassword1(Hyperlink h) { + this.lnkChangePassword1 = h; + } + + private StaticText staticText2 = new StaticText(); + + public StaticText getStaticText2() { + return staticText2; + } + + public void setStaticText2(StaticText st) { + this.staticText2 = st; + } + + private Hyperlink lnkLogout = new Hyperlink(); + + public Hyperlink getLnkLogout() { + return lnkLogout; + } + + public void setLnkLogout(Hyperlink h) { + this.lnkLogout = h; + } + + private StaticText staticText3 = new StaticText(); + + public StaticText getStaticText3() { + return staticText3; + } + + public void setStaticText3(StaticText st) { + this.staticText3 = st; + } + + private HtmlPanelGrid gridLayoutTop1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridLayoutTop1() { + return gridLayoutTop1; + } + + public void setGridLayoutTop1(HtmlPanelGrid hpg) { + this.gridLayoutTop1 = hpg; + } + + private HtmlPanelGrid gridActual1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridActual1() { + return gridActual1; + } + + public void setGridActual1(HtmlPanelGrid hpg) { + this.gridActual1 = hpg; + } + + private HtmlPanelGrid gridPanel2 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel2() { + return gridPanel2; + } + + public void setGridPanel2(HtmlPanelGrid hpg) { + this.gridPanel2 = hpg; + } + + private StaticText staticText4 = new StaticText(); + + public StaticText getStaticText4() { + return staticText4; + } + + public void setStaticText4(StaticText st) { + this.staticText4 = st; + } + + private StaticText staticText5 = new StaticText(); + + public StaticText getStaticText5() { + return staticText5; + } + + public void setStaticText5(StaticText st) { + this.staticText5 = st; + } + + private HtmlPanelGrid gridPanel3 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel3() { + return gridPanel3; + } + + public void setGridPanel3(HtmlPanelGrid hpg) { + this.gridPanel3 = hpg; + } + + private Table table1 = new Table(); + + public Table getTable1() { + return table1; + } + + public void setTable1(Table t) { + this.table1 = t; + } + + private TableRowGroup tableRowGroup1 = new TableRowGroup(); + + public TableRowGroup getTableRowGroup1() { + return tableRowGroup1; + } + + public void setTableRowGroup1(TableRowGroup trg) { + this.tableRowGroup1 = trg; + } + + private TableColumn tableColumn1 = new TableColumn(); + + public TableColumn getTableColumn1() { + return tableColumn1; + } + + public void setTableColumn1(TableColumn tc) { + this.tableColumn1 = tc; + } + + private Hyperlink lnkDataAcidente = new Hyperlink(); + + public Hyperlink getLnkDataAcidente() { + return lnkDataAcidente; + } + + public void setLnkDataAcidente(Hyperlink h) { + this.lnkDataAcidente = h; + } + + private TableColumn tableColumn2 = new TableColumn(); + + public TableColumn getTableColumn2() { + return tableColumn2; + } + + public void setTableColumn2(TableColumn tc) { + this.tableColumn2 = tc; + } + + private Hyperlink lnkNr = new Hyperlink(); + + public Hyperlink getLnkNr() { + return lnkNr; + } + + public void setLnkNr(Hyperlink h) { + this.lnkNr = h; + } + + private TableColumn tableColumn3 = new TableColumn(); + + public TableColumn getTableColumn3() { + return tableColumn3; + } + + public void setTableColumn3(TableColumn tc) { + this.tableColumn3 = tc; + } + + private Hyperlink lnkNomeAcidentado = new Hyperlink(); + + public Hyperlink getLnkNomeAcidentado() { + return lnkNomeAcidentado; + } + + public void setLnkNomeAcidentado(Hyperlink h) { + this.lnkNomeAcidentado = h; + } + + private HtmlPanelGrid gridSeguimento1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridSeguimento1() { + return gridSeguimento1; + } + + public void setGridSeguimento1(HtmlPanelGrid hpg) { + this.gridSeguimento1 = hpg; + } + + private HtmlPanelGrid gridPanel4 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel4() { + return gridPanel4; + } + + public void setGridPanel4(HtmlPanelGrid hpg) { + this.gridPanel4 = hpg; + } + + private StaticText staticText6 = new StaticText(); + + public StaticText getStaticText6() { + return staticText6; + } + + public void setStaticText6(StaticText st) { + this.staticText6 = st; + } + + private HtmlPanelGrid gridPanel5 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel5() { + return gridPanel5; + } + + public void setGridPanel5(HtmlPanelGrid hpg) { + this.gridPanel5 = hpg; + } + + private Table table2 = new Table(); + + public Table getTable2() { + return table2; + } + + public void setTable2(Table t) { + this.table2 = t; + } + + private TableRowGroup tableRowGroup2 = new TableRowGroup(); + + public TableRowGroup getTableRowGroup2() { + return tableRowGroup2; + } + + public void setTableRowGroup2(TableRowGroup trg) { + this.tableRowGroup2 = trg; + } + + private TableColumn tableColumn4 = new TableColumn(); + + public TableColumn getTableColumn4() { + return tableColumn4; + } + + public void setTableColumn4(TableColumn tc) { + this.tableColumn4 = tc; + } + + private Hyperlink lnkDataAcidenteSeg = new Hyperlink(); + + public Hyperlink getLnkDataAcidenteSeg() { + return lnkDataAcidenteSeg; + } + + public void setLnkDataAcidenteSeg(Hyperlink h) { + this.lnkDataAcidenteSeg = h; + } + + private TableColumn tableColumn5 = new TableColumn(); + + public TableColumn getTableColumn5() { + return tableColumn5; + } + + public void setTableColumn5(TableColumn tc) { + this.tableColumn5 = tc; + } + + private Hyperlink lnkNrSeg = new Hyperlink(); + + public Hyperlink getLnkNrSeg() { + return lnkNrSeg; + } + + public void setLnkNrSeg(Hyperlink h) { + this.lnkNrSeg = h; + } + + private TableColumn tableColumn6 = new TableColumn(); + + public TableColumn getTableColumn6() { + return tableColumn6; + } + + public void setTableColumn6(TableColumn tc) { + this.tableColumn6 = tc; + } + + private Hyperlink lnkNomeAcidentadoSeg = new Hyperlink(); + + public Hyperlink getLnkNomeAcidentadoSeg() { + return lnkNomeAcidentadoSeg; + } + + public void setLnkNomeAcidentadoSeg(Hyperlink h) { + this.lnkNomeAcidentadoSeg = h; + } + + private HtmlPanelGrid gridConcluidos1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridConcluidos1() { + return gridConcluidos1; + } + + public void setGridConcluidos1(HtmlPanelGrid hpg) { + this.gridConcluidos1 = hpg; + } + + private HtmlPanelGrid gridPanel6 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel6() { + return gridPanel6; + } + + public void setGridPanel6(HtmlPanelGrid hpg) { + this.gridPanel6 = hpg; + } + + private StaticText staticText7 = new StaticText(); + + public StaticText getStaticText7() { + return staticText7; + } + + public void setStaticText7(StaticText st) { + this.staticText7 = st; + } + + private HtmlPanelGrid gridPanel7 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel7() { + return gridPanel7; + } + + public void setGridPanel7(HtmlPanelGrid hpg) { + this.gridPanel7 = hpg; + } + + private PanelGroup groupPanel3 = new PanelGroup(); + + public PanelGroup getGroupPanel3() { + return groupPanel3; + } + + public void setGroupPanel3(PanelGroup pg) { + this.groupPanel3 = pg; + } + + private StaticText staticText8 = new StaticText(); + + public StaticText getStaticText8() { + return staticText8; + } + + public void setStaticText8(StaticText st) { + this.staticText8 = st; + } + + private DropDown drpAno = new DropDown(); + + public DropDown getDrpAno() { + return drpAno; + } + + public void setDrpAno(DropDown dd) { + this.drpAno = dd; + } + + private PanelGroup groupPanel4 = new PanelGroup(); + + public PanelGroup getGroupPanel4() { + return groupPanel4; + } + + public void setGroupPanel4(PanelGroup pg) { + this.groupPanel4 = pg; + } + + private StaticText lblMes = new StaticText(); + + public StaticText getLblMes() { + return lblMes; + } + + public void setLblMes(StaticText st) { + this.lblMes = st; + } + + private DropDown drpMes = new DropDown(); + + public DropDown getDrpMes() { + return drpMes; + } + + public void setDrpMes(DropDown dd) { + this.drpMes = dd; + } + + private PanelGroup groupPanel5 = new PanelGroup(); + + public PanelGroup getGroupPanel5() { + return groupPanel5; + } + + public void setGroupPanel5(PanelGroup pg) { + this.groupPanel5 = pg; + } + + private StaticText lblDia = new StaticText(); + + public StaticText getLblDia() { + return lblDia; + } + + public void setLblDia(StaticText st) { + this.lblDia = st; + } + + private DropDown drpDia = new DropDown(); + + public DropDown getDrpDia() { + return drpDia; + } + + public void setDrpDia(DropDown dd) { + this.drpDia = dd; + } + + private PanelGroup groupPanel6 = new PanelGroup(); + + public PanelGroup getGroupPanel6() { + return groupPanel6; + } + + public void setGroupPanel6(PanelGroup pg) { + this.groupPanel6 = pg; + } + + private StaticText staticText9 = new StaticText(); + + public StaticText getStaticText9() { + return staticText9; + } + + public void setStaticText9(StaticText st) { + this.staticText9 = st; + } + + private TextField txtNome = new TextField(); + + public TextField getTxtNome() { + return txtNome; + } + + public void setTxtNome(TextField tf) { + this.txtNome = tf; + } + + private Button butPesquisar = new Button(); + + public Button getButPesquisar() { + return butPesquisar; + } + + public void setButPesquisar(Button b) { + this.butPesquisar = b; + } + + private HtmlPanelGrid gridPanel8 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel8() { + return gridPanel8; + } + + public void setGridPanel8(HtmlPanelGrid hpg) { + this.gridPanel8 = hpg; + } + + private Table table3 = new Table(); + + public Table getTable3() { + return table3; + } + + public void setTable3(Table t) { + this.table3 = t; + } + + private TableRowGroup tableRowGroup3 = new TableRowGroup(); + + public TableRowGroup getTableRowGroup3() { + return tableRowGroup3; + } + + public void setTableRowGroup3(TableRowGroup trg) { + this.tableRowGroup3 = trg; + } + + private TableColumn tableColumn7 = new TableColumn(); + + public TableColumn getTableColumn7() { + return tableColumn7; + } + + public void setTableColumn7(TableColumn tc) { + this.tableColumn7 = tc; + } + + private Hyperlink hyperlink1 = new Hyperlink(); + + public Hyperlink getHyperlink1() { + return hyperlink1; + } + + public void setHyperlink1(Hyperlink h) { + this.hyperlink1 = h; + } + + private TableColumn tableColumn8 = new TableColumn(); + + public TableColumn getTableColumn8() { + return tableColumn8; + } + + public void setTableColumn8(TableColumn tc) { + this.tableColumn8 = tc; + } + + private Hyperlink hyperlink2 = new Hyperlink(); + + public Hyperlink getHyperlink2() { + return hyperlink2; + } + + public void setHyperlink2(Hyperlink h) { + this.hyperlink2 = h; + } + + private TableColumn tableColumn9 = new TableColumn(); + + public TableColumn getTableColumn9() { + return tableColumn9; + } + + public void setTableColumn9(TableColumn tc) { + this.tableColumn9 = tc; + } + + private Hyperlink hyperlink3 = new Hyperlink(); + + public Hyperlink getHyperlink3() { + return hyperlink3; + } + + public void setHyperlink3(Hyperlink h) { + this.hyperlink3 = h; + } + + private StaticText txtSearchMsg = new StaticText(); + + public StaticText getTxtSearchMsg() { + return txtSearchMsg; + } + + public void setTxtSearchMsg(StaticText st) { + this.txtSearchMsg = st; + } + + //
+ + /** + *

Construct a new Page bean instance.

+ */ + public FormHS() { + } + + /** + *

Callback method that is called whenever a page is navigated to, + * either directly via a URL, or indirectly via page navigation. + * Customize this method to acquire resources that will be needed + * for event handlers and lifecycle methods, whether or not this + * page is performing post back processing.

+ * + *

Note that, if the current request is a postback, the property + * values of the components do not represent any + * values submitted with this request. Instead, they represent the + * property values that were saved for this view when it was rendered.

+ */ + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + // + // Initialize automatically managed components + // *Note* - this logic should NOT be modified + try { + _init(); + } catch (Exception e) { + log("FormHS Initialization Failure", e); + throw e instanceof FacesException ? (FacesException) e: new FacesException(e); + } + + // + // Perform application initialization that must complete + // *after* managed components are initialized + // TODO - add your own initialization code here + + if (!getSessionBean1().isLoggedIn()) { + try { + getExternalContext().redirect("Login.jsp"); + } catch(Exception e) { + // . . . handle exception . . . + } + } + } + + /** + *

Callback method that is called after the component tree has been + * restored, but before any event processing takes place. This method + * will only be called on a postback request that + * is processing a form submit. Customize this method to allocate + * resources that will be required in your event handlers.

+ */ + public void preprocess() { + } + + /** + *

Callback method that is called just before rendering takes place. + * This method will only be called for the page that + * will actually be rendered (and not, for example, on a page that + * handled a postback and then navigated to a different page). Customize + * this method to allocate resources that will be required for rendering + * this page.

+ */ + public void prerender() { + lblUser.setText( getSessionBean1().getCurrentUser().getLogin() ); + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + //lblActivos.setRendered(true); + table1.setRendered(true); + + ArrayList actuaisList = adp.getAnalisesActuaisList(getSessionBean1().getCurrentUser().getEstabelecimento_id(), new Integer(3)); + getSessionBean1().getAnalisesActualDataProvider().setList(actuaisList); + } + catch(Exception ex) + { + //lblActivos.setRendered(false); + table1.setRendered(false); + ex.printStackTrace(); + } + + try + { + //lblActivos.setRendered(true); + table2.setRendered(true); + + ArrayList seguimentoList = adp.getAnalisesSeguimentoList(getSessionBean1().getCurrentUser().getEstabelecimento_id(), new Integer(3)); + getSessionBean1().getAnalisesSeguimentoDataProvider().setList(seguimentoList); + } + catch(Exception ex) + { + //lblActivos.setRendered(false); + table2.setRendered(false); + ex.printStackTrace(); + } + + HttpServletRequest request = (HttpServletRequest) getExternalContext().getRequest(); + String referer = request.getRequestURI(); + String pageFrom = getPageFrom(referer); + if(!pageFrom.matches("FormHS.jsp")) + { + + try + { + //lblActivos.setRendered(true); + table3.setRendered(true); + + ArrayList concluidasList = adp.getAnalisesConcluidasList(getSessionBean1().getCurrentUser().getEstabelecimento_id()); + getSessionBean1().getAnalisesConcluidasDataProvider().setList(concluidasList); + } + catch(Exception ex) + { + //lblActivos.setRendered(false); + table3.setRendered(false); + ex.printStackTrace(); + } + fillAnoDropDown(); + } + } + + /** + *

Callback method that is called after rendering is completed for + * this request, if init() was called (regardless of whether + * or not this was the page that was actually rendered). Customize this + * method to release resources acquired in the init(), + * preprocess(), or prerender() methods (or + * acquired during execution of an event handler).

+ */ + public void destroy() { + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1)getBean("ApplicationBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1)getBean("SessionBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1)getBean("RequestBean1"); + } + + public String lnkLogout_action() { + // TODO: Replace with your code + + javax.servlet.http.HttpSession session = + (javax.servlet.http.HttpSession) getExternalContext().getSession(true); + session.invalidate(); + return "login"; + } + + public String lnkDataAcidente_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "analise_acidente"; + } + + public String lnkNr_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "analise_acidente"; + } + + public String lnkNomeAcidentado_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "analise_acidente"; + } + + private AnaliseAcidente getTableActivosRowData() + { + RowKey rk = tableRowGroup1.getRowKey(); + int k = Integer.parseInt(rk.getRowId()); + AnalisesActualDataProvider provider = (AnalisesActualDataProvider) tableRowGroup1.getSourceData(); + ArrayList list = (ArrayList) provider.getList(); + AnaliseAcidente a = (AnaliseAcidente)list.get(k); + return a; + } + + public String lnkDataAcidenteSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "view_analise"; + } + + public String lnkNrSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "view_analise"; + } + + public String lnkNomeAcidentadoSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "view_analise"; + } + + private AnaliseAcidente getTableSeguimentoRowData() + { + RowKey rk = tableRowGroup2.getRowKey(); + int k = Integer.parseInt(rk.getRowId()); + AnalisesSeguimentoDataProvider provider = (AnalisesSeguimentoDataProvider) tableRowGroup2.getSourceData(); + ArrayList list = (ArrayList) provider.getList(); + AnaliseAcidente a = (AnaliseAcidente)list.get(k); + return a; + } + + public void drpAno_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + Object ano = event.getNewValue(); + if(ano == null) + { + lblMes.setVisible(false); + drpMes.setVisible(false); + lblDia.setVisible(false); + drpDia.setVisible(false); + } + else + { + lblMes.setVisible(true); + drpMes.setVisible(true); + fillMesDropDown(); + } + } + + public void drpMes_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + Object mes = event.getNewValue(); + if(mes == null) + { + lblDia.setVisible(false); + drpDia.setVisible(false); + } + else + { + lblDia.setVisible(true); + drpDia.setVisible(true); + fillDiaDropDown(); + } + } + + public void drpDia_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + + } + + public String butPesquisar_action() { + // TODO: Process the button click action. Return value is a navigation + // case name where null will return to the same page. + + Object obAno = null; + Object obMes = null; + Object obDia = null; + try + { + obAno = drpAno.getSelected(); + obMes = drpMes.getSelected(); + obDia = drpDia.getSelected(); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + Integer ano = null; + Integer mes = null; + Integer dia = null; + + if(obAno != null) + { + ano = (Integer) obAno; + } + + if(obMes != null) + { + mes = (Integer) obMes; + } + + if(obDia != null) + { + dia = (Integer) obDia; + } + + String nome = null; + if(txtNome.getText() != null) + { + nome = (String) txtNome.getText(); + } + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + + //getSessionBean1().getAnalisesConcluidasDataProvider().setList(new ArrayList()); + ArrayList concluidasList = adp.searchAanalisesConcluidasList(getSessionBean1().getCurrentUser().getEstabelecimento_id(), ano, mes, dia, nome); + + table3.setRendered(true); + txtSearchMsg.setRendered(false); + getSessionBean1().getAnalisesConcluidasDataProvider().setList(concluidasList); + + + } + catch(Exception ex) + { + table3.setRendered(false); + txtSearchMsg.setRendered(true); + txtSearchMsg.setText("Não foram encontrados registos para a sua pesquisa !"); + ex.printStackTrace(); + } + + return null; + } + + private String getPageFrom(String referer) + { + String pageFrom = referer.substring(referer.lastIndexOf("/")+1); + return pageFrom; + } + + private void fillAnoDropDown() + { + ArrayList anosList = new ArrayList(); + for(int ano=2007; ano<2051; ano++) + { + anosList.add(new Integer(ano)); + } + com.sun.rave.web.ui.model.Option[] anoOptions = new com.sun.rave.web.ui.model.Option[anosList.size()+1]; + anoOptions[0] = new Option("", ""); + ListIterator iter = anosList.listIterator(); + int i = 1; + while(iter.hasNext()) + { + Integer ano = (Integer) iter.next(); + + anoOptions[i] = new Option(ano, ano.toString()); + i++; + } + getSessionBean1().setAnoOptions(anoOptions); + Calendar cal = new GregorianCalendar(); + int year = cal.get(Calendar.YEAR); + //drpAno.setSelected( new Integer(year) ); + } + + private void fillMesDropDown() + { + com.sun.rave.web.ui.model.Option[] mesOptions = new com.sun.rave.web.ui.model.Option[13]; + mesOptions[0] = new Option("", ""); + mesOptions[1] = new Option(new Integer(1), "Janeiro"); + mesOptions[2] = new Option(new Integer(2), "Fevereiro"); + mesOptions[3] = new Option(new Integer(3), "Março"); + mesOptions[4] = new Option(new Integer(4), "Abril"); + mesOptions[5] = new Option(new Integer(5), "Maio"); + mesOptions[6] = new Option(new Integer(6), "Junho"); + mesOptions[7] = new Option(new Integer(7), "Julho"); + mesOptions[8] = new Option(new Integer(8), "Agosto"); + mesOptions[9] = new Option(new Integer(9), "Setembro"); + mesOptions[10] = new Option(new Integer(10), "Outubro"); + mesOptions[11] = new Option(new Integer(11), "Novembro"); + mesOptions[12] = new Option(new Integer(12), "Dezembro"); + getSessionBean1().setMesOptions(mesOptions); + Calendar cal = new GregorianCalendar(); + int month = cal.get(Calendar.MONTH); // 0=Jan, 1=Feb, ... + //drpMes.setSelected( new Integer(month+1) ); + } + + private void fillDiaDropDown() + { +// int ano = ( (Integer)drpAno.getSelected() ).intValue(); +// int mes = ( (Integer)drpMes.getSelected() ).intValue(); +// int dias = 0; +// switch (mes) { +// case 1: dias=31; break; +// case 2: +// GregorianCalendar cal = new GregorianCalendar(); +// if(cal.isLeapYear(ano)) +// { +// dias = 29; +// } +// else +// { +// dias = 28; +// } +// break; +// case 3: dias=31; break; +// case 4: dias=30; break; +// case 5: dias=31; break; +// case 6: dias=30; break; +// case 7: dias=31; break; +// case 8: dias=31; break; +// case 9: dias=30; break; +// case 10: dias=31; break; +// case 11: dias=30; break; +// case 12: dias=31; break; +// default: System.out.println("Invalid month.");break; +// } +// +// ArrayList diasList = new ArrayList(); +// for(int dia=1; diaPage bean that corresponds to a similarly named JSP page. This + * class contains component definitions (and initialization code) for + * all components that you have defined on this page, as well as + * lifecycle methods and event handlers where you may add behavior + * to respond to incoming events.

+ */ +public class FormRH extends AbstractPageBean { + // + private int __placeholder; + + /** + *

Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.

+ */ + private void _init() throws Exception { + } + + private Page page1 = new Page(); + + public Page getPage1() { + return page1; + } + + public void setPage1(Page p) { + this.page1 = p; + } + + private Html html1 = new Html(); + + public Html getHtml1() { + return html1; + } + + public void setHtml1(Html h) { + this.html1 = h; + } + + private Head head1 = new Head(); + + public Head getHead1() { + return head1; + } + + public void setHead1(Head h) { + this.head1 = h; + } + + private Link link1 = new Link(); + + public Link getLink1() { + return link1; + } + + public void setLink1(Link l) { + this.link1 = l; + } + + private Body body1 = new Body(); + + public Body getBody1() { + return body1; + } + + public void setBody1(Body b) { + this.body1 = b; + } + + private Form form1 = new Form(); + + public Form getForm1() { + return form1; + } + + public void setForm1(Form f) { + this.form1 = f; + } + + private HtmlPanelGrid gridBase1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridBase1() { + return gridBase1; + } + + public void setGridBase1(HtmlPanelGrid hpg) { + this.gridBase1 = hpg; + } + + private HtmlPanelGrid gridLayout1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridLayout1() { + return gridLayout1; + } + + public void setGridLayout1(HtmlPanelGrid hpg) { + this.gridLayout1 = hpg; + } + + private HtmlPanelGrid gridPanel1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel1() { + return gridPanel1; + } + + public void setGridPanel1(HtmlPanelGrid hpg) { + this.gridPanel1 = hpg; + } + + private PanelGroup groupPanel1 = new PanelGroup(); + + public PanelGroup getGroupPanel1() { + return groupPanel1; + } + + public void setGroupPanel1(PanelGroup pg) { + this.groupPanel1 = pg; + } + + private ImageComponent image1 = new ImageComponent(); + + public ImageComponent getImage1() { + return image1; + } + + public void setImage1(ImageComponent ic) { + this.image1 = ic; + } + + private ImageComponent image2 = new ImageComponent(); + + public ImageComponent getImage2() { + return image2; + } + + public void setImage2(ImageComponent ic) { + this.image2 = ic; + } + + private PanelGroup groupPanel2 = new PanelGroup(); + + public PanelGroup getGroupPanel2() { + return groupPanel2; + } + + public void setGroupPanel2(PanelGroup pg) { + this.groupPanel2 = pg; + } + + private StaticText lblUser = new StaticText(); + + public StaticText getLblUser() { + return lblUser; + } + + public void setLblUser(StaticText st) { + this.lblUser = st; + } + + private StaticText staticText1 = new StaticText(); + + public StaticText getStaticText1() { + return staticText1; + } + + public void setStaticText1(StaticText st) { + this.staticText1 = st; + } + + private Hyperlink lnkChangePassword1 = new Hyperlink(); + + public Hyperlink getLnkChangePassword1() { + return lnkChangePassword1; + } + + public void setLnkChangePassword1(Hyperlink h) { + this.lnkChangePassword1 = h; + } + + private StaticText staticText2 = new StaticText(); + + public StaticText getStaticText2() { + return staticText2; + } + + public void setStaticText2(StaticText st) { + this.staticText2 = st; + } + + private Hyperlink lnkLogout = new Hyperlink(); + + public Hyperlink getLnkLogout() { + return lnkLogout; + } + + public void setLnkLogout(Hyperlink h) { + this.lnkLogout = h; + } + + private StaticText staticText3 = new StaticText(); + + public StaticText getStaticText3() { + return staticText3; + } + + public void setStaticText3(StaticText st) { + this.staticText3 = st; + } + + private HtmlPanelGrid gridLayoutTop1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridLayoutTop1() { + return gridLayoutTop1; + } + + public void setGridLayoutTop1(HtmlPanelGrid hpg) { + this.gridLayoutTop1 = hpg; + } + + private HtmlPanelGrid gridActual1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridActual1() { + return gridActual1; + } + + public void setGridActual1(HtmlPanelGrid hpg) { + this.gridActual1 = hpg; + } + + private HtmlPanelGrid gridPanel2 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel2() { + return gridPanel2; + } + + public void setGridPanel2(HtmlPanelGrid hpg) { + this.gridPanel2 = hpg; + } + + private StaticText staticText4 = new StaticText(); + + public StaticText getStaticText4() { + return staticText4; + } + + public void setStaticText4(StaticText st) { + this.staticText4 = st; + } + + private StaticText staticText5 = new StaticText(); + + public StaticText getStaticText5() { + return staticText5; + } + + public void setStaticText5(StaticText st) { + this.staticText5 = st; + } + + private HtmlPanelGrid gridPanel3 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel3() { + return gridPanel3; + } + + public void setGridPanel3(HtmlPanelGrid hpg) { + this.gridPanel3 = hpg; + } + + private Table table1 = new Table(); + + public Table getTable1() { + return table1; + } + + public void setTable1(Table t) { + this.table1 = t; + } + + private TableRowGroup tableRowGroup1 = new TableRowGroup(); + + public TableRowGroup getTableRowGroup1() { + return tableRowGroup1; + } + + public void setTableRowGroup1(TableRowGroup trg) { + this.tableRowGroup1 = trg; + } + + private TableColumn tableColumn1 = new TableColumn(); + + public TableColumn getTableColumn1() { + return tableColumn1; + } + + public void setTableColumn1(TableColumn tc) { + this.tableColumn1 = tc; + } + + private Hyperlink lnkDataAcidente = new Hyperlink(); + + public Hyperlink getLnkDataAcidente() { + return lnkDataAcidente; + } + + public void setLnkDataAcidente(Hyperlink h) { + this.lnkDataAcidente = h; + } + + private TableColumn tableColumn2 = new TableColumn(); + + public TableColumn getTableColumn2() { + return tableColumn2; + } + + public void setTableColumn2(TableColumn tc) { + this.tableColumn2 = tc; + } + + private Hyperlink lnkNr = new Hyperlink(); + + public Hyperlink getLnkNr() { + return lnkNr; + } + + public void setLnkNr(Hyperlink h) { + this.lnkNr = h; + } + + private TableColumn tableColumn3 = new TableColumn(); + + public TableColumn getTableColumn3() { + return tableColumn3; + } + + public void setTableColumn3(TableColumn tc) { + this.tableColumn3 = tc; + } + + private Hyperlink lnkNomeAcidentado = new Hyperlink(); + + public Hyperlink getLnkNomeAcidentado() { + return lnkNomeAcidentado; + } + + public void setLnkNomeAcidentado(Hyperlink h) { + this.lnkNomeAcidentado = h; + } + + private HtmlPanelGrid gridSeguimento1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridSeguimento1() { + return gridSeguimento1; + } + + public void setGridSeguimento1(HtmlPanelGrid hpg) { + this.gridSeguimento1 = hpg; + } + + private HtmlPanelGrid gridPanel4 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel4() { + return gridPanel4; + } + + public void setGridPanel4(HtmlPanelGrid hpg) { + this.gridPanel4 = hpg; + } + + private StaticText staticText6 = new StaticText(); + + public StaticText getStaticText6() { + return staticText6; + } + + public void setStaticText6(StaticText st) { + this.staticText6 = st; + } + + private HtmlPanelGrid gridPanel5 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel5() { + return gridPanel5; + } + + public void setGridPanel5(HtmlPanelGrid hpg) { + this.gridPanel5 = hpg; + } + + private Table table2 = new Table(); + + public Table getTable2() { + return table2; + } + + public void setTable2(Table t) { + this.table2 = t; + } + + private TableRowGroup tableRowGroup2 = new TableRowGroup(); + + public TableRowGroup getTableRowGroup2() { + return tableRowGroup2; + } + + public void setTableRowGroup2(TableRowGroup trg) { + this.tableRowGroup2 = trg; + } + + private TableColumn tableColumn4 = new TableColumn(); + + public TableColumn getTableColumn4() { + return tableColumn4; + } + + public void setTableColumn4(TableColumn tc) { + this.tableColumn4 = tc; + } + + private Hyperlink lnkDataAcidenteSeg = new Hyperlink(); + + public Hyperlink getLnkDataAcidenteSeg() { + return lnkDataAcidenteSeg; + } + + public void setLnkDataAcidenteSeg(Hyperlink h) { + this.lnkDataAcidenteSeg = h; + } + + private TableColumn tableColumn5 = new TableColumn(); + + public TableColumn getTableColumn5() { + return tableColumn5; + } + + public void setTableColumn5(TableColumn tc) { + this.tableColumn5 = tc; + } + + private Hyperlink lnkNrSeg = new Hyperlink(); + + public Hyperlink getLnkNrSeg() { + return lnkNrSeg; + } + + public void setLnkNrSeg(Hyperlink h) { + this.lnkNrSeg = h; + } + + private TableColumn tableColumn6 = new TableColumn(); + + public TableColumn getTableColumn6() { + return tableColumn6; + } + + public void setTableColumn6(TableColumn tc) { + this.tableColumn6 = tc; + } + + private Hyperlink lnkNomeAcidentadoSeg = new Hyperlink(); + + public Hyperlink getLnkNomeAcidentadoSeg() { + return lnkNomeAcidentadoSeg; + } + + public void setLnkNomeAcidentadoSeg(Hyperlink h) { + this.lnkNomeAcidentadoSeg = h; + } + + private HtmlPanelGrid gridConcluidos1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridConcluidos1() { + return gridConcluidos1; + } + + public void setGridConcluidos1(HtmlPanelGrid hpg) { + this.gridConcluidos1 = hpg; + } + + private HtmlPanelGrid gridPanel6 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel6() { + return gridPanel6; + } + + public void setGridPanel6(HtmlPanelGrid hpg) { + this.gridPanel6 = hpg; + } + + private StaticText staticText7 = new StaticText(); + + public StaticText getStaticText7() { + return staticText7; + } + + public void setStaticText7(StaticText st) { + this.staticText7 = st; + } + + private HtmlPanelGrid gridPanel7 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel7() { + return gridPanel7; + } + + public void setGridPanel7(HtmlPanelGrid hpg) { + this.gridPanel7 = hpg; + } + + private PanelGroup groupPanel3 = new PanelGroup(); + + public PanelGroup getGroupPanel3() { + return groupPanel3; + } + + public void setGroupPanel3(PanelGroup pg) { + this.groupPanel3 = pg; + } + + private StaticText staticText8 = new StaticText(); + + public StaticText getStaticText8() { + return staticText8; + } + + public void setStaticText8(StaticText st) { + this.staticText8 = st; + } + + private DropDown drpAno = new DropDown(); + + public DropDown getDrpAno() { + return drpAno; + } + + public void setDrpAno(DropDown dd) { + this.drpAno = dd; + } + + private PanelGroup groupPanel4 = new PanelGroup(); + + public PanelGroup getGroupPanel4() { + return groupPanel4; + } + + public void setGroupPanel4(PanelGroup pg) { + this.groupPanel4 = pg; + } + + private StaticText lblMes = new StaticText(); + + public StaticText getLblMes() { + return lblMes; + } + + public void setLblMes(StaticText st) { + this.lblMes = st; + } + + private DropDown drpMes = new DropDown(); + + public DropDown getDrpMes() { + return drpMes; + } + + public void setDrpMes(DropDown dd) { + this.drpMes = dd; + } + + private PanelGroup groupPanel5 = new PanelGroup(); + + public PanelGroup getGroupPanel5() { + return groupPanel5; + } + + public void setGroupPanel5(PanelGroup pg) { + this.groupPanel5 = pg; + } + + private StaticText lblDia = new StaticText(); + + public StaticText getLblDia() { + return lblDia; + } + + public void setLblDia(StaticText st) { + this.lblDia = st; + } + + private DropDown drpDia = new DropDown(); + + public DropDown getDrpDia() { + return drpDia; + } + + public void setDrpDia(DropDown dd) { + this.drpDia = dd; + } + + private PanelGroup groupPanel6 = new PanelGroup(); + + public PanelGroup getGroupPanel6() { + return groupPanel6; + } + + public void setGroupPanel6(PanelGroup pg) { + this.groupPanel6 = pg; + } + + private StaticText staticText9 = new StaticText(); + + public StaticText getStaticText9() { + return staticText9; + } + + public void setStaticText9(StaticText st) { + this.staticText9 = st; + } + + private TextField txtNome = new TextField(); + + public TextField getTxtNome() { + return txtNome; + } + + public void setTxtNome(TextField tf) { + this.txtNome = tf; + } + + private Button butPesquisar = new Button(); + + public Button getButPesquisar() { + return butPesquisar; + } + + public void setButPesquisar(Button b) { + this.butPesquisar = b; + } + + private HtmlPanelGrid gridPanel8 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel8() { + return gridPanel8; + } + + public void setGridPanel8(HtmlPanelGrid hpg) { + this.gridPanel8 = hpg; + } + + private Table table3 = new Table(); + + public Table getTable3() { + return table3; + } + + public void setTable3(Table t) { + this.table3 = t; + } + + private TableRowGroup tableRowGroup3 = new TableRowGroup(); + + public TableRowGroup getTableRowGroup3() { + return tableRowGroup3; + } + + public void setTableRowGroup3(TableRowGroup trg) { + this.tableRowGroup3 = trg; + } + + private TableColumn tableColumn7 = new TableColumn(); + + public TableColumn getTableColumn7() { + return tableColumn7; + } + + public void setTableColumn7(TableColumn tc) { + this.tableColumn7 = tc; + } + + private Hyperlink hyperlink1 = new Hyperlink(); + + public Hyperlink getHyperlink1() { + return hyperlink1; + } + + public void setHyperlink1(Hyperlink h) { + this.hyperlink1 = h; + } + + private TableColumn tableColumn8 = new TableColumn(); + + public TableColumn getTableColumn8() { + return tableColumn8; + } + + public void setTableColumn8(TableColumn tc) { + this.tableColumn8 = tc; + } + + private Hyperlink hyperlink2 = new Hyperlink(); + + public Hyperlink getHyperlink2() { + return hyperlink2; + } + + public void setHyperlink2(Hyperlink h) { + this.hyperlink2 = h; + } + + private TableColumn tableColumn9 = new TableColumn(); + + public TableColumn getTableColumn9() { + return tableColumn9; + } + + public void setTableColumn9(TableColumn tc) { + this.tableColumn9 = tc; + } + + private Hyperlink hyperlink3 = new Hyperlink(); + + public Hyperlink getHyperlink3() { + return hyperlink3; + } + + public void setHyperlink3(Hyperlink h) { + this.hyperlink3 = h; + } + + private StaticText txtSearchMsg = new StaticText(); + + public StaticText getTxtSearchMsg() { + return txtSearchMsg; + } + + public void setTxtSearchMsg(StaticText st) { + this.txtSearchMsg = st; + } + + //
+ + /** + *

Construct a new Page bean instance.

+ */ + public FormRH() { + } + + /** + *

Callback method that is called whenever a page is navigated to, + * either directly via a URL, or indirectly via page navigation. + * Customize this method to acquire resources that will be needed + * for event handlers and lifecycle methods, whether or not this + * page is performing post back processing.

+ * + *

Note that, if the current request is a postback, the property + * values of the components do not represent any + * values submitted with this request. Instead, they represent the + * property values that were saved for this view when it was rendered.

+ */ + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + // + // Initialize automatically managed components + // *Note* - this logic should NOT be modified + try { + _init(); + } catch (Exception e) { + log("FormRH Initialization Failure", e); + throw e instanceof FacesException ? (FacesException) e: new FacesException(e); + } + + // + // Perform application initialization that must complete + // *after* managed components are initialized + // TODO - add your own initialization code here + + if (!getSessionBean1().isLoggedIn()) { + try { + getExternalContext().redirect("Login.jsp"); + } catch(Exception e) { + // . . . handle exception . . . + } + } + } + + /** + *

Callback method that is called after the component tree has been + * restored, but before any event processing takes place. This method + * will only be called on a postback request that + * is processing a form submit. Customize this method to allocate + * resources that will be required in your event handlers.

+ */ + public void preprocess() { + } + + /** + *

Callback method that is called just before rendering takes place. + * This method will only be called for the page that + * will actually be rendered (and not, for example, on a page that + * handled a postback and then navigated to a different page). Customize + * this method to allocate resources that will be required for rendering + * this page.

+ */ + public void prerender() { + lblUser.setText( getSessionBean1().getCurrentUser().getLogin() ); + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + //lblActivos.setRendered(true); + table1.setRendered(true); + + ArrayList actuaisList = adp.getAnalisesActuaisList(getSessionBean1().getCurrentUser().getEstabelecimento_id()); + getSessionBean1().getAnalisesActualDataProvider().setList(actuaisList); + } + catch(Exception ex) + { + //lblActivos.setRendered(false); + table1.setRendered(false); + ex.printStackTrace(); + } + + try + { + //lblActivos.setRendered(true); + table2.setRendered(true); + + ArrayList seguimentoList = adp.getAnalisesSeguimentoList(getSessionBean1().getCurrentUser().getEstabelecimento_id(), new Integer(2)); + getSessionBean1().getAnalisesSeguimentoDataProvider().setList(seguimentoList); + } + catch(Exception ex) + { + //lblActivos.setRendered(false); + table2.setRendered(false); + ex.printStackTrace(); + } + + HttpServletRequest request = (HttpServletRequest) getExternalContext().getRequest(); + String referer = request.getRequestURI(); + String pageFrom = getPageFrom(referer); + if(!pageFrom.matches("FormRH.jsp")) + { + + try + { + //lblActivos.setRendered(true); + table3.setRendered(true); + + ArrayList concluidasList = adp.getAnalisesConcluidasList(getSessionBean1().getCurrentUser().getEstabelecimento_id()); + getSessionBean1().getAnalisesConcluidasDataProvider().setList(concluidasList); + } + catch(Exception ex) + { + //lblActivos.setRendered(false); + table3.setRendered(false); + ex.printStackTrace(); + } + fillAnoDropDown(); + } + } + + /** + *

Callback method that is called after rendering is completed for + * this request, if init() was called (regardless of whether + * or not this was the page that was actually rendered). Customize this + * method to release resources acquired in the init(), + * preprocess(), or prerender() methods (or + * acquired during execution of an event handler).

+ */ + public void destroy() { + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1)getBean("SessionBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1)getBean("RequestBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1)getBean("ApplicationBean1"); + } + + public String lnkLogout_action() { + // TODO: Replace with your code + + javax.servlet.http.HttpSession session = + (javax.servlet.http.HttpSession) getExternalContext().getSession(true); + session.invalidate(); + return "login"; + } + + public String butNovaAnalise_action() { + // TODO: Process the button click action. Return value is a navigation + // case name where null will return to the same page. + + return null; + } + + public String lnkDataAcidente_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "analise_acidente"; + } + + public String lnkNr_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "analise_acidente"; + } + + public String lnkNomeAcidentado_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "analise_acidente"; + } + + private AnaliseAcidente getTableActivosRowData() + { + RowKey rk = tableRowGroup1.getRowKey(); + int k = Integer.parseInt(rk.getRowId()); + AnalisesActualDataProvider provider = (AnalisesActualDataProvider) tableRowGroup1.getSourceData(); + ArrayList list = (ArrayList) provider.getList(); + AnaliseAcidente a = (AnaliseAcidente)list.get(k); + return a; + } + + public String lnkDataAcidenteSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "view_analise"; + } + + public String lnkNrSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "view_analise"; + } + + + public String lnkNomeAcidentadoSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "view_analise"; + } + + private AnaliseAcidente getTableSeguimentoRowData() + { + RowKey rk = tableRowGroup2.getRowKey(); + int k = Integer.parseInt(rk.getRowId()); + AnalisesSeguimentoDataProvider provider = (AnalisesSeguimentoDataProvider) tableRowGroup2.getSourceData(); + ArrayList list = (ArrayList) provider.getList(); + AnaliseAcidente a = (AnaliseAcidente)list.get(k); + return a; + } + + public void drpAno_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + Object ano = event.getNewValue(); + if(ano == null) + { + lblMes.setVisible(false); + drpMes.setVisible(false); + lblDia.setVisible(false); + drpDia.setVisible(false); + } + else + { + lblMes.setVisible(true); + drpMes.setVisible(true); + fillMesDropDown(); + } + } + + public void drpMes_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + Object mes = event.getNewValue(); + if(mes == null) + { + lblDia.setVisible(false); + drpDia.setVisible(false); + } + else + { + lblDia.setVisible(true); + drpDia.setVisible(true); + fillDiaDropDown(); + } + } + + public void drpDia_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + + } + + public String butPesquisar_action() { + // TODO: Process the button click action. Return value is a navigation + // case name where null will return to the same page. + + Object obAno = null; + Object obMes = null; + Object obDia = null; + try + { + obAno = drpAno.getSelected(); + obMes = drpMes.getSelected(); + obDia = drpDia.getSelected(); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + Integer ano = null; + Integer mes = null; + Integer dia = null; + + if(obAno != null) + { + ano = (Integer) obAno; + } + + if(obMes != null) + { + mes = (Integer) obMes; + } + + if(obDia != null) + { + dia = (Integer) obDia; + } + + String nome = null; + if(txtNome.getText() != null) + { + nome = (String) txtNome.getText(); + } + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + + //getSessionBean1().getAnalisesConcluidasDataProvider().setList(new ArrayList()); + ArrayList concluidasList = adp.searchAanalisesConcluidasList(getSessionBean1().getCurrentUser().getEstabelecimento_id(), ano, mes, dia, nome); + + table3.setRendered(true); + txtSearchMsg.setRendered(false); + getSessionBean1().getAnalisesConcluidasDataProvider().setList(concluidasList); + + + } + catch(Exception ex) + { + table3.setRendered(false); + txtSearchMsg.setRendered(true); + txtSearchMsg.setText("Não foram encontrados registos para a sua pesquisa !"); + ex.printStackTrace(); + } + + return null; + } + + private String getPageFrom(String referer) + { + String pageFrom = referer.substring(referer.lastIndexOf("/")+1); + return pageFrom; + } + + private void fillAnoDropDown() + { + ArrayList anosList = new ArrayList(); + for(int ano=2007; ano<2051; ano++) + { + anosList.add(new Integer(ano)); + } + com.sun.rave.web.ui.model.Option[] anoOptions = new com.sun.rave.web.ui.model.Option[anosList.size()+1]; + anoOptions[0] = new Option("", ""); + ListIterator iter = anosList.listIterator(); + int i = 1; + while(iter.hasNext()) + { + Integer ano = (Integer) iter.next(); + + anoOptions[i] = new Option(ano, ano.toString()); + i++; + } + getSessionBean1().setAnoOptions(anoOptions); + Calendar cal = new GregorianCalendar(); + int year = cal.get(Calendar.YEAR); + //drpAno.setSelected( new Integer(year) ); + } + + private void fillMesDropDown() + { + com.sun.rave.web.ui.model.Option[] mesOptions = new com.sun.rave.web.ui.model.Option[13]; + mesOptions[0] = new Option("", ""); + mesOptions[1] = new Option(new Integer(1), "Janeiro"); + mesOptions[2] = new Option(new Integer(2), "Fevereiro"); + mesOptions[3] = new Option(new Integer(3), "Março"); + mesOptions[4] = new Option(new Integer(4), "Abril"); + mesOptions[5] = new Option(new Integer(5), "Maio"); + mesOptions[6] = new Option(new Integer(6), "Junho"); + mesOptions[7] = new Option(new Integer(7), "Julho"); + mesOptions[8] = new Option(new Integer(8), "Agosto"); + mesOptions[9] = new Option(new Integer(9), "Setembro"); + mesOptions[10] = new Option(new Integer(10), "Outubro"); + mesOptions[11] = new Option(new Integer(11), "Novembro"); + mesOptions[12] = new Option(new Integer(12), "Dezembro"); + getSessionBean1().setMesOptions(mesOptions); + Calendar cal = new GregorianCalendar(); + int month = cal.get(Calendar.MONTH); // 0=Jan, 1=Feb, ... + //drpMes.setSelected( new Integer(month+1) ); + } + + private void fillDiaDropDown() + { +// int ano = ( (Integer)drpAno.getSelected() ).intValue(); +// int mes = ( (Integer)drpMes.getSelected() ).intValue(); +// int dias = 0; +// switch (mes) { +// case 1: dias=31; break; +// case 2: +// GregorianCalendar cal = new GregorianCalendar(); +// if(cal.isLeapYear(ano)) +// { +// dias = 29; +// } +// else +// { +// dias = 28; +// } +// break; +// case 3: dias=31; break; +// case 4: dias=30; break; +// case 5: dias=31; break; +// case 6: dias=30; break; +// case 7: dias=31; break; +// case 8: dias=31; break; +// case 9: dias=30; break; +// case 10: dias=31; break; +// case 11: dias=30; break; +// case 12: dias=31; break; +// default: System.out.println("Invalid month.");break; +// } +// +// ArrayList diasList = new ArrayList(); +// for(int dia=1; diaPage bean that corresponds to a similarly named JSP page. This + * class contains component definitions (and initialization code) for + * all components that you have defined on this page, as well as + * lifecycle methods and event handlers where you may add behavior + * to respond to incoming events.

+ */ +public class FormSeguranca extends AbstractPageBean { + // + private int __placeholder; + + /** + *

Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.

+ */ + private void _init() throws Exception { + } + + private Page page1 = new Page(); + + public Page getPage1() { + return page1; + } + + public void setPage1(Page p) { + this.page1 = p; + } + + private Html html1 = new Html(); + + public Html getHtml1() { + return html1; + } + + public void setHtml1(Html h) { + this.html1 = h; + } + + private Head head1 = new Head(); + + public Head getHead1() { + return head1; + } + + public void setHead1(Head h) { + this.head1 = h; + } + + private Link link1 = new Link(); + + public Link getLink1() { + return link1; + } + + public void setLink1(Link l) { + this.link1 = l; + } + + private Body body1 = new Body(); + + public Body getBody1() { + return body1; + } + + public void setBody1(Body b) { + this.body1 = b; + } + + private Form form1 = new Form(); + + public Form getForm1() { + return form1; + } + + public void setForm1(Form f) { + this.form1 = f; + } + + private HtmlPanelGrid gridBase = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridBase() { + return gridBase; + } + + public void setGridBase(HtmlPanelGrid hpg) { + this.gridBase = hpg; + } + + private HtmlPanelGrid gridLayout = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridLayout() { + return gridLayout; + } + + public void setGridLayout(HtmlPanelGrid hpg) { + this.gridLayout = hpg; + } + + private HtmlPanelGrid gridLayoutTop = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridLayoutTop() { + return gridLayoutTop; + } + + public void setGridLayoutTop(HtmlPanelGrid hpg) { + this.gridLayoutTop = hpg; + } + + private HtmlPanelGrid gridActual = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridActual() { + return gridActual; + } + + public void setGridActual(HtmlPanelGrid hpg) { + this.gridActual = hpg; + } + + private HtmlPanelGrid gridPanel1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel1() { + return gridPanel1; + } + + public void setGridPanel1(HtmlPanelGrid hpg) { + this.gridPanel1 = hpg; + } + + private StaticText staticText1 = new StaticText(); + + public StaticText getStaticText1() { + return staticText1; + } + + public void setStaticText1(StaticText st) { + this.staticText1 = st; + } + + private HtmlPanelGrid gridSeguimento = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridSeguimento() { + return gridSeguimento; + } + + public void setGridSeguimento(HtmlPanelGrid hpg) { + this.gridSeguimento = hpg; + } + + private HtmlPanelGrid gridPanel2 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel2() { + return gridPanel2; + } + + public void setGridPanel2(HtmlPanelGrid hpg) { + this.gridPanel2 = hpg; + } + + private StaticText staticText2 = new StaticText(); + + public StaticText getStaticText2() { + return staticText2; + } + + public void setStaticText2(StaticText st) { + this.staticText2 = st; + } + + private HtmlPanelGrid gridConcluidos = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridConcluidos() { + return gridConcluidos; + } + + public void setGridConcluidos(HtmlPanelGrid hpg) { + this.gridConcluidos = hpg; + } + + private HtmlPanelGrid gridPanel3 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel3() { + return gridPanel3; + } + + public void setGridPanel3(HtmlPanelGrid hpg) { + this.gridPanel3 = hpg; + } + + private StaticText staticText3 = new StaticText(); + + public StaticText getStaticText3() { + return staticText3; + } + + public void setStaticText3(StaticText st) { + this.staticText3 = st; + } + + private Link link2 = new Link(); + + public Link getLink2() { + return link2; + } + + public void setLink2(Link l) { + this.link2 = l; + } + + private Button butNovaAnalise = new Button(); + + public Button getButNovaAnalise() { + return butNovaAnalise; + } + + public void setButNovaAnalise(Button b) { + this.butNovaAnalise = b; + } + + private StaticText staticText4 = new StaticText(); + + public StaticText getStaticText4() { + return staticText4; + } + + public void setStaticText4(StaticText st) { + this.staticText4 = st; + } + + private HtmlPanelGrid gridPanel4 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel4() { + return gridPanel4; + } + + public void setGridPanel4(HtmlPanelGrid hpg) { + this.gridPanel4 = hpg; + } + + private Table table1 = new Table(); + + public Table getTable1() { + return table1; + } + + public void setTable1(Table t) { + this.table1 = t; + } + + private TableRowGroup tableRowGroup1 = new TableRowGroup(); + + public TableRowGroup getTableRowGroup1() { + return tableRowGroup1; + } + + public void setTableRowGroup1(TableRowGroup trg) { + this.tableRowGroup1 = trg; + } + + private TableColumn tableColumn1 = new TableColumn(); + + public TableColumn getTableColumn1() { + return tableColumn1; + } + + public void setTableColumn1(TableColumn tc) { + this.tableColumn1 = tc; + } + + private TableColumn tableColumn2 = new TableColumn(); + + public TableColumn getTableColumn2() { + return tableColumn2; + } + + public void setTableColumn2(TableColumn tc) { + this.tableColumn2 = tc; + } + + private TableColumn tableColumn3 = new TableColumn(); + + public TableColumn getTableColumn3() { + return tableColumn3; + } + + public void setTableColumn3(TableColumn tc) { + this.tableColumn3 = tc; + } + + private HtmlPanelGrid gridPanel5 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel5() { + return gridPanel5; + } + + public void setGridPanel5(HtmlPanelGrid hpg) { + this.gridPanel5 = hpg; + } + + private Table table2 = new Table(); + + public Table getTable2() { + return table2; + } + + public void setTable2(Table t) { + this.table2 = t; + } + + private TableRowGroup tableRowGroup2 = new TableRowGroup(); + + public TableRowGroup getTableRowGroup2() { + return tableRowGroup2; + } + + public void setTableRowGroup2(TableRowGroup trg) { + this.tableRowGroup2 = trg; + } + + private TableColumn tableColumn4 = new TableColumn(); + + public TableColumn getTableColumn4() { + return tableColumn4; + } + + public void setTableColumn4(TableColumn tc) { + this.tableColumn4 = tc; + } + + private TableColumn tableColumn5 = new TableColumn(); + + public TableColumn getTableColumn5() { + return tableColumn5; + } + + public void setTableColumn5(TableColumn tc) { + this.tableColumn5 = tc; + } + + private TableColumn tableColumn6 = new TableColumn(); + + public TableColumn getTableColumn6() { + return tableColumn6; + } + + public void setTableColumn6(TableColumn tc) { + this.tableColumn6 = tc; + } + + private HtmlPanelGrid gridPanel6 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel6() { + return gridPanel6; + } + + public void setGridPanel6(HtmlPanelGrid hpg) { + this.gridPanel6 = hpg; + } + + private PanelGroup groupPanel1 = new PanelGroup(); + + public PanelGroup getGroupPanel1() { + return groupPanel1; + } + + public void setGroupPanel1(PanelGroup pg) { + this.groupPanel1 = pg; + } + + private StaticText staticText11 = new StaticText(); + + public StaticText getStaticText11() { + return staticText11; + } + + public void setStaticText11(StaticText st) { + this.staticText11 = st; + } + + private DropDown drpAno = new DropDown(); + + public DropDown getDrpAno() { + return drpAno; + } + + public void setDrpAno(DropDown dd) { + this.drpAno = dd; + } + + private PanelGroup groupPanel2 = new PanelGroup(); + + public PanelGroup getGroupPanel2() { + return groupPanel2; + } + + public void setGroupPanel2(PanelGroup pg) { + this.groupPanel2 = pg; + } + + private StaticText lblMes = new StaticText(); + + public StaticText getLblMes() { + return lblMes; + } + + public void setLblMes(StaticText st) { + this.lblMes = st; + } + + private DropDown drpMes = new DropDown(); + + public DropDown getDrpMes() { + return drpMes; + } + + public void setDrpMes(DropDown dd) { + this.drpMes = dd; + } + + private PanelGroup groupPanel3 = new PanelGroup(); + + public PanelGroup getGroupPanel3() { + return groupPanel3; + } + + public void setGroupPanel3(PanelGroup pg) { + this.groupPanel3 = pg; + } + + private StaticText lblDia = new StaticText(); + + public StaticText getLblDia() { + return lblDia; + } + + public void setLblDia(StaticText st) { + this.lblDia = st; + } + + private DropDown drpDia = new DropDown(); + + public DropDown getDrpDia() { + return drpDia; + } + + public void setDrpDia(DropDown dd) { + this.drpDia = dd; + } + + private PanelGroup groupPanel4 = new PanelGroup(); + + public PanelGroup getGroupPanel4() { + return groupPanel4; + } + + public void setGroupPanel4(PanelGroup pg) { + this.groupPanel4 = pg; + } + + private StaticText staticText14 = new StaticText(); + + public StaticText getStaticText14() { + return staticText14; + } + + public void setStaticText14(StaticText st) { + this.staticText14 = st; + } + + private TextField txtNome = new TextField(); + + public TextField getTxtNome() { + return txtNome; + } + + public void setTxtNome(TextField tf) { + this.txtNome = tf; + } + + private Button butPesquisar = new Button(); + + public Button getButPesquisar() { + return butPesquisar; + } + + public void setButPesquisar(Button b) { + this.butPesquisar = b; + } + + private HtmlPanelGrid gridPanel7 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel7() { + return gridPanel7; + } + + public void setGridPanel7(HtmlPanelGrid hpg) { + this.gridPanel7 = hpg; + } + + private Table table3 = new Table(); + + public Table getTable3() { + return table3; + } + + public void setTable3(Table t) { + this.table3 = t; + } + + private TableRowGroup tableRowGroup3 = new TableRowGroup(); + + public TableRowGroup getTableRowGroup3() { + return tableRowGroup3; + } + + public void setTableRowGroup3(TableRowGroup trg) { + this.tableRowGroup3 = trg; + } + + private TableColumn tableColumn7 = new TableColumn(); + + public TableColumn getTableColumn7() { + return tableColumn7; + } + + public void setTableColumn7(TableColumn tc) { + this.tableColumn7 = tc; + } + + private TableColumn tableColumn8 = new TableColumn(); + + public TableColumn getTableColumn8() { + return tableColumn8; + } + + public void setTableColumn8(TableColumn tc) { + this.tableColumn8 = tc; + } + + private TableColumn tableColumn9 = new TableColumn(); + + public TableColumn getTableColumn9() { + return tableColumn9; + } + + public void setTableColumn9(TableColumn tc) { + this.tableColumn9 = tc; + } + + private HtmlPanelGrid gridPanel8 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel8() { + return gridPanel8; + } + + public void setGridPanel8(HtmlPanelGrid hpg) { + this.gridPanel8 = hpg; + } + + private PanelGroup groupPanel5 = new PanelGroup(); + + public PanelGroup getGroupPanel5() { + return groupPanel5; + } + + public void setGroupPanel5(PanelGroup pg) { + this.groupPanel5 = pg; + } + + private ImageComponent image1 = new ImageComponent(); + + public ImageComponent getImage1() { + return image1; + } + + public void setImage1(ImageComponent ic) { + this.image1 = ic; + } + + private ImageComponent image2 = new ImageComponent(); + + public ImageComponent getImage2() { + return image2; + } + + public void setImage2(ImageComponent ic) { + this.image2 = ic; + } + + private PanelGroup groupPanel6 = new PanelGroup(); + + public PanelGroup getGroupPanel6() { + return groupPanel6; + } + + public void setGroupPanel6(PanelGroup pg) { + this.groupPanel6 = pg; + } + + private StaticText lblUser = new StaticText(); + + public StaticText getLblUser() { + return lblUser; + } + + public void setLblUser(StaticText st) { + this.lblUser = st; + } + + private StaticText staticText18 = new StaticText(); + + public StaticText getStaticText18() { + return staticText18; + } + + public void setStaticText18(StaticText st) { + this.staticText18 = st; + } + + private Hyperlink lnkChangePassword = new Hyperlink(); + + public Hyperlink getLnkChangePassword() { + return lnkChangePassword; + } + + public void setLnkChangePassword(Hyperlink h) { + this.lnkChangePassword = h; + } + + private StaticText staticText19 = new StaticText(); + + public StaticText getStaticText19() { + return staticText19; + } + + public void setStaticText19(StaticText st) { + this.staticText19 = st; + } + + private Hyperlink lnkLogout = new Hyperlink(); + + public Hyperlink getLnkLogout() { + return lnkLogout; + } + + public void setLnkLogout(Hyperlink h) { + this.lnkLogout = h; + } + + private Hyperlink lnkDataAcidente = new Hyperlink(); + + public Hyperlink getLnkDataAcidente() { + return lnkDataAcidente; + } + + public void setLnkDataAcidente(Hyperlink h) { + this.lnkDataAcidente = h; + } + + private Hyperlink lnkNr = new Hyperlink(); + + public Hyperlink getLnkNr() { + return lnkNr; + } + + public void setLnkNr(Hyperlink h) { + this.lnkNr = h; + } + + private Hyperlink lnkNomeAcidentado = new Hyperlink(); + + public Hyperlink getLnkNomeAcidentado() { + return lnkNomeAcidentado; + } + + public void setLnkNomeAcidentado(Hyperlink h) { + this.lnkNomeAcidentado = h; + } + + private Hyperlink lnkDataAcidenteSeg = new Hyperlink(); + + public Hyperlink getLnkDataAcidenteSeg() { + return lnkDataAcidenteSeg; + } + + public void setLnkDataAcidenteSeg(Hyperlink h) { + this.lnkDataAcidenteSeg = h; + } + + private Hyperlink lnkNrSeg = new Hyperlink(); + + public Hyperlink getLnkNrSeg() { + return lnkNrSeg; + } + + public void setLnkNrSeg(Hyperlink h) { + this.lnkNrSeg = h; + } + + private Hyperlink lnkNomeAcidentadoSeg = new Hyperlink(); + + public Hyperlink getLnkNomeAcidentadoSeg() { + return lnkNomeAcidentadoSeg; + } + + public void setLnkNomeAcidentadoSeg(Hyperlink h) { + this.lnkNomeAcidentadoSeg = h; + } + + private Hyperlink hyperlink7 = new Hyperlink(); + + public Hyperlink getHyperlink7() { + return hyperlink7; + } + + public void setHyperlink7(Hyperlink h) { + this.hyperlink7 = h; + } + + private Hyperlink hyperlink8 = new Hyperlink(); + + public Hyperlink getHyperlink8() { + return hyperlink8; + } + + public void setHyperlink8(Hyperlink h) { + this.hyperlink8 = h; + } + + private Hyperlink hyperlink9 = new Hyperlink(); + + public Hyperlink getHyperlink9() { + return hyperlink9; + } + + public void setHyperlink9(Hyperlink h) { + this.hyperlink9 = h; + } + + private StaticText txtSearchMsg = new StaticText(); + + public StaticText getTxtSearchMsg() { + return txtSearchMsg; + } + + public void setTxtSearchMsg(StaticText st) { + this.txtSearchMsg = st; + } + + private StaticText staticText5 = new StaticText(); + + public StaticText getStaticText5() { + return staticText5; + } + + public void setStaticText5(StaticText st) { + this.staticText5 = st; + } + + //
+ + /** + *

Construct a new Page bean instance.

+ */ + public FormSeguranca() { + } + + /** + *

Callback method that is called whenever a page is navigated to, + * either directly via a URL, or indirectly via page navigation. + * Customize this method to acquire resources that will be needed + * for event handlers and lifecycle methods, whether or not this + * page is performing post back processing.

+ * + *

Note that, if the current request is a postback, the property + * values of the components do not represent any + * values submitted with this request. Instead, they represent the + * property values that were saved for this view when it was rendered.

+ */ + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + // + // Initialize automatically managed components + // *Note* - this logic should NOT be modified + try { + _init(); + } catch (Exception e) { + log("FormSeguranca Initialization Failure", e); + throw e instanceof FacesException ? (FacesException) e: new FacesException(e); + } + + // + // Perform application initialization that must complete + // *after* managed components are initialized + // TODO - add your own initialization code here + + if (!getSessionBean1().isLoggedIn()) { + try { + getExternalContext().redirect("Login.jsp"); + } catch(Exception e) { + // . . . handle exception . . . + } + } + } + + /** + *

Callback method that is called after the component tree has been + * restored, but before any event processing takes place. This method + * will only be called on a postback request that + * is processing a form submit. Customize this method to allocate + * resources that will be required in your event handlers.

+ */ + public void preprocess() { + + } + + /** + *

Callback method that is called just before rendering takes place. + * This method will only be called for the page that + * will actually be rendered (and not, for example, on a page that + * handled a postback and then navigated to a different page). Customize + * this method to allocate resources that will be required for rendering + * this page.

+ */ + public void prerender() { + lblUser.setText( getSessionBean1().getCurrentUser().getLogin() ); + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + //lblActivos.setRendered(true); + table1.setRendered(true); + + ArrayList actuaisList = adp.getAnalisesActuaisList(getSessionBean1().getCurrentUser().getEstabelecimento_id(), new Integer(1)); + getSessionBean1().getAnalisesActualDataProvider().setList(actuaisList); + } + catch(Exception ex) + { + //lblActivos.setRendered(false); + table1.setRendered(false); + ex.printStackTrace(); + } + + try + { + //lblActivos.setRendered(true); + table2.setRendered(true); + + ArrayList seguimentoList = adp.getAnalisesSeguimentoList(getSessionBean1().getCurrentUser().getEstabelecimento_id(), new Integer(1)); + getSessionBean1().getAnalisesSeguimentoDataProvider().setList(seguimentoList); + } + catch(Exception ex) + { + //lblActivos.setRendered(false); + table2.setRendered(false); + ex.printStackTrace(); + } + + HttpServletRequest request = (HttpServletRequest) getExternalContext().getRequest(); + String referer = request.getRequestURI(); + String pageFrom = getPageFrom(referer); + if(!pageFrom.matches("FormSeguranca.jsp")) + { + + try + { + //lblActivos.setRendered(true); + table3.setRendered(true); + + ArrayList concluidasList = adp.getAnalisesConcluidasList(getSessionBean1().getCurrentUser().getEstabelecimento_id()); + getSessionBean1().getAnalisesConcluidasDataProvider().setList(concluidasList); + } + catch(Exception ex) + { + //lblActivos.setRendered(false); + table3.setRendered(false); + ex.printStackTrace(); + } + fillAnoDropDown(); + } + + } + + /** + *

Callback method that is called after rendering is completed for + * this request, if init() was called (regardless of whether + * or not this was the page that was actually rendered). Customize this + * method to release resources acquired in the init(), + * preprocess(), or prerender() methods (or + * acquired during execution of an event handler).

+ */ + public void destroy() { + } + + +// private void fillDateDropDowns() +// { +// fillAnoDropDown(); +// //fillMesDropDown(); +// //fillDiaDropDown(); +// } + + private void fillAnoDropDown() + { + ArrayList anosList = new ArrayList(); + for(int ano=2007; ano<2051; ano++) + { + anosList.add(new Integer(ano)); + } + com.sun.rave.web.ui.model.Option[] anoOptions = new com.sun.rave.web.ui.model.Option[anosList.size()+1]; + anoOptions[0] = new Option("", ""); + ListIterator iter = anosList.listIterator(); + int i = 1; + while(iter.hasNext()) + { + Integer ano = (Integer) iter.next(); + + anoOptions[i] = new Option(ano, ano.toString()); + i++; + } + getSessionBean1().setAnoOptions(anoOptions); + Calendar cal = new GregorianCalendar(); + int year = cal.get(Calendar.YEAR); + //drpAno.setSelected( new Integer(year) ); + } + + private void fillMesDropDown() + { + com.sun.rave.web.ui.model.Option[] mesOptions = new com.sun.rave.web.ui.model.Option[13]; + mesOptions[0] = new Option("", ""); + mesOptions[1] = new Option(new Integer(1), "Janeiro"); + mesOptions[2] = new Option(new Integer(2), "Fevereiro"); + mesOptions[3] = new Option(new Integer(3), "Março"); + mesOptions[4] = new Option(new Integer(4), "Abril"); + mesOptions[5] = new Option(new Integer(5), "Maio"); + mesOptions[6] = new Option(new Integer(6), "Junho"); + mesOptions[7] = new Option(new Integer(7), "Julho"); + mesOptions[8] = new Option(new Integer(8), "Agosto"); + mesOptions[9] = new Option(new Integer(9), "Setembro"); + mesOptions[10] = new Option(new Integer(10), "Outubro"); + mesOptions[11] = new Option(new Integer(11), "Novembro"); + mesOptions[12] = new Option(new Integer(12), "Dezembro"); + getSessionBean1().setMesOptions(mesOptions); + Calendar cal = new GregorianCalendar(); + int month = cal.get(Calendar.MONTH); // 0=Jan, 1=Feb, ... + //drpMes.setSelected( new Integer(month+1) ); + } + + private void fillDiaDropDown() + { + int ano = ( (Integer)drpAno.getSelected() ).intValue(); + int mes = ( (Integer)drpMes.getSelected() ).intValue(); + int dias = 0; + switch (mes) { + case 1: dias=31; break; + case 2: + GregorianCalendar cal = new GregorianCalendar(); + if(cal.isLeapYear(ano)) + { + dias = 29; + } + else + { + dias = 28; + } + break; + case 3: dias=31; break; + case 4: dias=30; break; + case 5: dias=31; break; + case 6: dias=30; break; + case 7: dias=31; break; + case 8: dias=31; break; + case 9: dias=30; break; + case 10: dias=31; break; + case 11: dias=30; break; + case 12: dias=31; break; + default: System.out.println("Invalid month.");break; + } + + ArrayList diasList = new ArrayList(); + for(int dia=1; diaReturn a reference to the scoped data bean.

+ */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1)getBean("RequestBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1)getBean("SessionBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1)getBean("ApplicationBean1"); + } + + public String lnkLogout_action() { + // TODO: Replace with your code + // Invalidate the current session + javax.servlet.http.HttpSession session = + (javax.servlet.http.HttpSession) getExternalContext().getSession(true); + session.invalidate(); + return "login"; + } + + public void drpAno_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + Object ano = event.getNewValue(); + if(ano == null) + { + lblMes.setVisible(false); + drpMes.setVisible(false); + lblDia.setVisible(false); + drpDia.setVisible(false); + } + else + { + lblMes.setVisible(true); + drpMes.setVisible(true); + fillMesDropDown(); + } + } + + public void drpMes_processValueChange(ValueChangeEvent event) { + // TODO: Replace with your code + Object mes = event.getNewValue(); + if(mes == null) + { + lblDia.setVisible(false); + drpDia.setVisible(false); + } + else + { + lblDia.setVisible(true); + drpDia.setVisible(true); + fillDiaDropDown(); + } + } + + public String butPesquisar_action() { + // TODO: Process the button click action. Return value is a navigation + // case name where null will return to the same page. + Object obAno = null; + Object obMes = null; + Object obDia = null; + try + { + obAno = drpAno.getSelected(); + obMes = drpMes.getSelected(); + obDia = drpDia.getSelected(); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + Integer ano = null; + Integer mes = null; + Integer dia = null; + + if(obAno != null) + { + ano = (Integer) obAno; + } + + if(obMes != null) + { + mes = (Integer) obMes; + } + + if(obDia != null) + { + dia = (Integer) obDia; + } + + String nome = null; + if(txtNome.getText() != null) + { + nome = (String) txtNome.getText(); + } + + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + + //getSessionBean1().getAnalisesConcluidasDataProvider().setList(new ArrayList()); + ArrayList concluidasList = adp.searchAanalisesConcluidasList(getSessionBean1().getCurrentUser().getEstabelecimento_id(), ano, mes, dia, nome); + + table3.setRendered(true); + txtSearchMsg.setRendered(false); + getSessionBean1().getAnalisesConcluidasDataProvider().setList(concluidasList); + + + } + catch(Exception ex) + { + table3.setRendered(false); + txtSearchMsg.setRendered(true); + txtSearchMsg.setText("Não foram encontrados registos para a sua pesquisa !"); + ex.printStackTrace(); + } + + return null; + } + + public void drpDia_processValueChange(ValueChangeEvent vce) { + // TODO: Replace with your code + + } + + private String getPageFrom(String referer) + { + String pageFrom = referer.substring(referer.lastIndexOf("/")+1); + return pageFrom; + } + + public String butNovaAnalise_action() { + // TODO: Process the button click action. Return value is a navigation + // case name where null will return to the same page. + + getSessionBean1().setNavFrom("FormSeguranca"); + getSessionBean1().setCurrentAnalise(null); + return "analise_acidente"; + } + + public String lnkDataAcidente_action() { + // TODO: Replace with your code + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "analise_acidente"; + } + + public String lnkNr_action() { + // TODO: Replace with your code + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "analise_acidente"; + } + + public String lnkNomeAcidentado_action() { + // TODO: Replace with your code + AnaliseAcidente a = getTableActivosRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "analise_acidente"; + } + + private AnaliseAcidente getTableActivosRowData() + { + RowKey rk = tableRowGroup1.getRowKey(); + int k = Integer.parseInt(rk.getRowId()); + AnalisesActualDataProvider provider = (AnalisesActualDataProvider) tableRowGroup1.getSourceData(); + ArrayList list = (ArrayList) provider.getList(); + AnaliseAcidente a = (AnaliseAcidente)list.get(k); + return a; + } + + public String lnkDataAcidenteSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "view_analise"; + + } + + public String lnkNrSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "view_analise"; + } + + public String lnkNomeAcidentadoSeg_action() { + // TODO: Replace with your code + + AnaliseAcidente a = getTableSeguimentoRowData(); + getSessionBean1().setCurrentAnalise(a); + getSessionBean1().setNavFrom("FormSeguranca"); + return "view_analise"; + } + + private AnaliseAcidente getTableSeguimentoRowData() + { + RowKey rk = tableRowGroup2.getRowKey(); + int k = Integer.parseInt(rk.getRowId()); + AnalisesSeguimentoDataProvider provider = (AnalisesSeguimentoDataProvider) tableRowGroup2.getSourceData(); + ArrayList list = (ArrayList) provider.getList(); + AnaliseAcidente a = (AnaliseAcidente)list.get(k); + return a; + } + +} + diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Header.java b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Header.java new file mode 100644 index 00000000..7bcdb7dc --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Header.java @@ -0,0 +1,120 @@ +/* + * Header.java + * + * Created on September 19, 2007, 10:14 AM + * Copyright lluis + */ +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; + +/** + *

Fragment bean that corresponds to a similarly named JSP page + * fragment. This class contains component definitions (and initialization + * code) for all components that you have defined on this fragment, as well as + * lifecycle methods and event handlers where you may add behavior + * to respond to incoming events.

+ */ +public class Header extends AbstractFragmentBean { + // + private int __placeholder; + + /** + *

Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.

+ */ + private void _init() throws Exception { + } + + private HtmlPanelGrid gridPanel1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel1() { + return gridPanel1; + } + + public void setGridPanel1(HtmlPanelGrid hpg) { + this.gridPanel1 = hpg; + } + + private StaticText staticText1 = new StaticText(); + + public StaticText getStaticText1() { + return staticText1; + } + + public void setStaticText1(StaticText st) { + this.staticText1 = st; + } + //
+ + public Header() { + } + + /** + *

Callback method that is called whenever a page containing + * this page fragment is navigated to, either directly via a URL, + * or indirectly via page navigation. Override this method to acquire + * resources that will be needed for event handlers and lifecycle methods.

+ * + *

The default implementation does nothing.

+ */ + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + + // + // Initialize automatically managed components + // *Note* - this logic should NOT be modified + try { + _init(); + } catch (Exception e) { + log("Page1 Initialization Failure", e); + throw e instanceof FacesException ? (FacesException) e: new FacesException(e); + } + + // + // Perform application initialization that must complete + // *after* managed components are initialized + // TODO - add your own initialization code here + } + + /** + *

Callback method that is called after rendering is completed for + * this request, if init() was called. Override this + * method to release resources acquired in the init() + * resources that will be needed for event handlers and lifecycle methods.

+ * + *

The default implementation does nothing.

+ */ + public void destroy() { + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1)getBean("RequestBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1)getBean("SessionBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1)getBean("ApplicationBean1"); + } +} diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/LoadImage.java b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/LoadImage.java new file mode 100644 index 00000000..8439b42f --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/LoadImage.java @@ -0,0 +1,480 @@ +/* + * LoadImage.java + * + * Created on September 26, 2007, 5:36 PM + * Copyright lluis + */ +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.Html; +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.component.Upload; +import com.sun.rave.web.ui.model.UploadedFile; +import java.io.File; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; +import javax.servlet.ServletContext; + +/** + *

Page bean that corresponds to a similarly named JSP page. This + * class contains component definitions (and initialization code) for + * all components that you have defined on this page, as well as + * lifecycle methods and event handlers where you may add behavior + * to respond to incoming events.

+ */ +public class LoadImage extends AbstractPageBean { + // + private int __placeholder; + + /** + *

Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.

+ */ + private void _init() throws Exception { + } + + private Page page1 = new Page(); + + public Page getPage1() { + return page1; + } + + public void setPage1(Page p) { + this.page1 = p; + } + + private Html html1 = new Html(); + + public Html getHtml1() { + return html1; + } + + public void setHtml1(Html h) { + this.html1 = h; + } + + private Head head1 = new Head(); + + public Head getHead1() { + return head1; + } + + public void setHead1(Head h) { + this.head1 = h; + } + + private Link link1 = new Link(); + + public Link getLink1() { + return link1; + } + + public void setLink1(Link l) { + this.link1 = l; + } + + private Body body1 = new Body(); + + public Body getBody1() { + return body1; + } + + public void setBody1(Body b) { + this.body1 = b; + } + + private Form form1 = new Form(); + + public Form getForm1() { + return form1; + } + + public void setForm1(Form f) { + this.form1 = f; + } + + private HtmlPanelGrid gridBase1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridBase1() { + return gridBase1; + } + + public void setGridBase1(HtmlPanelGrid hpg) { + this.gridBase1 = hpg; + } + + private HtmlPanelGrid gridLayout = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridLayout() { + return gridLayout; + } + + public void setGridLayout(HtmlPanelGrid hpg) { + this.gridLayout = hpg; + } + + private StaticText staticText1 = new StaticText(); + + public StaticText getStaticText1() { + return staticText1; + } + + public void setStaticText1(StaticText st) { + this.staticText1 = st; + } + + private Upload fileUpload1 = new Upload(); + + public Upload getFileUpload1() { + return fileUpload1; + } + + public void setFileUpload1(Upload u) { + this.fileUpload1 = u; + } + + private Button butUpload = new Button(); + + public Button getButUpload() { + return butUpload; + } + + public void setButUpload(Button b) { + this.butUpload = b; + } + + //
+ /** + *

Construct a new Page bean instance.

+ */ + + private String realImageFilePath; + //private static final String IMAGE_URL = "/resources/image-file"; + private String IMAGE_URL = "/resources/images"; + + private StaticText staticText2 = new StaticText(); + + public StaticText getStaticText2() { + return staticText2; + } + + public void setStaticText2(StaticText st) { + this.staticText2 = st; + } + + private PanelGroup groupPanel1 = new PanelGroup(); + + public PanelGroup getGroupPanel1() { + return groupPanel1; + } + + public void setGroupPanel1(PanelGroup pg) { + this.groupPanel1 = pg; + } + + private StaticText staticText3 = new StaticText(); + + public StaticText getStaticText3() { + return staticText3; + } + + public void setStaticText3(StaticText st) { + this.staticText3 = st; + } + + private StaticText txtFileName = new StaticText(); + + public StaticText getTxtFileName() { + return txtFileName; + } + + public void setTxtFileName(StaticText st) { + this.txtFileName = st; + } + + private PanelGroup groupPanel2 = new PanelGroup(); + + public PanelGroup getGroupPanel2() { + return groupPanel2; + } + + public void setGroupPanel2(PanelGroup pg) { + this.groupPanel2 = pg; + } + + private StaticText staticText5 = new StaticText(); + + public StaticText getStaticText5() { + return staticText5; + } + + public void setStaticText5(StaticText st) { + this.staticText5 = st; + } + + private StaticText txtFileType = new StaticText(); + + public StaticText getTxtFileType() { + return txtFileType; + } + + public void setTxtFileType(StaticText st) { + this.txtFileType = st; + } + + private PanelGroup groupPanel3 = new PanelGroup(); + + public PanelGroup getGroupPanel3() { + return groupPanel3; + } + + public void setGroupPanel3(PanelGroup pg) { + this.groupPanel3 = pg; + } + + private StaticText staticText7 = new StaticText(); + + public StaticText getStaticText7() { + return staticText7; + } + + public void setStaticText7(StaticText st) { + this.staticText7 = st; + } + + private StaticText txtFileSize = new StaticText(); + + public StaticText getTxtFileSize() { + return txtFileSize; + } + + public void setTxtFileSize(StaticText st) { + this.txtFileSize = st; + } + + private ImageComponent image1 = new ImageComponent(); + + public ImageComponent getImage1() { + return image1; + } + + public void setImage1(ImageComponent ic) { + this.image1 = ic; + } + + private StaticText txtMsg = new StaticText(); + + public StaticText getTxtMsg() { + return txtMsg; + } + + public void setTxtMsg(StaticText st) { + this.txtMsg = st; + } + public LoadImage() { + } + + /** + *

Callback method that is called whenever a page is navigated to, + * either directly via a URL, or indirectly via page navigation. + * Customize this method to acquire resources that will be needed + * for event handlers and lifecycle methods, whether or not this + * page is performing post back processing.

+ * + *

Note that, if the current request is a postback, the property + * values of the components do not represent any + * values submitted with this request. Instead, they represent the + * property values that were saved for this view when it was rendered.

+ */ + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + // + // Initialize automatically managed components + // *Note* - this logic should NOT be modified + try { + _init(); + } catch (Exception e) { + log("LoadImage Initialization Failure", e); + throw e instanceof FacesException ? (FacesException) e: new FacesException(e); + } + + // + // Perform application initialization that must complete + // *after* managed components are initialized + // TODO - add your own initialization code here + + if (!getSessionBean1().isLoggedIn()) { + try { + getExternalContext().redirect("Login.jsp"); + } catch(Exception e) { + // . . . handle exception . . . + } + } + + getSessionBean1().setImageName(null); + ServletContext theApplicationsServletContext = + (ServletContext) this.getExternalContext().getContext(); + this.realImageFilePath = theApplicationsServletContext.getRealPath(IMAGE_URL); + try + { + realImageFilePath += "/tmp" + getSessionBean1().getCurrentUser().getLogin(); + File f = new File(realImageFilePath); + f.mkdir(); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + } + + /** + *

Callback method that is called after the component tree has been + * restored, but before any event processing takes place. This method + * will only be called on a postback request that + * is processing a form submit. Customize this method to allocate + * resources that will be required in your event handlers.

+ */ + public void preprocess() { + } + + /** + *

Callback method that is called just before rendering takes place. + * This method will only be called for the page that + * will actually be rendered (and not, for example, on a page that + * handled a postback and then navigated to a different page). Customize + * this method to allocate resources that will be required for rendering + * this page.

+ */ + public void prerender() { + String uploadedFileName = (String) + this.txtFileName.getValue(); + if ( uploadedFileName != null ) { + IMAGE_URL += getSessionBean1().getImageName(); + System.out.println("IMAGE URL : " + IMAGE_URL); + image1.setUrl(IMAGE_URL); + } + txtMsg.setText(getSessionBean1().getMsg()); + getSessionBean1().setMsg(""); + + } + + /** + *

Callback method that is called after rendering is completed for + * this request, if init() was called (regardless of whether + * or not this was the page that was actually rendered). Customize this + * method to release resources acquired in the init(), + * preprocess(), or prerender() methods (or + * acquired during execution of an event handler).

+ */ + public void destroy() { + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1)getBean("RequestBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1)getBean("ApplicationBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1)getBean("SessionBean1"); + } + + public String lnkLogout_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkNome_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkDataNascimento_action() { + // TODO: Replace with your code + + return null; + } + + public String butUpload_action() { + // TODO: Process the button click action. Return value is a navigation + // case name where null will return to the same page. + + UploadedFile uploadedFile = fileUpload1.getUploadedFile(); + String uploadedFileName = uploadedFile.getOriginalName(); + // Some browsers return complete path name, some don't + // Make sure we only have the file name + // First, try forward slash + int index = uploadedFileName.lastIndexOf('/'); + String justFileName; + if ( index >= 0) { + justFileName = uploadedFileName.substring( index + 1 ); + } else { + // Try backslash + index = uploadedFileName.lastIndexOf('\\'); + if (index >= 0) { + justFileName = uploadedFileName.substring( index + 1 ); + } else { + // No forward or back slashes + justFileName = uploadedFileName; + } + } + justFileName = justFileName.substring(0, justFileName.lastIndexOf('.')); + this.txtFileName.setValue(justFileName); + Long uploadedFileSize = new Long(uploadedFile.getSize()); + this.txtFileSize.setValue(uploadedFileSize); + String uploadedFileType = uploadedFile.getContentType(); + this.txtFileType.setValue(uploadedFileType); + if ( uploadedFileType.equals("image/jpeg") + || uploadedFileType.equals("image/pjpeg") + || uploadedFileType.equals("image/gif") + || uploadedFileType.equals("image/png") + || uploadedFileType.equals("image/x-png")) { + try { + realImageFilePath += "/" + justFileName; + File file = new File(this.realImageFilePath); + uploadedFile.write(file); + getSessionBean1().setImageName(justFileName); + //getSessionBean1().setMsg("Ficheiro carregado !"); + } catch (Exception ex) { + ex.printStackTrace(); + getSessionBean1().setMsg("Não foi possivel carregar o ficheiro !"); + return null; + } + } else { + getSessionBean1().setMsg("O ficheiro deve ser do tipo JPEG, PJPEG, GIF, PNG, ou X-PNG !"); + new File(this.realImageFilePath).delete(); + return null; + } + return "analise_acidente"; + } +} + diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Login.java b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Login.java new file mode 100644 index 00000000..51f5a432 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Login.java @@ -0,0 +1,447 @@ +/* + * Page1.java + * + * Created on September 18, 2007, 3:14 PM + * Copyright lluis + */ +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.Html; +import com.sun.rave.web.ui.component.Hyperlink; +import com.sun.rave.web.ui.component.Link; +import com.sun.rave.web.ui.component.Page; +import com.sun.rave.web.ui.component.PasswordField; +import com.sun.rave.web.ui.component.StaticText; +import com.sun.rave.web.ui.component.TextField; +import db.UtilizadoresDataProvider; +import java.sql.Connection; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; + +/** + *

Page bean that corresponds to a similarly named JSP page. This + * class contains component definitions (and initialization code) for + * all components that you have defined on this page, as well as + * lifecycle methods and event handlers where you may add behavior + * to respond to incoming events.

+ */ +public class Login extends AbstractPageBean { + // + private int __placeholder; + + /** + *

Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.

+ */ + private void _init() throws Exception { + } + + private Page page1 = new Page(); + + public Page getPage1() { + return page1; + } + + public void setPage1(Page p) { + this.page1 = p; + } + + private Html html1 = new Html(); + + public Html getHtml1() { + return html1; + } + + public void setHtml1(Html h) { + this.html1 = h; + } + + private Head head1 = new Head(); + + public Head getHead1() { + return head1; + } + + public void setHead1(Head h) { + this.head1 = h; + } + + private Link link1 = new Link(); + + public Link getLink1() { + return link1; + } + + public void setLink1(Link l) { + this.link1 = l; + } + + private Body body1 = new Body(); + + public Body getBody1() { + return body1; + } + + public void setBody1(Body b) { + this.body1 = b; + } + + private Form form1 = new Form(); + + public Form getForm1() { + return form1; + } + + public void setForm1(Form f) { + this.form1 = f; + } + + private HtmlPanelGrid gridPanel6 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel6() { + return gridPanel6; + } + + public void setGridPanel6(HtmlPanelGrid hpg) { + this.gridPanel6 = hpg; + } + + private HtmlPanelGrid gridPanel1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel1() { + return gridPanel1; + } + + public void setGridPanel1(HtmlPanelGrid hpg) { + this.gridPanel1 = hpg; + } + + private HtmlPanelGrid gridPanel2 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel2() { + return gridPanel2; + } + + public void setGridPanel2(HtmlPanelGrid hpg) { + this.gridPanel2 = hpg; + } + + private HtmlPanelGrid gridPanel3 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel3() { + return gridPanel3; + } + + public void setGridPanel3(HtmlPanelGrid hpg) { + this.gridPanel3 = hpg; + } + + private HtmlPanelGrid gridPanel4 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel4() { + return gridPanel4; + } + + public void setGridPanel4(HtmlPanelGrid hpg) { + this.gridPanel4 = hpg; + } + + private StaticText staticText1 = new StaticText(); + + public StaticText getStaticText1() { + return staticText1; + } + + public void setStaticText1(StaticText st) { + this.staticText1 = st; + } + + private TextField txtUtilizador = new TextField(); + + public TextField getTxtUtilizador() { + return txtUtilizador; + } + + public void setTxtUtilizador(TextField tf) { + this.txtUtilizador = tf; + } + + private StaticText staticText2 = new StaticText(); + + public StaticText getStaticText2() { + return staticText2; + } + + public void setStaticText2(StaticText st) { + this.staticText2 = st; + } + + private PasswordField txtPassword = new PasswordField(); + + public PasswordField getTxtPassword() { + return txtPassword; + } + + public void setTxtPassword(PasswordField pf) { + this.txtPassword = pf; + } + + private HtmlPanelGrid gridPanel5 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel5() { + return gridPanel5; + } + + public void setGridPanel5(HtmlPanelGrid hpg) { + this.gridPanel5 = hpg; + } + + private Hyperlink lnkPassRecovery = new Hyperlink(); + + public Hyperlink getLnkPassRecovery() { + return lnkPassRecovery; + } + + public void setLnkPassRecovery(Hyperlink h) { + this.lnkPassRecovery = h; + } + + private Button butLogin = new Button(); + + public Button getButLogin() { + return butLogin; + } + + public void setButLogin(Button b) { + this.butLogin = b; + } + + private StaticText txtMsg = new StaticText(); + + public StaticText getTxtMsg() { + return txtMsg; + } + + public void setTxtMsg(StaticText st) { + this.txtMsg = st; + } + + //
+ /** + *

Construct a new Page bean instance.

+ */ + public Login() { + connect(); + } + + /** + *

Callback method that is called whenever a page is navigated to, + * either directly via a URL, or indirectly via page navigation. + * Customize this method to acquire resources that will be needed + * for event handlers and lifecycle methods, whether or not this + * page is performing post back processing.

+ * + *

Note that, if the current request is a postback, the property + * values of the components do not represent any + * values submitted with this request. Instead, they represent the + * property values that were saved for this view when it was rendered.

+ */ + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + // + // Initialize automatically managed components + // *Note* - this logic should NOT be modified + try { + _init(); + } catch (Exception e) { + log("Page1 Initialization Failure", e); + throw e instanceof FacesException ? (FacesException) e: new FacesException(e); + } + + // + // Perform application initialization that must complete + // *after* managed components are initialized + // TODO - add your own initialization code here + + } + + /** + *

Callback method that is called after the component tree has been + * restored, but before any event processing takes place. This method + * will only be called on a postback request that + * is processing a form submit. Customize this method to allocate + * resources that will be required in your event handlers.

+ */ + public void preprocess() { + } + + /** + *

Callback method that is called just before rendering takes place. + * This method will only be called for the page that + * will actually be rendered (and not, for example, on a page that + * handled a postback and then navigated to a different page). Customize + * this method to allocate resources that will be required for rendering + * this page.

+ */ + public void prerender() { + txtMsg.setText(getSessionBean1().getMsg()); + getSessionBean1().setMsg(""); + } + + /** + *

Callback method that is called after rendering is completed for + * this request, if init() was called (regardless of whether + * or not this was the page that was actually rendered). Customize this + * method to release resources acquired in the init(), + * preprocess(), or prerender() methods (or + * acquired during execution of an event handler).

+ */ + public void destroy() { + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1)getBean("SessionBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1)getBean("RequestBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1)getBean("ApplicationBean1"); + } + + public String butLogin_action() { + // TODO: Process the button click action. Return value is a navigation + // case name where null will return to the same page. + String sRet = null; + + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + if(txtUtilizador.getText() != null) + { + String utilizador = (String) txtUtilizador.getText(); + if(utilizador.trim().length() > 0) + { + if(txtPassword.getText() != null) + { + String password = (String) txtPassword.getText(); + if(password.trim().length() > 0) + { + try + { + Utilizador u = udp.getUtilizador(utilizador); + if(!password.equals(u.getPassword())) + { + getSessionBean1().setMsg("Palavra-chave inválida !"); + } + else + { + //if(u.getOwner_id().intValue() == 0 ) + + //Login Ok ! + + try + { + Integer permissao = udp.getPermissionCode(u.getId()); + if(permissao.intValue() == 1) //seguranca + { + sRet = "form_seguranca"; + } + else if(permissao.intValue() == 2) // rh + { + sRet = "form_rh"; + } + else if(permissao.intValue() == 3) // hs + { + sRet = "form_hs"; + } + else if(permissao.intValue() == 5) // medico + { + //sRet = "form_rh"; + } + u.setCodigo_permissao(permissao); + getSessionBean1().setCurrentUser( u ); + getSessionBean1().setLoggedIn(true); + } + catch(Exception e1) + { + e1.printStackTrace(); + getSessionBean1().setMsg("Não tem permissão para entrar na aplicação !"); + } + } + } + catch(Exception ex) + { + getSessionBean1().setMsg("Utilizador inválido ! " + ex.getMessage()); + } + } + else + { + getSessionBean1().setMsg("Falta palavra-chave !"); + } + } + else + { + getSessionBean1().setMsg("Falta palavra-chave !"); + } + } + else + { + getSessionBean1().setMsg("Falta utilizador !"); + } + } + else + { + getSessionBean1().setMsg("Falta utilizador !"); + } + return sRet; + } + + public String lnkPassRecovery_action() { + // TODO: Replace with your code + + return "recuperar_password"; + } + + private void connect() + { + db.Db db = new db.Db(); + try + { + Connection connection = db.connect(); + } + catch(Exception ex) + { + getSessionBean1().setMsg("Erro na ligação à Base de Dados"); + //***** terminate session + try { + getExternalContext().redirect("faces/Erro.jsp"); + } catch(Exception e) { + // . . . handle exception . . . + e.printStackTrace(); + } + ex.printStackTrace(); + } + } +} + diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/RecuperarPassword.java b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/RecuperarPassword.java new file mode 100644 index 00000000..cbab194b --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/RecuperarPassword.java @@ -0,0 +1,525 @@ +/* + * RecuperarPassword.java + * + * Created on September 19, 2007, 9:57 AM + * Copyright lluis + */ +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.Html; +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.component.TextField; +import db.UtilizadoresDataProvider; +import java.util.Date; +import java.util.Properties; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; +import javax.mail.BodyPart; +import javax.mail.Message; +import javax.mail.Multipart; +import javax.mail.Session; +import javax.mail.Transport; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeBodyPart; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeMultipart; + +/** + *

Page bean that corresponds to a similarly named JSP page. This + * class contains component definitions (and initialization code) for + * all components that you have defined on this page, as well as + * lifecycle methods and event handlers where you may add behavior + * to respond to incoming events.

+ */ +public class RecuperarPassword extends AbstractPageBean { + // + private int __placeholder; + + /** + *

Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.

+ */ + private void _init() throws Exception { + } + + private Page page1 = new Page(); + + public Page getPage1() { + return page1; + } + + public void setPage1(Page p) { + this.page1 = p; + } + + private Html html1 = new Html(); + + public Html getHtml1() { + return html1; + } + + public void setHtml1(Html h) { + this.html1 = h; + } + + private Head head1 = new Head(); + + public Head getHead1() { + return head1; + } + + public void setHead1(Head h) { + this.head1 = h; + } + + private Link link1 = new Link(); + + public Link getLink1() { + return link1; + } + + public void setLink1(Link l) { + this.link1 = l; + } + + private Body body1 = new Body(); + + public Body getBody1() { + return body1; + } + + public void setBody1(Body b) { + this.body1 = b; + } + + private Form form1 = new Form(); + + public Form getForm1() { + return form1; + } + + public void setForm1(Form f) { + this.form1 = f; + } + + private HtmlPanelGrid gridPanel1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel1() { + return gridPanel1; + } + + public void setGridPanel1(HtmlPanelGrid hpg) { + this.gridPanel1 = hpg; + } + + private HtmlPanelGrid gridPanel2 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel2() { + return gridPanel2; + } + + public void setGridPanel2(HtmlPanelGrid hpg) { + this.gridPanel2 = hpg; + } + + private HtmlPanelGrid gridPanel3 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel3() { + return gridPanel3; + } + + public void setGridPanel3(HtmlPanelGrid hpg) { + this.gridPanel3 = hpg; + } + + private StaticText txtMsg = new StaticText(); + + public StaticText getTxtMsg() { + return txtMsg; + } + + public void setTxtMsg(StaticText st) { + this.txtMsg = st; + } + + private StaticText staticText3 = new StaticText(); + + public StaticText getStaticText3() { + return staticText3; + } + + public void setStaticText3(StaticText st) { + this.staticText3 = st; + } + + private HtmlPanelGrid gridPanel4 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel4() { + return gridPanel4; + } + + public void setGridPanel4(HtmlPanelGrid hpg) { + this.gridPanel4 = hpg; + } + + private StaticText staticText1 = new StaticText(); + + public StaticText getStaticText1() { + return staticText1; + } + + public void setStaticText1(StaticText st) { + this.staticText1 = st; + } + + private TextField txtUtilizador = new TextField(); + + public TextField getTxtUtilizador() { + return txtUtilizador; + } + + public void setTxtUtilizador(TextField tf) { + this.txtUtilizador = tf; + } + + private StaticText staticText2 = new StaticText(); + + public StaticText getStaticText2() { + return staticText2; + } + + public void setStaticText2(StaticText st) { + this.staticText2 = st; + } + + private TextField txtEmail = new TextField(); + + public TextField getTxtEmail() { + return txtEmail; + } + + public void setTxtEmail(TextField tf) { + this.txtEmail = tf; + } + + private HtmlPanelGrid gridPanel5 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel5() { + return gridPanel5; + } + + public void setGridPanel5(HtmlPanelGrid hpg) { + this.gridPanel5 = hpg; + } + + private PanelGroup groupPanel1 = new PanelGroup(); + + public PanelGroup getGroupPanel1() { + return groupPanel1; + } + + public void setGroupPanel1(PanelGroup pg) { + this.groupPanel1 = pg; + } + + private Button butCancelar = new Button(); + + public Button getButCancelar() { + return butCancelar; + } + + public void setButCancelar(Button b) { + this.butCancelar = b; + } + + private Button butOk = new Button(); + + public Button getButOk() { + return butOk; + } + + public void setButOk(Button b) { + this.butOk = b; + } + + //
+ + /** + *

Construct a new Page bean instance.

+ */ + public RecuperarPassword() { + } + + /** + *

Callback method that is called whenever a page is navigated to, + * either directly via a URL, or indirectly via page navigation. + * Customize this method to acquire resources that will be needed + * for event handlers and lifecycle methods, whether or not this + * page is performing post back processing.

+ * + *

Note that, if the current request is a postback, the property + * values of the components do not represent any + * values submitted with this request. Instead, they represent the + * property values that were saved for this view when it was rendered.

+ */ + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + // + // Initialize automatically managed components + // *Note* - this logic should NOT be modified + try { + _init(); + } catch (Exception e) { + log("RecuperarPassword Initialization Failure", e); + throw e instanceof FacesException ? (FacesException) e: new FacesException(e); + } + + // + // Perform application initialization that must complete + // *after* managed components are initialized + // TODO - add your own initialization code here + if (!getSessionBean1().isLoggedIn()) { + try { + getExternalContext().redirect("Login.jsp"); + } catch(Exception e) { + // . . . handle exception . . . + } + } + } + + /** + *

Callback method that is called after the component tree has been + * restored, but before any event processing takes place. This method + * will only be called on a postback request that + * is processing a form submit. Customize this method to allocate + * resources that will be required in your event handlers.

+ */ + public void preprocess() { + } + + /** + *

Callback method that is called just before rendering takes place. + * This method will only be called for the page that + * will actually be rendered (and not, for example, on a page that + * handled a postback and then navigated to a different page). Customize + * this method to allocate resources that will be required for rendering + * this page.

+ */ + public void prerender() { + txtMsg.setText(getSessionBean1().getMsg()); + getSessionBean1().setMsg(""); + } + + /** + *

Callback method that is called after rendering is completed for + * this request, if init() was called (regardless of whether + * or not this was the page that was actually rendered). Customize this + * method to release resources acquired in the init(), + * preprocess(), or prerender() methods (or + * acquired during execution of an event handler).

+ */ + public void destroy() { + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1)getBean("RequestBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1)getBean("SessionBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1)getBean("ApplicationBean1"); + } + + public String butLogin_action() { + // TODO: Process the button click action. Return value is a navigation + // case name where null will return to the same page. + + return null; + } + + public String butCancelar_action() { + // TODO: Process the button click action. Return value is a navigation + // case name where null will return to the same page. + + return "login"; + } + + public String butOk_action() { + // TODO: Process the button click action. Return value is a navigation + // case name where null will return to the same page. + + + if(fieldsValidationOk()) + { + UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); + try + { + String utilizador = (String) txtUtilizador.getText(); + Utilizador u = udp.getUtilizador(utilizador); + String email = (String) txtEmail.getText(); + if(u.getEmail().equals(email)) + { + //send mail : + try + { + sendEmail(u.getEmail(), u.getLogin(), u.getPassword(), "linojose@mail.com"); + getSessionBean1().setMsg("A sua password foi enviada para o seu email"); + return "login"; + } + catch(Exception ex) + { + getSessionBean1().setMsg("Erro no envio da password !"); + } + + } + else + { + getSessionBean1().setMsg("Os dados não coincidem com os registos !"); + } + } + catch(Exception ex) + { + getSessionBean1().setMsg("Utilizador inválido !"); + } + } + + + return null; + } + + private void sendEmail(String emailTo, String login, String password, String admin_email) throws Exception + { + Properties props = new Properties(); + //props.put("mail.transport.protocol", "smtp"); + props.put("mail.smtp.host", "smtp.netcabo.pt"); + props.put("mail.from", admin_email); + Session session1 = Session.getInstance(props); + Message msg = new MimeMessage(session1); + +// try +// { + //Address Email_TO = new InternetAddress("myemail@bol.com.br"); + msg.setFrom(new InternetAddress(admin_email)); + InternetAddress[] address = {new InternetAddress(emailTo)}; + msg.setRecipients(Message.RecipientType.TO, address); + msg.setSubject("Envio da password"); + msg.setSentDate(new Date()); + Multipart multipart = new MimeMultipart(); + BodyPart msgBodyPart = new MimeBodyPart(); + String html; + html=" "; + html+=""; + html+="

Envio da password de " + login + " :

"; + html+="

Password: " + password + "

"; + html+=""; + msgBodyPart.setContent(html, "text/html"); + multipart.addBodyPart(msgBodyPart); + msg.setContent(multipart); + Transport.send(msg); + System.out.println("Email Enviado !!!! " + emailTo + ", " + login); +// } +// catch (Exception ex) +// { +// System.out.println("MAIL ERROR : " + ex.getMessage()); +// ex.printStackTrace(); +// } + + } + + private boolean fieldsValidationOk() + { + + if(txtUtilizador.getText() != null) + { + String utilizador = (String) txtUtilizador.getText(); + if(utilizador.trim().length() == 0) + { + getSessionBean1().setMsg("Falta utilizador !"); + return false; + } + } + else + { + getSessionBean1().setMsg("Falta utilizador !"); + return false; + } + + if(txtEmail.getText() != null) + { + String email = (String) txtEmail.getText(); + if(email.trim().length() == 0) + { + getSessionBean1().setMsg("Falta email !"); + return false; + } + else + { + if(! isValidEmail(email)) + { + getSessionBean1().setMsg("Email inválido !"); + return false; + } + } + } + else + { + getSessionBean1().setMsg("Falta email !"); + return false; + } + + return true; + } + + private boolean isValidEmail(String email){ + boolean res = true; + + int indexOfAtChar=email.indexOf("@"); + + if(indexOfAtChar > 0) + { + int indexOfDotChar = + email.indexOf(".",indexOfAtChar); + if(indexOfDotChar > 0) + { + res = true; + } + else + { + res = false; + } + } + else{ + res = false; + } + return res; + } + + +} + diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/RequestBean1.java b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/RequestBean1.java new file mode 100644 index 00000000..66ece1e4 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/RequestBean1.java @@ -0,0 +1,100 @@ +/* + * RequestBean1.java + * + * Created on September 18, 2007, 3:14 PM + * Copyright lluis + */ +package analiseacidentestrabalho; + +import com.sun.rave.web.ui.appbase.AbstractRequestBean; +import javax.faces.FacesException; + +/** + *

Request scope data bean for your application. Create properties + * here to represent data that should be made available across different + * pages in the same HTTP request, so that the page bean classes do not + * have to be directly linked to each other.

+ * + *

An instance of this class will be created for you automatically, + * the first time your application evaluates a value binding expression + * or method binding expression that references a managed bean using + * this class.

+ */ +public class RequestBean1 extends AbstractRequestBean { + // + private int __placeholder; + + /** + *

Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.

+ */ + private void _init() throws Exception { + } + //
+ + /** + *

Construct a new request data bean instance.

+ */ + public RequestBean1() { + } + + /** + *

This method is called when this bean is initially added to + * request scope. Typically, this occurs as a result of evaluating + * a value binding or method binding expression, which utilizes the + * managed bean facility to instantiate this bean and store it into + * request scope.

+ * + *

You may customize this method to allocate resources that are required + * for the lifetime of the current request.

+ */ + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + // + // Initialize automatically managed components + // *Note* - this logic should NOT be modified + try { + _init(); + } catch (Exception e) { + log("RequestBean1 Initialization Failure", e); + throw e instanceof FacesException ? (FacesException) e: new FacesException(e); + } + + // + // Perform application initialization that must complete + // *after* managed components are initialized + // TODO - add your own initialization code here + } + + /** + *

This method is called when this bean is removed from + * request scope. This occurs automatically when the corresponding + * HTTP response has been completed and sent to the client.

+ * + *

You may customize this method to clean up resources allocated + * during the execution of the init() method, or + * at any later time during the lifetime of the request.

+ */ + public void destroy() { + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1)getBean("SessionBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1)getBean("ApplicationBean1"); + } +} diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/SessionBean1.java b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/SessionBean1.java new file mode 100644 index 00000000..f32cdeb1 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/SessionBean1.java @@ -0,0 +1,309 @@ +/* + * SessionBean1.java + * + * Created on September 18, 2007, 3:14 PM + * Copyright lluis + */ +package analiseacidentestrabalho; + +import com.sun.rave.web.ui.appbase.AbstractSessionBean; +import javax.faces.FacesException; +import pagestate.AnaliseAcidenteTrabalhoState; + +/** + *

Session scope data bean for your application. Create properties + * here to represent cached data that should be made available across + * multiple HTTP requests for an individual user.

+ * + *

An instance of this class will be created for you automatically, + * the first time your application evaluates a value binding expression + * or method binding expression that references a managed bean using + * this class.

+ */ +public class SessionBean1 extends AbstractSessionBean { + // + private int __placeholder; + + /** + *

Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.

+ */ + private void _init() throws Exception { + } + //
+ + /** + *

Construct a new session data bean instance.

+ */ + public SessionBean1() { + msg = new String(""); + currentUser = new Utilizador(); + analisesActualDataProvider = new db.AnalisesActualDataProvider(); + analisesSeguimentoDataProvider = new db.AnalisesSeguimentoDataProvider(); + analisesConcluidasDataProvider = new db.AnalisesConcluidasDataProvider(); + trabalhadoresListDataProvider = new db.TrabalhadoresListDataProvider(); + + setNavFrom(""); + setAcidentado(null); + setCurrentAnalise(null); + setLoggedIn(false); + } + + /** + *

This method is called when this bean is initially added to + * session scope. Typically, this occurs as a result of evaluating + * a value binding or method binding expression, which utilizes the + * managed bean facility to instantiate this bean and store it into + * session scope.

+ * + *

You may customize this method to initialize and cache data values + * or resources that are required for the lifetime of a particular + * user session.

+ */ + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + // + // Initialize automatically managed components + // *Note* - this logic should NOT be modified + try { + _init(); + } catch (Exception e) { + log("SessionBean1 Initialization Failure", e); + throw e instanceof FacesException ? (FacesException) e: new FacesException(e); + } + + // + // Perform application initialization that must complete + // *after* managed components are initialized + // TODO - add your own initialization code here + } + + /** + *

This method is called when the session containing it is about to be + * passivated. Typically, this occurs in a distributed servlet container + * when the session is about to be transferred to a different + * container instance, after which the activate() method + * will be called to indicate that the transfer is complete.

+ * + *

You may customize this method to release references to session data + * or resources that can not be serialized with the session itself.

+ */ + public void passivate() { + } + + /** + *

This method is called when the session containing it was + * reactivated.

+ * + *

You may customize this method to reacquire references to session + * data or resources that could not be serialized with the + * session itself.

+ */ + public void activate() { + } + + /** + *

This method is called when this bean is removed from + * session scope. Typically, this occurs as a result of + * the session timing out or being terminated by the application.

+ * + *

You may customize this method to clean up resources allocated + * during the execution of the init() method, or + * at any later time during the lifetime of the application.

+ */ + public void destroy() { + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1)getBean("ApplicationBean1"); + } + + private String msg; + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + private Utilizador currentUser; + + public Utilizador getCurrentUser() { + return currentUser; + } + + public void setCurrentUser(Utilizador currentUser) { + this.currentUser = currentUser; + } + + private db.AnalisesActualDataProvider analisesActualDataProvider; + private db.AnalisesSeguimentoDataProvider analisesSeguimentoDataProvider; + private db.AnalisesConcluidasDataProvider analisesConcluidasDataProvider; + private db.TrabalhadoresListDataProvider trabalhadoresListDataProvider; + + public db.AnalisesActualDataProvider getAnalisesActualDataProvider() { + return analisesActualDataProvider; + } + + public void setAnalisesActualDataProvider(db.AnalisesActualDataProvider analisesActualDataProvider) { + this.analisesActualDataProvider = analisesActualDataProvider; + } + + public db.AnalisesSeguimentoDataProvider getAnalisesSeguimentoDataProvider() { + return analisesSeguimentoDataProvider; + } + + public void setAnalisesSeguimentoDataProvider(db.AnalisesSeguimentoDataProvider analisesSeguimentoDataProvider) { + this.analisesSeguimentoDataProvider = analisesSeguimentoDataProvider; + } + + public db.AnalisesConcluidasDataProvider getAnalisesConcluidasDataProvider() { + return analisesConcluidasDataProvider; + } + + public void setAnalisesConcluidasDataProvider(db.AnalisesConcluidasDataProvider analisesConcluidasDataProvider) { + this.analisesConcluidasDataProvider = analisesConcluidasDataProvider; + } + + public db.TrabalhadoresListDataProvider getTrabalhadoresListDataProvider() { + return trabalhadoresListDataProvider; + } + + public void setTrabalhadoresListDataProvider(db.TrabalhadoresListDataProvider trabalhadoresListDataProvider) { + this.trabalhadoresListDataProvider = trabalhadoresListDataProvider; + } + + private com.sun.rave.web.ui.model.Option[] anoOptions; + + private Integer anoChoice; + + public Integer getAnoChoice() { + return anoChoice; + } + + public void setAnoChoice(Integer anoChoice) { + this.anoChoice = anoChoice; + } + + public com.sun.rave.web.ui.model.Option[] getAnoOptions() { + return anoOptions; + } + + public void setAnoOptions(com.sun.rave.web.ui.model.Option[] anoOptions) { + this.anoOptions = anoOptions; + } + + private com.sun.rave.web.ui.model.Option[] mesOptions; + + private Integer mesChoice; + + public Integer getMesChoice() { + return mesChoice; + } + + public void setMesChoice(Integer mesChoice) { + this.mesChoice = mesChoice; + } + + public com.sun.rave.web.ui.model.Option[] getMesOptions() { + return mesOptions; + } + + public void setMesOptions(com.sun.rave.web.ui.model.Option[] mesOptions) { + this.mesOptions = mesOptions; + } + + private com.sun.rave.web.ui.model.Option[] diaOptions; + + private Integer diaChoice; + + public Integer getDiaChoice() { + return diaChoice; + } + + public void setDiaChoice(Integer diaChoice) { + this.diaChoice = diaChoice; + } + + public com.sun.rave.web.ui.model.Option[] getDiaOptions() { + return diaOptions; + } + + public void setDiaOptions(com.sun.rave.web.ui.model.Option[] diaOptions) { + this.diaOptions = diaOptions; + } + + private String imageName; + + public String getImageName() { + return imageName; + } + + public void setImageName(String imageName) { + this.imageName = imageName; + } + + private String navFrom; + + public String getNavFrom() { + return navFrom; + } + + public void setNavFrom(String navFrom) { + this.navFrom = navFrom; + } + + private Trabalhador acidentado; + + public Trabalhador getAcidentado() { + return acidentado; + } + + public void setAcidentado(Trabalhador acidentado) { + this.acidentado = acidentado; + } + + private AnaliseAcidenteTrabalhoState analise_acidente_trabalho_state; + + public AnaliseAcidenteTrabalhoState getAnalise_acidente_trabalho_state() { + return analise_acidente_trabalho_state; + } + + public void setAnalise_acidente_trabalho_state(AnaliseAcidenteTrabalhoState analise_acidente_trabalho_state) { + this.analise_acidente_trabalho_state = analise_acidente_trabalho_state; + } + + private AnaliseAcidente currentAnalise; + + public AnaliseAcidente getCurrentAnalise() { + return currentAnalise; + } + + public void setCurrentAnalise(AnaliseAcidente currentAnalise) { + this.currentAnalise = currentAnalise; + } + + private boolean loggedIn; + + public boolean isLoggedIn() + { + return loggedIn; + } + + public void setLoggedIn(boolean loggedIn) + { + this.loggedIn = loggedIn; + } + +} diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Top.java b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Top.java new file mode 100644 index 00000000..d183ddf6 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Top.java @@ -0,0 +1,203 @@ +/* + * Top.java + * + * Created on September 20, 2007, 11:04 AM + * Copyright lluis + */ +package analiseacidentestrabalho; + +import com.sun.rave.web.ui.appbase.AbstractFragmentBean; +import com.sun.rave.web.ui.component.Hyperlink; +import com.sun.rave.web.ui.component.ImageComponent; +import com.sun.rave.web.ui.component.PanelGroup; +import com.sun.rave.web.ui.component.StaticText; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; + +/** + *

Fragment bean that corresponds to a similarly named JSP page + * fragment. This class contains component definitions (and initialization + * code) for all components that you have defined on this fragment, as well as + * lifecycle methods and event handlers where you may add behavior + * to respond to incoming events.

+ */ +public class Top extends AbstractFragmentBean { + // + private int __placeholder; + + /** + *

Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.

+ */ + private void _init() throws Exception { + } + + private HtmlPanelGrid gridPanel1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel1() { + return gridPanel1; + } + + public void setGridPanel1(HtmlPanelGrid hpg) { + this.gridPanel1 = hpg; + } + + private PanelGroup groupPanel1 = new PanelGroup(); + + public PanelGroup getGroupPanel1() { + return groupPanel1; + } + + public void setGroupPanel1(PanelGroup pg) { + this.groupPanel1 = pg; + } + + private ImageComponent image1 = new ImageComponent(); + + public ImageComponent getImage1() { + return image1; + } + + public void setImage1(ImageComponent ic) { + this.image1 = ic; + } + + private ImageComponent image2 = new ImageComponent(); + + public ImageComponent getImage2() { + return image2; + } + + public void setImage2(ImageComponent ic) { + this.image2 = ic; + } + + private PanelGroup groupPanel2 = new PanelGroup(); + + public PanelGroup getGroupPanel2() { + return groupPanel2; + } + + public void setGroupPanel2(PanelGroup pg) { + this.groupPanel2 = pg; + } + + private StaticText lblUser = new StaticText(); + + public StaticText getLblUser() { + return lblUser; + } + + public void setLblUser(StaticText st) { + this.lblUser = st; + } + + private StaticText staticText2 = new StaticText(); + + public StaticText getStaticText2() { + return staticText2; + } + + public void setStaticText2(StaticText st) { + this.staticText2 = st; + } + + private Hyperlink lnkChangePassword = new Hyperlink(); + + public Hyperlink getLnkChangePassword() { + return lnkChangePassword; + } + + public void setLnkChangePassword(Hyperlink h) { + this.lnkChangePassword = h; + } + + private StaticText staticText3 = new StaticText(); + + public StaticText getStaticText3() { + return staticText3; + } + + public void setStaticText3(StaticText st) { + this.staticText3 = st; + } + + private Hyperlink lnkLogout = new Hyperlink(); + + public Hyperlink getLnkLogout() { + return lnkLogout; + } + + public void setLnkLogout(Hyperlink h) { + this.lnkLogout = h; + } + //
+ + public Top() { + } + + /** + *

Callback method that is called whenever a page containing + * this page fragment is navigated to, either directly via a URL, + * or indirectly via page navigation. Override this method to acquire + * resources that will be needed for event handlers and lifecycle methods.

+ * + *

The default implementation does nothing.

+ */ + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + + // + // Initialize automatically managed components + // *Note* - this logic should NOT be modified + try { + _init(); + } catch (Exception e) { + log("Page1 Initialization Failure", e); + throw e instanceof FacesException ? (FacesException) e: new FacesException(e); + } + + // + // Perform application initialization that must complete + // *after* managed components are initialized + // TODO - add your own initialization code here + } + + /** + *

Callback method that is called after rendering is completed for + * this request, if init() was called. Override this + * method to release resources acquired in the init() + * resources that will be needed for event handlers and lifecycle methods.

+ * + *

The default implementation does nothing.

+ */ + public void destroy() { + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1)getBean("ApplicationBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1)getBean("RequestBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1)getBean("SessionBean1"); + } +} diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Trabalhador.java b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Trabalhador.java new file mode 100644 index 00000000..29192394 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Trabalhador.java @@ -0,0 +1,49 @@ +/* + * Trabalhador.java + * + * Created on September 26, 2007, 4:23 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package analiseacidentestrabalho; + +/** + * + * @author lluis + */ +public class Trabalhador { + private Integer id; + private String nome; + private java.sql.Date data_nascimento; + + /** Creates a new instance of Trabalhador */ + public Trabalhador() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getNome() { + return nome; + } + + public void setNome(String nome) { + this.nome = nome; + } + + public java.sql.Date getData_nascimento() { + return data_nascimento; + } + + public void setData_nascimento(java.sql.Date data_nascimento) { + this.data_nascimento = data_nascimento; + } + +} diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Utilizador.java b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Utilizador.java new file mode 100644 index 00000000..c364c689 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/Utilizador.java @@ -0,0 +1,95 @@ +/* + * Utilizador.java + * + * Created on September 20, 2007, 9:58 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package analiseacidentestrabalho; + +/** + * + * @author lluis + */ +public class Utilizador { + private Integer id; + private String login; + private String password; + private String email; + private Integer empresa_id; + private Integer estabelecimento_id; + private String administrador; + + private Integer codigo_permissao; + + /** Creates a new instance of Utilizador */ + public Utilizador() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getLogin() { + return login; + } + + public void setLogin(String login) { + this.login = login; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Integer getEmpresa_id() { + return empresa_id; + } + + public void setEmpresa_id(Integer empresa_id) { + this.empresa_id = empresa_id; + } + + public Integer getEstabelecimento_id() { + return estabelecimento_id; + } + + public void setEstabelecimento_id(Integer estabelecimento_id) { + this.estabelecimento_id = estabelecimento_id; + } + + public String getAdministrador() { + return administrador; + } + + public void setAdministrador(String administrador) { + this.administrador = administrador; + } + + public Integer getCodigo_permissao() { + return codigo_permissao; + } + + public void setCodigo_permissao(Integer codigo_permissao) { + this.codigo_permissao = codigo_permissao; + } + +} diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/ViewAnaliseAcidenteTrabalho.java b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/ViewAnaliseAcidenteTrabalho.java new file mode 100644 index 00000000..973f072e --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/ViewAnaliseAcidenteTrabalho.java @@ -0,0 +1,1203 @@ +/* + * ViewAnaliseAcidenteTrabalho.java + * + * Created on October 1, 2007, 10:48 AM + * Copyright lluis + */ +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.DropDown; +import com.sun.rave.web.ui.component.Form; +import com.sun.rave.web.ui.component.Head; +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 db.AnalisesDataProvider; +import java.io.File; +import javax.faces.FacesException; +import javax.faces.component.html.HtmlPanelGrid; +import javax.servlet.ServletContext; + +/** + *

Page bean that corresponds to a similarly named JSP page. This + * class contains component definitions (and initialization code) for + * all components that you have defined on this page, as well as + * lifecycle methods and event handlers where you may add behavior + * to respond to incoming events.

+ */ +public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { + // + private int __placeholder; + + /** + *

Automatically managed component initialization. WARNING: + * This method is automatically generated, so any user-specified code inserted + * here is subject to being replaced.

+ */ + private void _init() throws Exception { + } + + private Page page1 = new Page(); + + public Page getPage1() { + return page1; + } + + public void setPage1(Page p) { + this.page1 = p; + } + + private Html html1 = new Html(); + + public Html getHtml1() { + return html1; + } + + public void setHtml1(Html h) { + this.html1 = h; + } + + private Head head1 = new Head(); + + public Head getHead1() { + return head1; + } + + public void setHead1(Head h) { + this.head1 = h; + } + + private Link link1 = new Link(); + + public Link getLink1() { + return link1; + } + + public void setLink1(Link l) { + this.link1 = l; + } + + private Body body1 = new Body(); + + public Body getBody1() { + return body1; + } + + public void setBody1(Body b) { + this.body1 = b; + } + + private Form form1 = new Form(); + + public Form getForm1() { + return form1; + } + + public void setForm1(Form f) { + this.form1 = f; + } + + private HtmlPanelGrid gridBase1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridBase1() { + return gridBase1; + } + + public void setGridBase1(HtmlPanelGrid hpg) { + this.gridBase1 = hpg; + } + + private HtmlPanelGrid gridLayout1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridLayout1() { + return gridLayout1; + } + + public void setGridLayout1(HtmlPanelGrid hpg) { + this.gridLayout1 = hpg; + } + + private HtmlPanelGrid gridPanel1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel1() { + return gridPanel1; + } + + public void setGridPanel1(HtmlPanelGrid hpg) { + this.gridPanel1 = hpg; + } + + private PanelGroup groupPanel1 = new PanelGroup(); + + public PanelGroup getGroupPanel1() { + return groupPanel1; + } + + public void setGroupPanel1(PanelGroup pg) { + this.groupPanel1 = pg; + } + + private ImageComponent image1 = new ImageComponent(); + + public ImageComponent getImage1() { + return image1; + } + + public void setImage1(ImageComponent ic) { + this.image1 = ic; + } + + private ImageComponent image2 = new ImageComponent(); + + public ImageComponent getImage2() { + return image2; + } + + public void setImage2(ImageComponent ic) { + this.image2 = ic; + } + + private PanelGroup groupPanel2 = new PanelGroup(); + + public PanelGroup getGroupPanel2() { + return groupPanel2; + } + + public void setGroupPanel2(PanelGroup pg) { + this.groupPanel2 = pg; + } + + private StaticText lblUser1 = new StaticText(); + + public StaticText getLblUser1() { + return lblUser1; + } + + public void setLblUser1(StaticText st) { + this.lblUser1 = st; + } + + private StaticText staticText1 = new StaticText(); + + public StaticText getStaticText1() { + return staticText1; + } + + public void setStaticText1(StaticText st) { + this.staticText1 = st; + } + + private Hyperlink lnkChangePassword1 = new Hyperlink(); + + public Hyperlink getLnkChangePassword1() { + return lnkChangePassword1; + } + + public void setLnkChangePassword1(Hyperlink h) { + this.lnkChangePassword1 = h; + } + + private StaticText staticText2 = new StaticText(); + + public StaticText getStaticText2() { + return staticText2; + } + + public void setStaticText2(StaticText st) { + this.staticText2 = st; + } + + private Hyperlink lnkLogout1 = new Hyperlink(); + + public Hyperlink getLnkLogout1() { + return lnkLogout1; + } + + public void setLnkLogout1(Hyperlink h) { + this.lnkLogout1 = h; + } + + private StaticText staticText3 = new StaticText(); + + public StaticText getStaticText3() { + return staticText3; + } + + public void setStaticText3(StaticText st) { + this.staticText3 = st; + } + + private HtmlPanelGrid gridMsg1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridMsg1() { + return gridMsg1; + } + + public void setGridMsg1(HtmlPanelGrid hpg) { + this.gridMsg1 = hpg; + } + + private StaticText txtMsg1 = new StaticText(); + + public StaticText getTxtMsg1() { + return txtMsg1; + } + + public void setTxtMsg1(StaticText st) { + this.txtMsg1 = st; + } + + private HtmlPanelGrid gridCabecalho1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridCabecalho1() { + return gridCabecalho1; + } + + public void setGridCabecalho1(HtmlPanelGrid hpg) { + this.gridCabecalho1 = hpg; + } + + private HtmlPanelGrid gridPanel2 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel2() { + return gridPanel2; + } + + public void setGridPanel2(HtmlPanelGrid hpg) { + this.gridPanel2 = hpg; + } + + private StaticText lblEmpresa1 = new StaticText(); + + public StaticText getLblEmpresa1() { + return lblEmpresa1; + } + + public void setLblEmpresa1(StaticText st) { + this.lblEmpresa1 = st; + } + + private StaticText txtEmpresa = new StaticText(); + + public StaticText getTxtEmpresa() { + return txtEmpresa; + } + + public void setTxtEmpresa(StaticText st) { + this.txtEmpresa = st; + } + + private StaticText staticText4 = new StaticText(); + + public StaticText getStaticText4() { + return staticText4; + } + + public void setStaticText4(StaticText st) { + this.staticText4 = st; + } + + private StaticText txtEstabelecimento = new StaticText(); + + public StaticText getTxtEstabelecimento() { + return txtEstabelecimento; + } + + public void setTxtEstabelecimento(StaticText st) { + this.txtEstabelecimento = st; + } + + private StaticText lblTrabalhador1 = new StaticText(); + + public StaticText getLblTrabalhador1() { + return lblTrabalhador1; + } + + public void setLblTrabalhador1(StaticText st) { + this.lblTrabalhador1 = st; + } + + private StaticText txtTrabalhador = new StaticText(); + + public StaticText getTxtTrabalhador() { + return txtTrabalhador; + } + + public void setTxtTrabalhador(StaticText st) { + this.txtTrabalhador = st; + } + + private HtmlPanelGrid gridSiprp1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridSiprp1() { + return gridSiprp1; + } + + public void setGridSiprp1(HtmlPanelGrid hpg) { + this.gridSiprp1 = hpg; + } + + private HtmlPanelGrid gridPanel5 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel5() { + return gridPanel5; + } + + public void setGridPanel5(HtmlPanelGrid hpg) { + this.gridPanel5 = hpg; + } + + private StaticText staticText6 = new StaticText(); + + public StaticText getStaticText6() { + return staticText6; + } + + public void setStaticText6(StaticText st) { + this.staticText6 = st; + } + + private HtmlPanelGrid gridPanel6 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel6() { + return gridPanel6; + } + + public void setGridPanel6(HtmlPanelGrid hpg) { + this.gridPanel6 = hpg; + } + + private HtmlPanelGrid gridPanel7 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel7() { + return gridPanel7; + } + + public void setGridPanel7(HtmlPanelGrid hpg) { + this.gridPanel7 = hpg; + } + + private StaticText staticText7 = new StaticText(); + + public StaticText getStaticText7() { + return staticText7; + } + + public void setStaticText7(StaticText st) { + this.staticText7 = st; + } + + private StaticText staticText8 = new StaticText(); + + public StaticText getStaticText8() { + return staticText8; + } + + public void setStaticText8(StaticText st) { + this.staticText8 = st; + } + + private StaticText staticText9 = new StaticText(); + + public StaticText getStaticText9() { + return staticText9; + } + + public void setStaticText9(StaticText st) { + this.staticText9 = st; + } + + private PanelGroup groupPanel3 = new PanelGroup(); + + public PanelGroup getGroupPanel3() { + return groupPanel3; + } + + public void setGroupPanel3(PanelGroup pg) { + this.groupPanel3 = pg; + } + + private StaticText staticText10 = new StaticText(); + + public StaticText getStaticText10() { + return staticText10; + } + + public void setStaticText10(StaticText st) { + this.staticText10 = st; + } + + private StaticText txtCap1 = new StaticText(); + + public StaticText getTxtCap1() { + return txtCap1; + } + + public void setTxtCap1(StaticText st) { + this.txtCap1 = st; + } + + private StaticText staticText11 = new StaticText(); + + public StaticText getStaticText11() { + return staticText11; + } + + public void setStaticText11(StaticText st) { + this.staticText11 = st; + } + + private PanelGroup groupPanel4 = new PanelGroup(); + + public PanelGroup getGroupPanel4() { + return groupPanel4; + } + + public void setGroupPanel4(PanelGroup pg) { + this.groupPanel4 = pg; + } + + private StaticText staticText12 = new StaticText(); + + public StaticText getStaticText12() { + return staticText12; + } + + public void setStaticText12(StaticText st) { + this.staticText12 = st; + } + + private StaticText txtCedula1 = new StaticText(); + + public StaticText getTxtCedula1() { + return txtCedula1; + } + + public void setTxtCedula1(StaticText st) { + this.txtCedula1 = st; + } + + private HtmlPanelGrid gridAcidentado1 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridAcidentado1() { + return gridAcidentado1; + } + + public void setGridAcidentado1(HtmlPanelGrid hpg) { + this.gridAcidentado1 = hpg; + } + + private HtmlPanelGrid gridPanel8 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel8() { + return gridPanel8; + } + + public void setGridPanel8(HtmlPanelGrid hpg) { + this.gridPanel8 = hpg; + } + + private StaticText staticText13 = new StaticText(); + + public StaticText getStaticText13() { + return staticText13; + } + + public void setStaticText13(StaticText st) { + this.staticText13 = st; + } + + private HtmlPanelGrid gridPanel9 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel9() { + return gridPanel9; + } + + public void setGridPanel9(HtmlPanelGrid hpg) { + this.gridPanel9 = hpg; + } + + private HtmlPanelGrid gridPanel10 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel10() { + return gridPanel10; + } + + public void setGridPanel10(HtmlPanelGrid hpg) { + this.gridPanel10 = hpg; + } + + private StaticText staticText14 = new StaticText(); + + public StaticText getStaticText14() { + return staticText14; + } + + public void setStaticText14(StaticText st) { + this.staticText14 = st; + } + + private StaticText txtNomeAcidentado = new StaticText(); + + public StaticText getTxtNomeAcidentado() { + return txtNomeAcidentado; + } + + public void setTxtNomeAcidentado(StaticText st) { + this.txtNomeAcidentado = st; + } + + private StaticText staticText15 = new StaticText(); + + public StaticText getStaticText15() { + return staticText15; + } + + public void setStaticText15(StaticText st) { + this.staticText15 = st; + } + + private StaticText txtDataNascimento = new StaticText(); + + public StaticText getTxtDataNascimento() { + return txtDataNascimento; + } + + public void setTxtDataNascimento(StaticText st) { + this.txtDataNascimento = st; + } + + private StaticText staticText16 = new StaticText(); + + public StaticText getStaticText16() { + return staticText16; + } + + public void setStaticText16(StaticText st) { + this.staticText16 = st; + } + + private StaticText staticText17 = new StaticText(); + + public StaticText getStaticText17() { + return staticText17; + } + + public void setStaticText17(StaticText st) { + this.staticText17 = st; + } + + private StaticText staticText18 = new StaticText(); + + public StaticText getStaticText18() { + return staticText18; + } + + public void setStaticText18(StaticText st) { + this.staticText18 = st; + } + + private HtmlPanelGrid gridPanel11 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel11() { + return gridPanel11; + } + + public void setGridPanel11(HtmlPanelGrid hpg) { + this.gridPanel11 = hpg; + } + + private StaticText staticText19 = new StaticText(); + + public StaticText getStaticText19() { + return staticText19; + } + + public void setStaticText19(StaticText st) { + this.staticText19 = st; + } + + private HtmlPanelGrid gridPanel12 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel12() { + return gridPanel12; + } + + public void setGridPanel12(HtmlPanelGrid hpg) { + this.gridPanel12 = hpg; + } + + private StaticText staticText20 = new StaticText(); + + public StaticText getStaticText20() { + return staticText20; + } + + public void setStaticText20(StaticText st) { + this.staticText20 = st; + } + + private HtmlPanelGrid gridPanel13 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel13() { + return gridPanel13; + } + + public void setGridPanel13(HtmlPanelGrid hpg) { + this.gridPanel13 = hpg; + } + + private StaticText staticText21 = new StaticText(); + + public StaticText getStaticText21() { + return staticText21; + } + + public void setStaticText21(StaticText st) { + this.staticText21 = st; + } + + private HtmlPanelGrid gridPanel14 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel14() { + return gridPanel14; + } + + public void setGridPanel14(HtmlPanelGrid hpg) { + this.gridPanel14 = hpg; + } + + private StaticText staticText22 = new StaticText(); + + public StaticText getStaticText22() { + return staticText22; + } + + public void setStaticText22(StaticText st) { + this.staticText22 = st; + } + + private HtmlPanelGrid gridPanel15 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel15() { + return gridPanel15; + } + + public void setGridPanel15(HtmlPanelGrid hpg) { + this.gridPanel15 = hpg; + } + + private StaticText staticText23 = new StaticText(); + + public StaticText getStaticText23() { + return staticText23; + } + + public void setStaticText23(StaticText st) { + this.staticText23 = st; + } + + private HtmlPanelGrid gridPanel16 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel16() { + return gridPanel16; + } + + public void setGridPanel16(HtmlPanelGrid hpg) { + this.gridPanel16 = hpg; + } + + private StaticText staticText24 = new StaticText(); + + public StaticText getStaticText24() { + return staticText24; + } + + public void setStaticText24(StaticText st) { + this.staticText24 = st; + } + + private HtmlPanelGrid gridPanel17 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel17() { + return gridPanel17; + } + + public void setGridPanel17(HtmlPanelGrid hpg) { + this.gridPanel17 = hpg; + } + + private StaticText staticText25 = new StaticText(); + + public StaticText getStaticText25() { + return staticText25; + } + + public void setStaticText25(StaticText st) { + this.staticText25 = st; + } + + private HtmlPanelGrid gridPanel18 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel18() { + return gridPanel18; + } + + public void setGridPanel18(HtmlPanelGrid hpg) { + this.gridPanel18 = hpg; + } + + private HtmlPanelGrid gridPanel19 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel19() { + return gridPanel19; + } + + public void setGridPanel19(HtmlPanelGrid hpg) { + this.gridPanel19 = hpg; + } + + private StaticText staticText26 = new StaticText(); + + public StaticText getStaticText26() { + return staticText26; + } + + public void setStaticText26(StaticText st) { + this.staticText26 = st; + } + + private HtmlPanelGrid gridImages = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridImages() { + return gridImages; + } + + public void setGridImages(HtmlPanelGrid hpg) { + this.gridImages = hpg; + } + + private HtmlPanelGrid gridPanel20 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel20() { + return gridPanel20; + } + + public void setGridPanel20(HtmlPanelGrid hpg) { + this.gridPanel20 = hpg; + } + + private StaticText staticText27 = new StaticText(); + + public StaticText getStaticText27() { + return staticText27; + } + + public void setStaticText27(StaticText st) { + this.staticText27 = st; + } + + private HtmlPanelGrid gridPanel21 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel21() { + return gridPanel21; + } + + public void setGridPanel21(HtmlPanelGrid hpg) { + this.gridPanel21 = hpg; + } + + private StaticText staticText28 = new StaticText(); + + public StaticText getStaticText28() { + return staticText28; + } + + public void setStaticText28(StaticText st) { + this.staticText28 = st; + } + + private HtmlPanelGrid gridPanel22 = new HtmlPanelGrid(); + + public HtmlPanelGrid getGridPanel22() { + return gridPanel22; + } + + public void setGridPanel22(HtmlPanelGrid hpg) { + this.gridPanel22 = hpg; + } + + private PanelGroup groupPanel5 = new PanelGroup(); + + public PanelGroup getGroupPanel5() { + return groupPanel5; + } + + public void setGroupPanel5(PanelGroup pg) { + this.groupPanel5 = pg; + } + + private Button butVoltar = new Button(); + + public Button getButVoltar() { + return butVoltar; + } + + public void setButVoltar(Button b) { + this.butVoltar = b; + } + + private StaticText txtAccoes = new StaticText(); + + public StaticText getTxtAccoes() { + return txtAccoes; + } + + public void setTxtAccoes(StaticText st) { + this.txtAccoes = st; + } + + private StaticText txtConclusoes = new StaticText(); + + public StaticText getTxtConclusoes() { + return txtConclusoes; + } + + public void setTxtConclusoes(StaticText st) { + this.txtConclusoes = st; + } + + private StaticText txtDescricao = new StaticText(); + + public StaticText getTxtDescricao() { + return txtDescricao; + } + + public void setTxtDescricao(StaticText st) { + this.txtDescricao = st; + } + + private StaticText txtCausas = new StaticText(); + + public StaticText getTxtCausas() { + return txtCausas; + } + + public void setTxtCausas(StaticText st) { + this.txtCausas = st; + } + + private StaticText txtTestemunhas = new StaticText(); + + public StaticText getTxtTestemunhas() { + return txtTestemunhas; + } + + public void setTxtTestemunhas(StaticText st) { + this.txtTestemunhas = st; + } + + private StaticText txtCondicoes = new StaticText(); + + public StaticText getTxtCondicoes() { + return txtCondicoes; + } + + public void setTxtCondicoes(StaticText st) { + this.txtCondicoes = st; + } + + private StaticText txtSuperior = new StaticText(); + + public StaticText getTxtSuperior() { + return txtSuperior; + } + + public void setTxtSuperior(StaticText st) { + this.txtSuperior = st; + } + + private StaticText txtSubstancias = new StaticText(); + + public StaticText getTxtSubstancias() { + return txtSubstancias; + } + + public void setTxtSubstancias(StaticText st) { + this.txtSubstancias = st; + } + + private StaticText txtTarefa = new StaticText(); + + public StaticText getTxtTarefa() { + return txtTarefa; + } + + public void setTxtTarefa(StaticText st) { + this.txtTarefa = st; + } + + private StaticText txtHorasTurno = new StaticText(); + + public StaticText getTxtHorasTurno() { + return txtHorasTurno; + } + + public void setTxtHorasTurno(StaticText st) { + this.txtHorasTurno = st; + } + + private StaticText txtSeccao = new StaticText(); + + public StaticText getTxtSeccao() { + return txtSeccao; + } + + public void setTxtSeccao(StaticText st) { + this.txtSeccao = st; + } + + private StaticText txtLocal = new StaticText(); + + public StaticText getTxtLocal() { + return txtLocal; + } + + public void setTxtLocal(StaticText st) { + this.txtLocal = st; + } + + private StaticText txtTecnicoSuperior = new StaticText(); + + public StaticText getTxtTecnicoSuperior() { + return txtTecnicoSuperior; + } + + public void setTxtTecnicoSuperior(StaticText st) { + this.txtTecnicoSuperior = st; + } + + private StaticText txtMedicoTrabalho = new StaticText(); + + public StaticText getTxtMedicoTrabalho() { + return txtMedicoTrabalho; + } + + public void setTxtMedicoTrabalho(StaticText st) { + this.txtMedicoTrabalho = st; + } + + //
+ private String IMAGE_URL = "/resources/images"; + /** + *

Construct a new Page bean instance.

+ */ + public ViewAnaliseAcidenteTrabalho() { + } + + /** + *

Callback method that is called whenever a page is navigated to, + * either directly via a URL, or indirectly via page navigation. + * Customize this method to acquire resources that will be needed + * for event handlers and lifecycle methods, whether or not this + * page is performing post back processing.

+ * + *

Note that, if the current request is a postback, the property + * values of the components do not represent any + * values submitted with this request. Instead, they represent the + * property values that were saved for this view when it was rendered.

+ */ + public void init() { + // Perform initializations inherited from our superclass + super.init(); + // Perform application initialization that must complete + // *before* managed components are initialized + // TODO - add your own initialiation code here + + // + // Initialize automatically managed components + // *Note* - this logic should NOT be modified + try { + _init(); + } catch (Exception e) { + log("ViewAnaliseAcidenteTrabalho Initialization Failure", e); + throw e instanceof FacesException ? (FacesException) e: new FacesException(e); + } + + // + // Perform application initialization that must complete + // *after* managed components are initialized + // TODO - add your own initialization code here + + initializePage(); + } + + /** + *

Callback method that is called after the component tree has been + * restored, but before any event processing takes place. This method + * will only be called on a postback request that + * is processing a form submit. Customize this method to allocate + * resources that will be required in your event handlers.

+ */ + public void preprocess() { + } + + /** + *

Callback method that is called just before rendering takes place. + * This method will only be called for the page that + * will actually be rendered (and not, for example, on a page that + * handled a postback and then navigated to a different page). Customize + * this method to allocate resources that will be required for rendering + * this page.

+ */ + public void prerender() { + } + + /** + *

Callback method that is called after rendering is completed for + * this request, if init() was called (regardless of whether + * or not this was the page that was actually rendered). Customize this + * method to release resources acquired in the init(), + * preprocess(), or prerender() methods (or + * acquired during execution of an event handler).

+ */ + public void destroy() { + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected SessionBean1 getSessionBean1() { + return (SessionBean1)getBean("SessionBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected RequestBean1 getRequestBean1() { + return (RequestBean1)getBean("RequestBean1"); + } + + /** + *

Return a reference to the scoped data bean.

+ */ + protected ApplicationBean1 getApplicationBean1() { + return (ApplicationBean1)getBean("ApplicationBean1"); + } + + public String lnkLogout_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkNome_action() { + // TODO: Replace with your code + + return null; + } + + public String lnkDataNascimento_action() { + // TODO: Replace with your code + + return null; + } + + private void initializePage() + { + fillPage(); + fillImages(); + } + + private void fillPage() + { + AnaliseAcidente a = getSessionBean1().getCurrentAnalise(); + AnalisesDataProvider adp = new AnalisesDataProvider(); + try + { + txtEstabelecimento.setText(adp.getEstabelecimentoNome(a.getEstabelecimento_id())); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + try + { + Trabalhador t = adp.getTrabalhador(a.getTrabalhador_id()); + txtDataNascimento.setText(t.getData_nascimento()); + getSessionBean1().setAcidentado(t); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + txtTrabalhador.setText(a.getNome_acidentado()); + txtNomeAcidentado.setText(a.getNome_acidentado()); + txtHorasTurno.setText(a.getHoras_turno().toString()); + txtSeccao.setText(a.getSeccao()); + txtLocal.setText(a.getLocal_trabalho()); + txtTarefa.setText(a.getTarefa()); + txtSubstancias.setText(a.getSubstancias()); + txtSuperior.setText(a.getSuperior_hierarquico()); + txtCondicoes.setText(a.getCondicoes()); + txtTestemunhas.setText(a.getTestemunhas()); + txtCausas.setText(a.getCausas()); + txtDescricao.setText(a.getDescricao()); + txtConclusoes.setText(a.getConclusoes()); + txtAccoes.setText(a.getAccoes()); + } + + private void fillImages() + { + ServletContext theApplicationsServletContext = + (ServletContext) this.getExternalContext().getContext(); + try + { + String imageFileFolder = theApplicationsServletContext.getRealPath(IMAGE_URL + "/" + getSessionBean1().getCurrentAnalise().getId()); + File f = new File(imageFileFolder); + if( f.exists() ) + { + File files[] = f.listFiles(); + + for(int i=0;i 2 ) + { + sql ="SELECT * FROM analises_acidentes WHERE estado > " + estado + " AND estado < 6 AND estabelecimento_id = " + estabelecimento_id; + } + else if(estado.intValue() == 2) + { + sql ="SELECT * FROM analises_acidentes WHERE estado = 3 or estado = 5 AND estabelecimento_id = " + estabelecimento_id; + } + + ResultSet rs = st.executeQuery(sql); + rs.first(); + int nr = 0; + do + { + AnaliseAcidente a = new AnaliseAcidente(); + a.setId(new Integer(rs.getInt("id"))); + nr++; + a.setNr(new Integer(nr)); + a.setData_acidente(rs.getDate("data_acidente")); + a.setEstabelecimento_id(new Integer(rs.getInt("estabelecimento_id"))); + a.setEstado(new Integer(rs.getInt("estado"))); + a.setTrabalhador_id(new Integer( rs.getInt("trabalhador_id"))); + String sqllocal = "SELECT nome FROM trabalhadores WHERE id = " + a.getTrabalhador_id(); + ResultSet rslocal = stlocal.executeQuery(sqllocal); + rslocal.first(); + a.setNome_acidentado(rslocal.getString("nome")); + + a.setHoras_turno(new Integer(rs.getInt("horas_turno"))); + a.setSeccao(rs.getString("seccao")); + a.setLocal_trabalho(rs.getString("local_trabalho")); + a.setTarefa(rs.getString("tarefa")); + a.setSubstancias(rs.getString("substancias")); + a.setSuperior_hierarquico(rs.getString("superior_hierarquico")); + a.setCondicoes(rs.getString("condicoes")); + a.setTestemunhas(rs.getString("testemunhas")); + a.setCausas(rs.getString("causas")); + a.setDescricao(rs.getString("descricao")); + a.setConclusoes(rs.getString("conclusoes")); + a.setAccoes(rs.getString("accoes")); + list.add(a); + }while(rs.next()); + dblocal.close(); + return list; + } + + public ArrayList getAnalisesConcluidasList(Integer estabelecimento_id) throws Exception + { + Dblocal dblocal = new Dblocal(); + dblocal.connect(); + Statement stlocal = dblocal.createStatement(); + ArrayList list = new ArrayList(); + Statement st = createStatement(); + String sql ="SELECT * FROM analises_acidentes WHERE estado = 6 AND estabelecimento_id = " + estabelecimento_id; + ResultSet rs = st.executeQuery(sql); + rs.first(); + int nr = 0; + do + { + AnaliseAcidente a = new AnaliseAcidente(); + a.setId(new Integer(rs.getInt("id"))); + nr++; + a.setNr(new Integer(nr)); + a.setData_acidente(rs.getDate("data_acidente")); + a.setEstabelecimento_id(new Integer(rs.getInt("estabelecimento_id"))); + a.setEstado(new Integer(rs.getInt("estado"))); + a.setTrabalhador_id(new Integer( rs.getInt("trabalhador_id"))); + String sqllocal = "SELECT nome FROM trabalhadores WHERE id = " + a.getTrabalhador_id(); + ResultSet rslocal = stlocal.executeQuery(sqllocal); + rslocal.first(); + a.setNome_acidentado(rslocal.getString("nome")); + + a.setHoras_turno(new Integer(rs.getInt("horas_turno"))); + a.setSeccao(rs.getString("seccao")); + a.setLocal_trabalho(rs.getString("local_trabalho")); + a.setTarefa(rs.getString("tarefa")); + a.setSubstancias(rs.getString("substancias")); + a.setSuperior_hierarquico(rs.getString("superior_hierarquico")); + a.setCondicoes(rs.getString("condicoes")); + a.setTestemunhas(rs.getString("testemunhas")); + a.setCausas(rs.getString("causas")); + a.setDescricao(rs.getString("descricao")); + a.setConclusoes(rs.getString("conclusoes")); + a.setAccoes(rs.getString("accoes")); + list.add(a); + }while(rs.next()); + dblocal.close(); + return list; + } + + public ArrayList searchAanalisesConcluidasList(Integer estabelecimento_id, Integer ano, Integer mes, Integer dia, String nome) throws Exception + { + Calendar cal = Calendar.getInstance(); + ArrayList list = new ArrayList(); + Dblocal dblocal = new Dblocal(); + dblocal.connect(); + Statement stlocal = dblocal.createStatement(); + Statement st = createStatement(); + String sql = ""; + + if( ano != null) + { + if( mes != null) + { + if( dia != null) + { + cal.set( cal.YEAR, ano.intValue() ); + cal.set( cal.MONTH, mes.intValue() -1 ); + cal.set( cal.DATE, dia.intValue() ); + java.sql.Date data_acidente = new java.sql.Date( cal.getTime().getTime() ); + System.out.println("DATA_ACIDENTE : " + data_acidente); + if( nome != null) + { + sql = "SELECT * FROM analises_acidentes WHERE data_acidente = '" + data_acidente + "' AND nome LIKE '%" + nome + "%' AND estado = 6 AND estabelecimento_id = " + estabelecimento_id; + } + else + { + System.out.println("DIA != NULL ; NOME = NULL"); + sql = "SELECT * FROM analises_acidentes WHERE data_acidente = '" + data_acidente + "' AND estado = 6 AND estabelecimento_id = " + estabelecimento_id; + System.out.println ("SQL = " + sql); + } + } + else + { + cal.set( cal.YEAR, ano.intValue() ); + cal.set( cal.MONTH, mes.intValue() -1 ); + cal.set( cal.DATE, 1 ); + java.sql.Date data_acidente_from = new java.sql.Date( cal.getTime().getTime() ); + cal.set( cal.DATE, 31 ); + java.sql.Date data_acidente_to = new java.sql.Date( cal.getTime().getTime() ); + if( nome != null) + { + sql = "SELECT * FROM analises_acidentes WHERE data_acidente >= '" + data_acidente_from + "' AND data_acidente <= '" + data_acidente_to + "' AND nome LIKE '%" + nome + "%' AND estado = 6 AND estabelecimento_id = " + estabelecimento_id; + } + else + { + System.out.println("DIA = NULL ; NOME = NULL"); + sql = "SELECT * FROM analises_acidentes WHERE data_acidente >= '" + data_acidente_from + "' AND data_acidente <= '" + data_acidente_to + "' AND estado = 6 AND estabelecimento_id = " + estabelecimento_id; + } + } // dia + } // mes + else + { + cal.set( cal.YEAR, ano.intValue() ); + cal.set( cal.MONTH, 0 ); + cal.set( cal.DATE, 1 ); + java.sql.Date data_acidente_from = new java.sql.Date( cal.getTime().getTime() ); + cal.set( cal.MONTH, 11 ); + cal.set( cal.DATE, 31 ); + java.sql.Date data_acidente_to = new java.sql.Date( cal.getTime().getTime() ); + if( nome != null) + { + sql = "SELECT * FROM analises_acidentes WHERE data_acidente >= '" + data_acidente_from + "' AND data_acidente <= '" + data_acidente_to + "' AND nome LIKE '%" + nome + "%' AND estado = 6 AND estabelecimento_id = " + estabelecimento_id; + } + else + { + System.out.println("MES = NULL; DIA = NULL ; NOME = NULL"); + sql = "SELECT * FROM analises_acidentes WHERE data_acidente >= '" + data_acidente_from + "' AND data_acidente <= '" + data_acidente_to + "' AND estado = 6 AND estabelecimento_id = " + estabelecimento_id; + } + } + } // ano + else + { + if( nome != null ) + { + sql = "SELECT * FROM analises_acidentes WHERE nome LIKE '%" + nome + "%' AND estado = 6 AND estabelecimento_id = " + estabelecimento_id; + } + else + { + sql = "SELECT * FROM analises_acidentes WHERE estado = 6 AND estabelecimento_id = " + estabelecimento_id; + } + } + ResultSet rs = st.executeQuery(sql); + rs.first(); + int nr = 0; + do + { + AnaliseAcidente a = new AnaliseAcidente(); + a.setId(new Integer(rs.getInt("id"))); + nr++; + a.setNr(new Integer(nr)); + a.setData_acidente(rs.getDate("data_acidente")); + a.setEstabelecimento_id(new Integer(rs.getInt("estabelecimento_id"))); + a.setEstado(new Integer(rs.getInt("estado"))); + a.setTrabalhador_id(new Integer( rs.getInt("trabalhador_id"))); + String sqllocal = "SELECT nome FROM trabalhadores WHERE id = " + a.getTrabalhador_id(); + ResultSet rslocal = stlocal.executeQuery(sqllocal); + rslocal.first(); + a.setNome_acidentado(rslocal.getString("nome")); + list.add(a); + }while(rs.next()); + dblocal.close(); + + return list; + } + + public ArrayList getTrabalhadoresListByEstabelecimento(Integer estabelecimento_id) throws Exception + { + ArrayList list = new ArrayList(); + Dblocal dblocal = new Dblocal(); + dblocal.connect(); + Statement stlocal = dblocal.createStatement(); + String sql ="SELECT * FROM trabalhadores WHERE estabelecimento_id = " + estabelecimento_id; + ResultSet rslocal = stlocal.executeQuery(sql); + rslocal.first(); + int nr = 0; + do + { + Trabalhador t = new Trabalhador(); + t.setId(new Integer(rslocal.getInt("id"))); + t.setNome(rslocal.getString("nome")); + t.setData_nascimento(rslocal.getDate("data_nascimento")); + list.add(t); + }while(rslocal.next()); + dblocal.close(); + + return list; + } + + public Trabalhador getTrabalhador(Integer id) throws Exception + { + Dblocal dblocal = new Dblocal(); + dblocal.connect(); + Statement stlocal = dblocal.createStatement(); + String sql ="SELECT * FROM trabalhadores WHERE id = " + id; + ResultSet rslocal = stlocal.executeQuery(sql); + rslocal.first(); + Trabalhador t = new Trabalhador(); + t.setId(new Integer(rslocal.getInt("id"))); + t.setNome(rslocal.getString("nome")); + t.setData_nascimento(rslocal.getDate("data_nascimento")); + dblocal.close(); + return t; + } + + public String getEstabelecimentoNome(Integer estabelecimento_id) throws Exception + { + Dblocal dblocal = new Dblocal(); + dblocal.connect(); + Statement stlocal = dblocal.createStatement(); + String sql ="SELECT nome FROM estabelecimentos WHERE id = " + estabelecimento_id; + ResultSet rslocal = stlocal.executeQuery(sql); + rslocal.first(); + String nome = rslocal.getString("nome"); + dblocal.close(); + return nome; + } + + public Integer getMaxAnaliseId() + { + Statement st = createStatement(); + String sql = "SELECT max(analises_acidentes.id)+1 AS MAXANALISEID FROM analises_acidentes"; + try + { + ResultSet rs = st.executeQuery(sql); + rs.first(); + Integer newId = new Integer(rs.getInt("MAXANALISEID")); + return newId; + } + catch(Exception ex) + { + return new Integer(1); + } + } + + + public Integer createAnalise(AnaliseAcidente a) throws Exception + { + Statement st = createStatement(); + Integer newId = getMaxAnaliseId(); + + //java.util.Date today = new java.util.Date(); + //java.sql.Date sqlToday = new java.sql.Date(today.getTime()); + String sql = "INSERT INTO analises_acidentes (id, data_acidente, trabalhador_id, estado, estabelecimento_id, horas_turno, seccao, local_trabalho, tarefa, substancias, superior_hierarquico, condicoes, testemunhas, causas, descricao, conclusoes, accoes) VALUES ("; + sql += newId + ", '"; + sql += a.getData_acidente() + "', "; + sql += a.getTrabalhador_id() + ", "; + sql += a.getEstado() + ", "; + sql += a.getEstabelecimento_id() + ", "; + sql += a.getHoras_turno() + ", '"; + sql += a.getSeccao() + "', '"; + sql += a.getLocal_trabalho() + "', '"; + sql += a.getTarefa() + "', '"; + sql += a.getSubstancias() + "', '"; + sql += a.getSuperior_hierarquico() + "', '"; + sql += a.getCondicoes() + "', '"; + sql += a.getTestemunhas() + "', '"; + sql += a.getCausas() + "', '"; + sql += a.getDescricao() + "', '"; + sql += a.getConclusoes() + "', '"; + sql += a.getAccoes() + "')"; + st.execute(sql); + + return newId; + } + + public void updateAnalise(AnaliseAcidente a) throws Exception + { + Statement st = createStatement(); + String sql = "UPDATE analises_acidentes SET data_acidente = '" + a.getData_acidente() + "', "; + sql += "trabalhador_id = " + a.getTrabalhador_id() + ", "; + sql += "estado = " + a.getEstado() + ", "; + sql += "estabelecimento_id = " + a.getEstabelecimento_id() + ", "; + sql += "horas_turno = " + a.getHoras_turno() + ", "; + sql += "seccao = '" + a.getSeccao() + "', "; + sql += "local_trabalho = '" + a.getLocal_trabalho() + "', "; + sql += "tarefa = '" + a.getTarefa() + "', "; + sql += "substancias = '" + a.getSubstancias() + "', "; + sql += "superior_hierarquico = '" + a.getSuperior_hierarquico() + "', "; + sql += "condicoes = '" + a.getCondicoes() + "', "; + sql += "testemunhas = '" + a.getTestemunhas() + "', "; + sql += "causas = '" + a.getCausas() + "', "; + sql += "descricao = '" + a.getDescricao() + "', "; + sql += "conclusoes = '" + a.getConclusoes() + "', "; + sql += "accoes = '" + a.getAccoes() + "' "; + sql += "WHERE id = " + a.getId(); + System.out.println("SQL : " + sql); + st.execute(sql); + } + + + + private Statement createStatement() + { + Db db = new Db(); + return db.createStatement(); + } + +} diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/db/AnalisesSeguimentoDataProvider.java b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/db/AnalisesSeguimentoDataProvider.java new file mode 100644 index 00000000..a5f9052a --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/db/AnalisesSeguimentoDataProvider.java @@ -0,0 +1,24 @@ +/* + * AnalisesSeguimentoDataProvider.java + * + * Created on September 20, 2007, 1:42 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package db; + +import com.sun.data.provider.impl.ObjectListDataProvider; + +/** + * + * @author lluis + */ +public class AnalisesSeguimentoDataProvider extends ObjectListDataProvider { + + /** Creates a new instance of AnalisesSeguimentoDataProvider */ + public AnalisesSeguimentoDataProvider() { + } + +} diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/db/Db.java b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/db/Db.java new file mode 100644 index 00000000..20590852 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/db/Db.java @@ -0,0 +1,58 @@ +/* + * Db.java + * + * Created on September 19, 2007, 5:10 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package db; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.Statement; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpSession; + +/** + * + * @author lluis + */ +public class Db { + String connectionURL = "jdbc:postgresql://storage:5432/siprp"; + String User = "postgres"; + String Pass = null; + Connection connection = null; + + /** Creates a new instance of Db */ + public Db() { + } + + public Connection connect() throws Exception + { + Class.forName("org.postgresql.Driver").newInstance(); + connection = DriverManager.getConnection(connectionURL, User, Pass); + HttpSession session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(true); + session.setAttribute("connection", connection); + return connection; + } + + public Statement createStatement() + { + HttpSession session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false); + connection = (Connection) session.getAttribute("connection"); + Statement st; + try + { + st = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + return st; + } + catch(Exception ex) + { + ex.printStackTrace(); + return null; + } + } +} diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/db/Dblocal.java b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/db/Dblocal.java new file mode 100644 index 00000000..cb88d313 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/db/Dblocal.java @@ -0,0 +1,64 @@ +/* + * Dblocal.java + * + * Created on September 20, 2007, 2:07 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package db; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.Statement; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpSession; + +/** + * + * @author lluis + */ +public class Dblocal { + String connectionURL = "jdbc:postgresql://storage:5432/siprp_local"; + String User = "postgres"; + String Pass = null; + Connection connection = null; + + /** Creates a new instance of Dblocal */ + public Dblocal() { + } + + public Connection connect() throws Exception + { + Class.forName("org.postgresql.Driver").newInstance(); + connection = DriverManager.getConnection(connectionURL, User, Pass); + HttpSession session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(true); + session.setAttribute("connection_local", connection); + return connection; + } + + public Statement createStatement() + { + HttpSession session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false); + connection = (Connection) session.getAttribute("connection_local"); + Statement st; + try + { + st = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + return st; + } + catch(Exception ex) + { + ex.printStackTrace(); + return null; + } + } + + public void close() throws Exception + { + connection.close(); + } + +} diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/db/TrabalhadoresListDataProvider.java b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/db/TrabalhadoresListDataProvider.java new file mode 100644 index 00000000..0edc8ae4 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/db/TrabalhadoresListDataProvider.java @@ -0,0 +1,24 @@ +/* + * TrabalhadoresListDataProvider.java + * + * Created on September 26, 2007, 4:25 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package db; + +import com.sun.data.provider.impl.ObjectListDataProvider; + +/** + * + * @author lluis + */ +public class TrabalhadoresListDataProvider extends ObjectListDataProvider { + + /** Creates a new instance of TrabalhadoresListDataProvider */ + public TrabalhadoresListDataProvider() { + } + +} diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/db/UtilizadoresDataProvider.java b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/db/UtilizadoresDataProvider.java new file mode 100644 index 00000000..7100737c --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/db/UtilizadoresDataProvider.java @@ -0,0 +1,92 @@ +/* + * UtilizadoresDataProvider.java + * + * Created on September 20, 2007, 10:03 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package db; + +import analiseacidentestrabalho.Utilizador; +import java.sql.ResultSet; +import java.sql.Statement; + +/** + * + * @author lluis + */ +public class UtilizadoresDataProvider { + + /** Creates a new instance of UtilizadoresDataProvider */ + public UtilizadoresDataProvider() { + } + + public Integer getMaxUserId() + { + Statement st = createStatement(); + String sql = "SELECT max(qst_users.id)+1 AS MAXUSERID FROM utilizadores"; + try + { + ResultSet rs = st.executeQuery(sql); + rs.first(); + Integer newId = new Integer(rs.getInt("MAXUSERID")); + return newId; + } + catch(Exception ex) + { + return new Integer(1); + } + } + + public Integer createNewUtilizador(Utilizador u) throws Exception + { + Statement st = createStatement(); + Integer newUserId = getMaxUserId(); + + st.execute("INSERT INTO utilizadores (id, login, password, email, empresa_id, estabelecimento_id, administrador) VALUES (" + newUserId + ", '" + u.getLogin() + "', '" + u.getPassword() + "', '" + u.getEmail() + "', " + u.getEmpresa_id() + ", " + u.getEstabelecimento_id() + ", '" + u.getAdministrador() + "')"); + return newUserId; + } + + public void updateUtilizador(Utilizador u) throws Exception + { + Statement st = createStatement(); + String sql = "UPDATE utilizadores SET login = '" + u.getLogin() + "', password = '" + u.getPassword() + "', email = '" + u.getEmail() + "', empresa_id = " + u.getEmpresa_id() + ", estabelecimento_id = " + u.getEstabelecimento_id() + ", administrador = '" + u.getAdministrador() + "' WHERE id = " + u.getId(); + st.execute(sql); + } + + public Utilizador getUtilizador(String login) throws Exception + { + Utilizador u = new Utilizador(); + Statement st = createStatement(); + String sql = "SELECT * FROM utilizadores WHERE login = '" + login + "'"; + ResultSet rs = st.executeQuery(sql); + rs.first(); + u.setId(new Integer(rs.getInt("id"))); + u.setLogin(rs.getString("login")); + u.setPassword(rs.getString("password")); + u.setEmail(rs.getString("email")); + u.setEmpresa_id(new Integer(rs.getInt("empresa_id"))); + u.setEstabelecimento_id(new Integer(rs.getInt("estabelecimento_id"))); + u.setAdministrador(rs.getString("administrador")); + return u; + } + + public Integer getPermissionCode(Integer userId) throws Exception + { + Statement st = createStatement(); + String sql = "SELECT * FROM permissoes WHERE user_id = " + userId; + ResultSet rs = st.executeQuery(sql); + rs.first(); + Integer permission = new Integer(rs.getInt("codigo_permissao")); + return permission; + } + + private Statement createStatement() + { + Db db = new Db(); + return db.createStatement(); + } + +} diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/pagestate/AnaliseAcidenteTrabalhoState.java b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/pagestate/AnaliseAcidenteTrabalhoState.java new file mode 100644 index 00000000..898a7874 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/src/java/pagestate/AnaliseAcidenteTrabalhoState.java @@ -0,0 +1,158 @@ +/* + * AnaliseAcidenteTrabalhoState.java + * + * Created on September 27, 2007, 5:18 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package pagestate; + +/** + * + * @author lluis + */ +public class AnaliseAcidenteTrabalhoState { + private Object estabelecimento; + private Object trabalhador; + private Object data_nascimento; + private Object horas_turno; + private Object seccao; + private Object local_trabalho; + private Object tarefa; + private Object substancias; + + private Object superior_hierarquico; + private Object condicoes; + private Object testemunhas; + private Object causas; + private Object descricao; + private Object conclusoes; + private Object accoes; + + /** Creates a new instance of AnaliseAcidenteTrabalhoState */ + public AnaliseAcidenteTrabalhoState() { + } + + public Object getEstabelecimento() { + return estabelecimento; + } + + public void setEstabelecimento(Object estabelecimento) { + this.estabelecimento = estabelecimento; + } + + public Object getTrabalhador() { + return trabalhador; + } + + public void setTrabalhador(Object trabalhador) { + this.trabalhador = trabalhador; + } + + public Object getData_nascimento() { + return data_nascimento; + } + + public void setData_nascimento(Object data_nascimento) { + this.data_nascimento = data_nascimento; + } + + public Object getHoras_turno() { + return horas_turno; + } + + public void setHoras_turno(Object horas_turno) { + this.horas_turno = horas_turno; + } + + public Object getSeccao() { + return seccao; + } + + public void setSeccao(Object seccao) { + this.seccao = seccao; + } + + public Object getLocal_trabalho() { + return local_trabalho; + } + + public void setLocal_trabalho(Object local_trabalho) { + this.local_trabalho = local_trabalho; + } + + public Object getTarefa() { + return tarefa; + } + + public void setTarefa(Object tarefa) { + this.tarefa = tarefa; + } + + public Object getSubstancias() { + return substancias; + } + + public void setSubstancias(Object substancias) { + this.substancias = substancias; + } + + public Object getSuperior_hierarquico() { + return superior_hierarquico; + } + + public void setSuperior_hierarquico(Object superior_hierarquico) { + this.superior_hierarquico = superior_hierarquico; + } + + public Object getCondicoes() { + return condicoes; + } + + public void setCondicoes(Object condicoes) { + this.condicoes = condicoes; + } + + public Object getTestemunhas() { + return testemunhas; + } + + public void setTestemunhas(Object testemunhas) { + this.testemunhas = testemunhas; + } + + public Object getCausas() { + return causas; + } + + public void setCausas(Object causas) { + this.causas = causas; + } + + public Object getDescricao() { + return descricao; + } + + public void setDescricao(Object descricao) { + this.descricao = descricao; + } + + public Object getAccoes() { + return accoes; + } + + public void setAccoes(Object accoes) { + this.accoes = accoes; + } + + public Object getConclusoes() { + return conclusoes; + } + + public void setConclusoes(Object conclusoes) { + this.conclusoes = conclusoes; + } + +} diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/AnaliseAcidenteTrabalho.jsp b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/AnaliseAcidenteTrabalho.jsp new file mode 100644 index 00000000..14e34439 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/AnaliseAcidenteTrabalho.jsp @@ -0,0 +1,223 @@ + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/Dummy.jsp b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/Dummy.jsp new file mode 100644 index 00000000..5b3cf3ab --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/Dummy.jsp @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/Erro.jsp b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/Erro.jsp new file mode 100644 index 00000000..6c54bd5e --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/Erro.jsp @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/Footer.jspf b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/Footer.jspf new file mode 100644 index 00000000..6c3d280f --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/Footer.jspf @@ -0,0 +1,12 @@ + +
+ + + + + + + + + +
diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/FormHS.jsp b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/FormHS.jsp new file mode 100644 index 00000000..3a0083d9 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/FormHS.jsp @@ -0,0 +1,158 @@ + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/FormRH.jsp b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/FormRH.jsp new file mode 100644 index 00000000..003e8d6d --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/FormRH.jsp @@ -0,0 +1,158 @@ + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/FormSeguranca.jsp b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/FormSeguranca.jsp new file mode 100644 index 00000000..cb7b8b61 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/FormSeguranca.jsp @@ -0,0 +1,163 @@ + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/Header.jspf b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/Header.jspf new file mode 100644 index 00000000..fd3167a8 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/Header.jspf @@ -0,0 +1,8 @@ + +
+ + + + + +
diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/LoadImage.jsp b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/LoadImage.jsp new file mode 100644 index 00000000..412d4e27 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/LoadImage.jsp @@ -0,0 +1,43 @@ + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/Login.jsp b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/Login.jsp new file mode 100644 index 00000000..717f0f87 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/Login.jsp @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+
+
+
+
+
+
diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/META-INF/context.xml b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/META-INF/context.xml new file mode 100644 index 00000000..e3929bc2 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/RecuperarPassword.jsp b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/RecuperarPassword.jsp new file mode 100644 index 00000000..84dea9bc --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/RecuperarPassword.jsp @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+
+
+
+
+
+
diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/Top.jspf b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/Top.jspf new file mode 100644 index 00000000..a35f7542 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/Top.jspf @@ -0,0 +1,19 @@ + +
+ + + + + + + + + + + + + + + +
diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/ViewAnaliseAcidenteTrabalho.jsp b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/ViewAnaliseAcidenteTrabalho.jsp new file mode 100644 index 00000000..379b3232 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/ViewAnaliseAcidenteTrabalho.jsp @@ -0,0 +1,189 @@ + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/WEB-INF/faces-config.xml b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/WEB-INF/faces-config.xml new file mode 100644 index 00000000..8f46eebf --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/WEB-INF/faces-config.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/WEB-INF/managed-beans.xml b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/WEB-INF/managed-beans.xml new file mode 100644 index 00000000..62ae9326 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/WEB-INF/managed-beans.xml @@ -0,0 +1,85 @@ + + + + + SessionBean1 + analiseacidentestrabalho.SessionBean1 + session + + + Login + analiseacidentestrabalho.Login + request + + + ApplicationBean1 + analiseacidentestrabalho.ApplicationBean1 + application + + + RequestBean1 + analiseacidentestrabalho.RequestBean1 + request + + + RecuperarPassword + analiseacidentestrabalho.RecuperarPassword + request + + + Header + analiseacidentestrabalho.Header + request + + + Dummy + analiseacidentestrabalho.Dummy + request + + + Footer + analiseacidentestrabalho.Footer + request + + + FormSeguranca + analiseacidentestrabalho.FormSeguranca + request + + + Erro + analiseacidentestrabalho.Erro + request + + + Top + analiseacidentestrabalho.Top + request + + + LoadImage + analiseacidentestrabalho.LoadImage + request + + + AnaliseAcidenteTrabalho + analiseacidentestrabalho.AnaliseAcidenteTrabalho + request + + + ViewAnaliseAcidenteTrabalho + analiseacidentestrabalho.ViewAnaliseAcidenteTrabalho + request + + + FormRH + analiseacidentestrabalho.FormRH + request + + + FormHS + analiseacidentestrabalho.FormHS + request + + diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/WEB-INF/navigation.xml b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/WEB-INF/navigation.xml new file mode 100644 index 00000000..f56c0e67 --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/WEB-INF/navigation.xml @@ -0,0 +1,102 @@ + + + + + /Login.jsp + + recuperar_password + /RecuperarPassword.jsp + + + erro + /Erro.jsp + + + form_seguranca + /FormSeguranca.jsp + + + form_rh + /FormRH.jsp + + + form_hs + /FormHS.jsp + + + + /RecuperarPassword.jsp + + login + /Login.jsp + + + + /FormSeguranca.jsp + + login + /Login.jsp + + + analise_acidente + /AnaliseAcidenteTrabalho.jsp + + + view_analise + /ViewAnaliseAcidenteTrabalho.jsp + + + + /FormRH.jsp + + login + /Login.jsp + + + analise_acidente + /AnaliseAcidenteTrabalho.jsp + + + view_analise + /ViewAnaliseAcidenteTrabalho.jsp + + + + /FormHS.jsp + + login + /Login.jsp + + + analise_acidente + /AnaliseAcidenteTrabalho.jsp + + + view_analise + /ViewAnaliseAcidenteTrabalho.jsp + + + + /AnaliseAcidenteTrabalho.jsp + + load_image + /LoadImage.jsp + + + form_seguranca + /FormSeguranca.jsp + + + login + /Login.jsp + + + + /LoadImage.jsp + + analise_acidente + /AnaliseAcidenteTrabalho.jsp + + + diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/WEB-INF/web.xml b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/WEB-INF/web.xml new file mode 100644 index 00000000..b23abf6d --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/WEB-INF/web.xml @@ -0,0 +1,14 @@ + +javax.faces.STATE_SAVING_METHODserverjavax.faces.CONFIG_FILES/WEB-INF/navigation.xml,/WEB-INF/managed-beans.xmlcom.sun.faces.validateXmltruecom.sun.faces.verifyObjectsfalseUploadFiltercom.sun.rave.web.ui.util.UploadFilter + The maximum allowed upload size in bytes. If this is set + to a negative value, there is no maximum. The default + value is 1000000. + maxSize1000000 + The size (in bytes) of an uploaded file which, if it is + exceeded, will cause the file to be written directly to + disk instead of stored in memory. Files smaller than or + equal to this size will be stored in memory. The default + value is 4096. + sizeThreshold4096UploadFilterFaces ServletFaces Servletjavax.faces.webapp.FacesServlet 1 ExceptionHandlerServletcom.sun.errorhandler.ExceptionHandlererrorHostlocalhosterrorPort24444ThemeServletcom.sun.rave.web.ui.theme.ThemeServletFaces Servlet/faces/*ExceptionHandlerServlet/error/ExceptionHandlerThemeServlet/theme/* + faces/Login.jsp + javax.servlet.ServletException/error/ExceptionHandlerjava.io.IOException/error/ExceptionHandlerjavax.faces.FacesException/error/ExceptionHandlercom.sun.rave.web.ui.appbase.ApplicationException/error/ExceptionHandler*.jspftrue diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/resources/images/SIPRP_logo_small.jpg b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/resources/images/SIPRP_logo_small.jpg new file mode 100644 index 00000000..240f2358 Binary files /dev/null and b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/resources/images/SIPRP_logo_small.jpg differ diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/resources/images/black_spacer.gif b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/resources/images/black_spacer.gif new file mode 100644 index 00000000..d370e341 Binary files /dev/null and b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/resources/images/black_spacer.gif differ diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/resources/images/logo_auchan_small.jpg b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/resources/images/logo_auchan_small.jpg new file mode 100644 index 00000000..376eee0e Binary files /dev/null and b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/resources/images/logo_auchan_small.jpg differ diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/resources/images/logo_auchan_small1.jpg b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/resources/images/logo_auchan_small1.jpg new file mode 100644 index 00000000..f9e50690 Binary files /dev/null and b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/resources/images/logo_auchan_small1.jpg differ diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/resources/images/logo_evolute_small.png b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/resources/images/logo_evolute_small.png new file mode 100644 index 00000000..0198da2b Binary files /dev/null and b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/resources/images/logo_evolute_small.png differ diff --git a/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/resources/stylesheet.css b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/resources/stylesheet.css new file mode 100644 index 00000000..af4213db --- /dev/null +++ b/AnaliseAcidentesTrabalho/AnaliseAcidentesTrabalho/web/resources/stylesheet.css @@ -0,0 +1,109 @@ +/* Style rules to make data tables look better */ +body {background-color: #bbd400} +.list-header { + background-color: #eeeeee; + font-size: larger; + font-weight: bold; +} + +.list-paging-header { + background-color: white; +} + +.gridColLeft { + text-align : left; +} + +.gridColCenter { + text-align: center; +} + +.gridColRight { + text-align: right; +} + +.gridColRightBottom { + text-align: right; + vertical-align: bottom; +} + +.gridColLeft15{ + text-align: left; + width: 15%; +} + +.gridColLeft85{ + text-align: left; + width: 85%; +} + +.gridLayoutTopCols { + vertical-align : top; + width : 50%; + border : solid 1px #000000; + background-color: #f6f4e8; +} + +.gridCellBordered { + border-bottom : solid 1px #000000; +} + +.footer { + bottom: 0; + height: 10%; + position: fixed; + right: 0; + top: 90%; + width: 100% +} + +.centerBlock{ + text-align: center; + left: 0; + right: 0; + margin-left: auto; + margin-right: auto;} + + +.list-paging-footer { + background-color: white; +} + +.list-row-even { +} + +.list-row-odd { + background-color: #eeeeee; +} + +/* Style rules for message severity levels */ + +.infoMessage { + color: black; +} + +.warnMessage { + color: orange; + font-weight: bold; +} + +.errorMessage { + color: red; + font-weight: bold; +} + +.fatalMessage { + color: red; + font-style: italic; + font-weight: bold; +} + + +.labelTrabalhador { + color: #000000; +} + +.labelTrabalhador:hover { + font-weight: bold; + text-decoration : none; +}